From b5d0480bede50ad39eab6449b0c67f2c096d0639 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 20 Jul 2020 10:34:42 +1000 Subject: [PATCH] AP_HAL_ChibiOS: log accumulated power status flags; all flags ever set --- libraries/AP_HAL_ChibiOS/AnalogIn.cpp | 1 + libraries/AP_HAL_ChibiOS/AnalogIn.h | 3 +++ 2 files changed, 4 insertions(+) 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 {