From f15a1fbd627341b772e6ef4eaea468f54116dc07 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 3 Feb 2021 10:48:14 +1100 Subject: [PATCH] AP_Vehicle: move control_mode_reason up to AP_Vehicle --- libraries/AP_Vehicle/AP_Vehicle.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index 47c2abafe4..d91f2899b3 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -76,9 +76,14 @@ public: // HAL::Callbacks implementation. void loop() override final; + // set_mode *must* set control_mode_reason bool virtual set_mode(const uint8_t new_mode, const ModeReason reason) = 0; uint8_t virtual get_mode() const = 0; + ModeReason get_control_mode_reason() const { + return control_mode_reason; + } + /* common parameters for fixed wing aircraft */ @@ -321,6 +326,8 @@ protected: void publish_osd_info(); #endif + ModeReason control_mode_reason = ModeReason::UNKNOWN; + private: // delay() callback that processing MAVLink packets