diff --git a/src/drivers/osd/msp_osd/uorb_to_msp.cpp b/src/drivers/osd/msp_osd/uorb_to_msp.cpp index bb2db04a167..9bcd2d3f5b7 100644 --- a/src/drivers/osd/msp_osd/uorb_to_msp.cpp +++ b/src/drivers/osd/msp_osd/uorb_to_msp.cpp @@ -89,7 +89,7 @@ msp_name_t construct_display_message(const vehicle_status_s &vehicle_status, } // display flight mode - display.set(MessageDisplayType::FLIGHT_MODE, mode_util::nav_state_names[vehicle_status.nav_state]); + display.set(MessageDisplayType::FLIGHT_MODE, mode_util::nav_state_name(vehicle_status.nav_state, vehicle_status.vehicle_type)); } // display, if updated diff --git a/src/lib/modes/ui.hpp b/src/lib/modes/ui.hpp index 2ac70734df4..43f75e64a4c 100644 --- a/src/lib/modes/ui.hpp +++ b/src/lib/modes/ui.hpp @@ -103,6 +103,26 @@ const char *const nav_state_names[vehicle_status_s::NAVIGATION_STATE_MAX] = { "External 8", }; +/** + * @return Human-readable name for a nav_state, taking the vehicle type into account. + * + * The position control mode is shown as "Cruise" for fixed-wing vehicles (including VTOLs in + * forward flight, which report VEHICLE_TYPE_FIXED_WING) and as "Position" for all other types. + */ +static inline const char *nav_state_name(uint8_t nav_state, uint8_t vehicle_type) +{ + if (nav_state >= vehicle_status_s::NAVIGATION_STATE_MAX) { + return "(unknown)"; + } + + if (nav_state == vehicle_status_s::NAVIGATION_STATE_POSCTL + && vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) { + return "Cruise"; + } + + return nav_state_names[nav_state]; +} + /** * @return returns true for advanced modes */