Add in flight OSD menu mode via switch - #11782
Conversation
- Allow CMS to open while armed via BOXUSER4 (placeholder for a dedicated BOXCMS mode to be added by maintainers) - Restrict access to NAV modes only (POSHOLD, CRUISE, RTH, ALTHOLD) - Add 3-second activation countdown on OSD (MENU IN X.X) - Latch switch state to prevent re-open while switch stays ON - Force-close CMS if safety condition lost (disarm, failsafe, mode exit) - Block YAW stick gestures while armed to avoid accidental activation
- Display hardware-blinking warning (USE NAV MODES FOR MENU) when pilot attempts CMS activation outside of valid NAV modes - Display opening countdown (MENU IN X.X) during 3s delay - Display inactivity auto-close countdown (CLOSING IN X) in the last 10 seconds before the 15s timeout triggers - Clean up countdown text immediately when pilot resumes input to avoid ghost characters on the OSD screen
- Introduce menuMainInFlight and menuFeaturesInFlight as static const clones of the standard menus, omitting SAVE+REBOOT, BLACKBOX, and MIXER and SERVOS entries - Select the appropriate root menu in cmsMenuOpen() based on the cmsOpenedInFlight flag set at open time - Ground menu (disarmed) is completely unaffected and remains 100 percent identical to stock INAV behavior - Avoids dynamic entry hiding which would break CMS pagination math
- Decouple PID RAM writeback from the BACK button in cmsx_menuPid, cmsx_menuPidAltMag and cmsx_menuPidGpsnav by setting onExit to NULL - Add a SET submenu entry before BACK in all three PID lists - Each SET submenu shows a CONFIRM page with YES and NO options YES commits the edited values to RAM via the original writeback function and returns to the PID menu via MENU_CHAIN_BACK NO simply goes back discarding all pending changes - This prevents accidental mid-flight PID commits when the pilot presses BACK or the auto-close timer fires
- cms_menu_vtx: guard saveConfigAndNotify() with !ARMING_FLAG(ARMED) so that confirming VTX settings in flight applies the new band, channel and power to the hardware and RAM immediately without triggering an EEPROM write or the saving settings OSD message and without causing ESC beeps on landing Ground behavior (disarmed) remains unchanged - cms_menu_battery: call batteryInit() on exit from battery settings and battery menu only when ARMING_FLAG(ARMED) is set, so that changes to cell count and voltage thresholds take effect instantly in RAM without requiring SAVE+REBOOT during flight Ground menu behavior (disarmed) remains completely unaffected
…witch delays - Introduce cmsx_menuImuInFlight, cmsx_menuBatteryInFlight, and cmsx_menuMiscInFlight omitting submenus that cannot be updated live in flight (EZTUNE, FILTERING, MECHANICS, PROF AUTOSWITCH, FS PROCEDURE) - Add immediate schedulePidGainsUpdate(), navigationUsePIDs(), and activateControlConfig() to cmsx_profileIndexOnChange() for seamless in-flight profile switching - Disarmed ground menus remain 100 percent complete and untouched
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
|
I'm not sure you want Most of that stuff can be accessed and controlled by using the Programming Framework.. But I guess this won't require an extra Aux channel to be used, just the sticks. |
…check - Require altitude-holding modes (POSHOLD, RTH, WP, ALTHOLD) to ensure altitude stabilization while accessing the CMS in flight. - Standalone Course Hold only locks heading without controlling pitch/altitude. CRUISE mode remains supported as it activates NAV_ALTHOLD_MODE alongside heading hold.
|
Thanks for the feedback @Jetrell I've updated the PR to drop standalone Course Hold, so only modes that hold altitude ( And yes, exactly, the main goal here is simplicity. You only need a single AUX switch to open the menu and then use standard sticks to navigate and adjust everything visually, without needing extra AUX channels, pots, or complex Logic Conditions. |
|
ⓘ 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 QodoEnable safe in-flight CMS (OSD) menu via AUX switch with NAV-mode guards
AI Description
Diagram
High-Level Assessment
Files changed (14)
|
Code Review by Qodo
1.
|
| return FLIGHT_MODE(NAV_POSHOLD_MODE) || | ||
| FLIGHT_MODE(NAV_RTH_MODE) || | ||
| FLIGHT_MODE(NAV_WP_MODE) || | ||
| FLIGHT_MODE(NAV_ALTHOLD_MODE); |
There was a problem hiding this comment.
2. Course-hold nav gate missing 🐞 Bug ≡ Correctness
cmsIsNavModeActive() is used to allow opening/keeping the in-flight CMS, but it omits NAV_COURSE_HOLD_MODE. As a result, COURSE_HOLD will be treated as unsafe: the menu cannot be opened in COURSE_HOLD and will also be force-closed if COURSE_HOLD is the only active nav mode.
Agent Prompt
### Issue description
`cmsIsNavModeActive()` does not consider `NAV_COURSE_HOLD_MODE` as an allowed stabilized mode for in-flight CMS. This blocks the feature (and triggers emergency close) in COURSE_HOLD.
### Issue Context
`NAV_COURSE_HOLD_MODE` is a first-class flight mode flag.
### Fix Focus Areas
- Add `FLIGHT_MODE(NAV_COURSE_HOLD_MODE)` to `cmsIsNavModeActive()`.
- Re-check both open and forced-close conditions that depend on this helper.
- src/main/cms/cms.c[1390-1396]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…ng battery refresh - Unwind menuStack and invoke per-menu onExit callbacks during in-flight CMS_EXIT so transient state (e.g. OSD layout preview override) is cleanly cleared when the menu collapses due to timeout, switch-off, or emergency - Introduce batteryUpdateThresholdsAndCells() to seamlessly recompute cell count and voltage thresholds in RAM without resetting batteryState or zeroing batteryFullVoltage, preventing transient throttle scaling glitches in mixer
I'd have thought this could work with Multifunction as the method of activation avoiding the need for an Aux switch. Although obviously you wouldn't be able deactivate it using the Multifunction OSD field given it won't be visible with CMS active but I assume the normal CMS Exit command could still be used instead, or you let it time out via inactivity or simpler still just switch out of the Nav mode briefly. |
|
Thanks for the suggestion @breadoven That's an interesting idea to save an AUX channel but for this initial pr now I wanted to keep the safety model as simple, predictable, and solid as possible, where a physical switch provides a dedicated, direct way to open and instantly close the menu. Adding Multifunction support would be a great follow up enhancement for a future update once this core baseline is eventually in inav 10 |
This PR introduces the ability to safely open and use the CMS OSD menu while the aircraft is armed in flight. Previously, CMS access was strictly hard-blocked while armed.
The goal is to allow pilots (especially fixed-wing and long-range multirotor flyers) to tune PIDs, adjust rates, switch profiles, change VTX power/channels, or tweak battery thresholds in real time during cruise/loiter without having to land and disarm.
InFlightOsd.mp4
Safety
Because stick inputs are hijacked to navigate the OSD menu, strict safety layers are enforced:
POSHOLD,CRUISE,RTH,ALTHOLD).USE NAV MODES FOR MENUwarning is displayed on the OSD.MENU IN X.X) on the OSD before opening, preventing accidental switch flicks.CLOSING IN X) during the last 10 seconds.Menu Structure In Flight
Ground Menu (Disarmed)
EZTUNE,FILTERING,MECHANICS,SAVE+REBOOT, etc.).In-Flight Menu (Armed)
To prevent misleading the pilot, the in-flight hierarchy only exposes settings that apply 100% in real time to RAM:
schedulePidGainsUpdate()&navigationUsePIDs().SET -> YESconfirmation before committing to RAM.BACKsafely cancels.SETconfirmation.activateControlConfig()(updates throttle curves mid/expo live).batteryInit().Intentionally Excluded from In-Flight Menu (by design):
SAVE+REBOOT/SAVE+EXIT(prohibited while flying)BLACKBOX&MIXER & SERVOS(dangerous / irrelevant in flight)FILTERING&EZTUNE(filter cutoffs are only initialized at boot; editing them mid-air does not recalculate active filter coefficients)MECHANICS(contains static filter cutoffs like CD LPF and iTerm cutoff)FS PROCEDURE(preventing accidental failsafe setting changes during flight)BATTERY AUTOSWITCH(one-time ground detection feature)(P.S.: Some of the categories that were removed are still shown in my video—just ignore them.)
Testing
BOXUSER4. For an official merge into INAV 10, a dedicated mode likeIN-FLIGHT MENUorOSD MENUmust be added toinav-configurator.