diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index 24644c4726..f07e6382f8 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -355,6 +355,12 @@ void AP_Vehicle::update_dynamic_notch_at_specified_rate() } } +void AP_Vehicle::notify_no_such_mode(uint8_t mode_number) +{ + GCS_SEND_TEXT(MAV_SEVERITY_WARNING,"No such mode %u", mode_number); + AP::logger().Write_Error(LogErrorSubsystem::FLIGHT_MODE, LogErrorCode(mode_number)); +} + // reboot the vehicle in an orderly manner, doing various cleanups and // flashing LEDs as appropriate void AP_Vehicle::reboot(bool hold_in_bootloader) diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index 155d035666..d6e609cec3 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -85,6 +85,12 @@ public: return control_mode_reason; } + // perform any notifications required to indicate a mode change + // failed due to a bad mode number being supplied. This can + // happen for many reasons - bad mavlink packet and bad mode + // parameters for example. + void notify_no_such_mode(uint8_t mode_number); + /* common parameters for fixed wing aircraft */