forked from Archive/PX4-Autopilot
flightmodes: flag advanced modes accordingly
This commit is contained in:
parent
c0b9ecdc82
commit
c7e11f1774
|
@ -99,4 +99,35 @@ const char *const nav_state_names[vehicle_status_s::NAVIGATION_STATE_MAX] = {
|
|||
"External 8",
|
||||
};
|
||||
|
||||
/**
|
||||
* @return returns true for advanced modes
|
||||
*/
|
||||
static inline bool isAdvanced(uint8_t nav_state)
|
||||
{
|
||||
switch (nav_state) {
|
||||
case vehicle_status_s::NAVIGATION_STATE_ALTCTL: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_POSCTL: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL1: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL2: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL3: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL4: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL5: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL6: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL7: return false;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_EXTERNAL8: return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mode_util
|
||||
|
|
|
@ -88,6 +88,10 @@ private:
|
|||
// Set the mode name if not a standard mode
|
||||
available_modes.standard_mode = (uint8_t)mode_util::getStandardModeFromNavState(nav_state);
|
||||
|
||||
if (mode_util::isAdvanced(nav_state)) {
|
||||
available_modes.properties |= MAV_MODE_PROPERTY_ADVANCED;
|
||||
}
|
||||
|
||||
if (available_modes.standard_mode == MAV_STANDARD_MODE_NON_STANDARD) {
|
||||
static_assert(sizeof(available_modes.mode_name) >= sizeof(ExternalModeName::name), "mode name too short");
|
||||
|
||||
|
|
Loading…
Reference in New Issue