Repository navigation
Conversation
Copies one profile slot onto another and saves it. Control profiles copy every profile-scoped parameter group (PID, EZ-tune) plus the control-rate profile; battery and mixer profiles copy their array entry. The EEPROM is written and re-read afterwards, like the profile-select commands do, so derived state follows when the copy lands in the active profile. Rejected while armed, for unknown kinds, out-of-range indexes or identical source and destination. Docs: new message in msp_messages.json (spec 2.1.1), README regenerated, configProfileType_e added to the enum reference.
|
Functional test done with the CI-built SITL of this branch (fork run https://github.com/Raffi1202/inav/actions/runs/34391346661,
The failing "Parameter Group Version Check" on the fork run is the known script bug ( |
Reuse the CI fixes from iNavFlight#11885 and cover scalar, array and conditional registrations with regression fixtures.
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoAdd MSP profile copying and harden PG version checks
AI Description
Diagram
High-Level Assessment
Files changed (13)
|
Code Review by Qodo
1.
|
Those files belong to iNavFlight#11885, which replaces check-pg-versions.sh with a Python checker. Carrying a copy here only produces a conflict once either lands, and it is unrelated to this change.
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #11888 250 targets built. Find your board's
|
|
Thanks, the firmware side is clean and small. I measured it: +192 B flash on MATEKF722SE, +448 B on MATEKF405SE, no RAM. The size-bot table above is not this PR; it appears to compare against the 2026-09-08 base and includes everything merged into maintenance-10.x since. I'm still declining the firmware part. You need a Configurator change for the UI anyway, and the copy itself can live there too: a small helper that enters the CLI, selects the source ( Could you rework iNavFlight/inav-configurator#2746 that way? |
The firmware side (iNavFlight/inav#11888) was declined in favour of a Configurator-only copy, so 0x2081 does not exist on any firmware and every copy failed with an MSP error. The dialog now enters the CLI, runs "dump control_profile", "dump battery_profile" or "dump mixer_profile" on the active slot, selects the destination slot, replays the set/mmix/smix lines, selects the source slot again and saves. The save reboots the flight controller, which a mixer-profile copy needs anyway; the Configurator reconnects and reopens the current tab. A dump that does not report the expected source slot (or a mixer dump without its mmix/smix sections) is read again and never replayed; a rejected line aborts with "exit", so no copied value is saved. Each CLI profile selection stores the slot choice, so the log names the slot that is active after such a failure, and a failure after re-selecting the source says the copy may already be stored. MSP polling is held off while the CLI session runs; the dialog cannot be closed and tabs cannot be switched meanwhile, because a tab switch would send "exit" into that CLI session. Disconnecting during a copy sends "exit" before the port closes, as the CLI tab does, so the flight controller leaves CLI mode and the next connection gets MSP answers. If the port is already gone, the log says the flight controller may still be in CLI mode. The copy logic sits in js/profile_copy.js with node:test coverage.
Problem
INAV keeps three control profiles, three battery profiles and, on targets with
MAX_MIXER_PROFILE_COUNT> 1, mixer profiles, but the firmware offers no way to copy one slot onto another.MSP_SELECT_SETTING,MSP2_INAV_SELECT_BATTERY_PROFILEandMSP2_INAV_SELECT_MIXER_PROFILEonly switch the active profile, so a tuned profile has to be re-entered value by value or replayed from a CLIdump control_profile. No issue is linked.Cause
src/main/fc/fc_msp.c:3788-3802(maintenance-10.x) carries only the profile-select handlers; the only profile write path issetConfigProfileAndWriteEEPROM()atsrc/main/fc/config.c:469-478, andsrc/main/fc/cli.c:3932still holds the commented-outcopyCurrentProfileToProfileSlotcall that was never implemented.Change
New
pgCopyProfile()inparameter_group.cmemcpy's every non-system parameter group from one profile slot to another, next topgActivateProfile(). NewcopyConfigProfileAndWriteEEPROM(type, from, to)inconfig.cdispatches onconfigProfileType_e(0 control, 1 battery, 2 mixer): control copies the profile PGs pluscontrolProfiles[], battery and mixer copy their array entry; it refuses same index, out-of-range indexes (MAX_PROFILE_COUNT/MAX_CONTROL_PROFILE_COUNT,MAX_BATTERY_PROFILE_COUNT,MAX_MIXER_PROFILE_COUNT) and unknown types, then runswriteEEPROM()/readEEPROM()undersuspendRxSignal()like the select functions.MSP2_INAV_COPY_PROFILE(0x2081, payloadtype, from, to) infc_msp.creturns an error when armed, when the length is not 3, or when the copy is refused.Test
SITL: fork build of 91fab5f (https://github.com/Raffi1202/inav/actions/runs/34391346661,
inav-9.1.0-ci-20260909-91fab5f_SITL-WIN) driven from the configurator dialog of iNavFlight/inav-configurator#2746: battery profile 2 → 3 answered OK; roll P of control profile 1 set to 77 and saved, copy 1 → 2, switch to profile 2,MSP_PIDreads[77, 30, 23, 60](was[40, 30, 23, 60]); a 9.1 SITL without the command answers unsupported (#11888 (comment)). Head e30027e differs from the tested commit only by the addedMAX_CONTROL_PROFILE_COUNTbound; it builds on fork CI (https://github.com/Raffi1202/inav/actions/runs/34622224337) and passes the host unit tests (https://github.com/Raffi1202/inav/actions/runs/34622224395). Not run on hardware.Flash / RAM
Not measured yet. The upstream firmware CI has not been released for this PR, so no size report exists.
Docs
docs/development/msp/msp_messages.json(new message, spec 2.1.0 → 2.1.1),docs/development/msp/README.mdregenerated,configProfileType_eadded todocs/development/msp/inav_enums.jsonandinav_enums_ref.md. No user-facing page changes: the firmware adds no CLI command or setting; the dialog is in iNavFlight/inav-configurator#2746.