diff --git a/src/drivers/osd/msp_osd/uorb_to_msp.cpp b/src/drivers/osd/msp_osd/uorb_to_msp.cpp index b66661c114e2..7be449157d9b 100644 --- a/src/drivers/osd/msp_osd/uorb_to_msp.cpp +++ b/src/drivers/osd/msp_osd/uorb_to_msp.cpp @@ -40,6 +40,7 @@ #include #include #include +#include // clock access #include @@ -77,82 +78,7 @@ msp_name_t construct_display_message(const vehicle_status_s &vehicle_status, } // display flight mode - switch (vehicle_status.nav_state) { - case vehicle_status_s::NAVIGATION_STATE_MANUAL: - display.set(MessageDisplayType::FLIGHT_MODE, "MANUAL"); - break; - - case vehicle_status_s::NAVIGATION_STATE_ALTCTL: - display.set(MessageDisplayType::FLIGHT_MODE, "ALTCTL"); - break; - - case vehicle_status_s::NAVIGATION_STATE_POSCTL: - display.set(MessageDisplayType::FLIGHT_MODE, "POSCTL"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_MISSION"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_LOITER"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_RTL: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_RTL"); - break; - - case vehicle_status_s::NAVIGATION_STATE_ACRO: - display.set(MessageDisplayType::FLIGHT_MODE, "ACRO"); - break; - - case vehicle_status_s::NAVIGATION_STATE_DESCEND: - display.set(MessageDisplayType::FLIGHT_MODE, "DESCEND"); - break; - - case vehicle_status_s::NAVIGATION_STATE_TERMINATION: - display.set(MessageDisplayType::FLIGHT_MODE, "TERMINATION"); - break; - - case vehicle_status_s::NAVIGATION_STATE_OFFBOARD: - display.set(MessageDisplayType::FLIGHT_MODE, "OFFBOARD"); - break; - - case vehicle_status_s::NAVIGATION_STATE_STAB: - display.set(MessageDisplayType::FLIGHT_MODE, "STAB"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_TAKEOFF"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_LAND: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_LAND"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_FOLLOW_TARGET: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_FOLLOW_TARGET"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_PRECLAND: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_PRECLAND"); - break; - - case vehicle_status_s::NAVIGATION_STATE_ORBIT: - display.set(MessageDisplayType::FLIGHT_MODE, "ORBIT"); - break; - - case vehicle_status_s::NAVIGATION_STATE_AUTO_VTOL_TAKEOFF: - display.set(MessageDisplayType::FLIGHT_MODE, "AUTO_VTOL_TAKEOFF"); - break; - - case vehicle_status_s::NAVIGATION_STATE_MAX: - display.set(MessageDisplayType::FLIGHT_MODE, "MAX"); - break; - - default: - display.set(MessageDisplayType::FLIGHT_MODE, "???"); - } + display.set(MessageDisplayType::FLIGHT_MODE, mode_util::nav_state_names[vehicle_status.nav_state]); } // display, if updated