diff --git a/libraries/AP_HAL_ChibiOS/AnalogIn.cpp b/libraries/AP_HAL_ChibiOS/AnalogIn.cpp index d1096b643e..c657265c3f 100644 --- a/libraries/AP_HAL_ChibiOS/AnalogIn.cpp +++ b/libraries/AP_HAL_ChibiOS/AnalogIn.cpp @@ -473,6 +473,7 @@ void AnalogIn::update_power_flags(void) // the power status has changed while armed flags |= MAV_POWER_STATUS_CHANGED; } + _accumulated_power_flags |= flags; _power_flags = flags; } #endif // HAL_USE_ADC diff --git a/libraries/AP_HAL_ChibiOS/AnalogIn.h b/libraries/AP_HAL_ChibiOS/AnalogIn.h index dbfd570095..437f8bdeee 100644 --- a/libraries/AP_HAL_ChibiOS/AnalogIn.h +++ b/libraries/AP_HAL_ChibiOS/AnalogIn.h @@ -61,6 +61,7 @@ public: float board_voltage(void) override { return _board_voltage; } float servorail_voltage(void) override { return _servorail_voltage; } uint16_t power_status_flags(void) override { return _power_flags; } + uint16_t accumulated_power_status_flags(void) const override { return _accumulated_power_flags; } static void adccallback(ADCDriver *adcp); private: @@ -74,6 +75,8 @@ private: float _servorail_voltage; float _rssi_voltage; uint16_t _power_flags; + uint16_t _accumulated_power_flags; // bitmask of all _power_flags ever set + ADCConversionGroup adcgrpcfg; struct pin_info {