From b1ade6ccf523e9017ac04bc6bf526c1eb06988b0 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 2 Feb 2024 14:26:43 +1100 Subject: [PATCH] AP_HAL: add power status bits to logger metadata --- libraries/AP_HAL/AnalogIn.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/AP_HAL/AnalogIn.h b/libraries/AP_HAL/AnalogIn.h index 2a8f72207a..c07799acc4 100644 --- a/libraries/AP_HAL/AnalogIn.h +++ b/libraries/AP_HAL/AnalogIn.h @@ -42,6 +42,16 @@ public: // failures can still be diagnosed virtual uint16_t accumulated_power_status_flags(void) const { return 0; } + // this enum class is 1:1 with MAVLink's MAV_POWER_STATUS enumeration! + enum class PowerStatusFlag : uint16_t { + BRICK_VALID = 1, // main brick power supply valid + SERVO_VALID = 2, // main servo power supply valid for FMU + USB_CONNECTED = 4, // USB power is connected + PERIPH_OVERCURRENT = 8, // peripheral supply is in over-current state + PERIPH_HIPOWER_OVERCURRENT = 16, // hi-power peripheral supply is in over-current state + CHANGED = 32, // Power status has changed since boot + }; + #if HAL_WITH_MCU_MONITORING virtual float mcu_temperature(void) { return 0; } virtual float mcu_voltage(void) { return 0; }