diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index 24644c4726dbc..f07e6382f8f7b 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 155d0356664d9..d6e609cec33a1 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -85,6 +85,12 @@ class AP_Vehicle : public AP_HAL::HAL::Callbacks { 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 */