Repository navigation
Stop the mixer save when the flight controller refuses a servo rule - #2871
sensei-hacker wants to merge 2 commits into
Conversation
The FC answers MSP2_INAV_SET_SERVO_MIXER with an MSP error when a rule uses an input the board doesn't support, such as RC channel 19-34 on a 512 KB board. The configurator never looked at error replies, so the save went on to write the EEPROM and reboot, and the rule was silently dropped. MSP callbacks now get the reply's error flag. sendServoMixer still sends every rule, then names each refused one in the log and a dialog, and stops the save before the EEPROM write and reboot. The defaults dialog closes its progress window when that happens.
|
ⓘ 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 QodoStop mixer save when FC refuses a servo rule
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
|
Configurator test build ready — commit Download build artifacts for PR #2871 Available platforms (scroll to the Artifacts section at the bottom of the run page):
|
Applying a preset switches through every control and battery profile and sets applied_defaults before it sends the mixer. When the flight controller refuses a servo rule, the defaults dialog now selects the profiles that were active before and sets applied_defaults back to 0, so the dialog is offered again on the next connection. The refusal message now says the flight controller keeps using the rules it accepted until it reboots. The MSPHelper test setup that two tests had copied is one helper, tests/helpers/mspHelperLoader.mjs.
|



Pairs with the firmware PRs iNavFlight/inav#12284 (release/9.1) and iNavFlight/inav#12285 (maintenance-10.x). With those, the FC answers
MSP2_INAV_SET_SERVO_MIXERwith an MSP error when a servo rule uses an input the board doesn't support, such as RC channel 19–34 on a 512 KB board.Problem
The configurator never looked at MSP error replies. The decoder sets
unsupportedwhen the FC replies$X!, but callbacks never received that flag.So when the FC refused a servo rule, the Mixer tab carried on: it wrote the EEPROM, rebooted, and the rule was gone. Nothing told the user.
Changes
MSP callbacks now get
error: truewhen the FC's reply was an error. Nothing changes on the wire, and existing callbacks ignore the extra field.sendServoMixerstill sends every rule. If the FC refused any, it:An optional second callback tells the caller about the refusal.
Defaults dialog: if a rule is refused while a preset is being applied, it uses that callback to close its progress window, so the dialog isn't left stuck.
On firmware without #12284/#12285 the FC never refuses a servo rule, so nothing changes there.
Testing
tests/servo-mixer-save-refused.test.mjsruns the realMSPHelper.js. It covers all rules accepted, one or two rules refused, the last rule refused, the refusal callback, and the error flag reaching callbacks. Five of its six cases fail on the old code; the all-accepted case passes on both.tests/msp-parse-failure-recovery.test.mjsgets a stub for the newjboximport.npm test: all pass.The defaults-dialog refusal path is covered only by the unit test, because no preset uses RC channel 19–34.