From 3e6d8357e93db3b679f5ba4196c4c5b555d35be0 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Fri, 4 Jun 2021 18:39:46 +0100 Subject: [PATCH] AP_BattMonitor: zero consumption total before recalculating add reset function to ESC backend. --- libraries/AP_BattMonitor/AP_BattMonitor_ESC.cpp | 14 ++++++++++++++ libraries/AP_BattMonitor/AP_BattMonitor_ESC.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/libraries/AP_BattMonitor/AP_BattMonitor_ESC.cpp b/libraries/AP_BattMonitor/AP_BattMonitor_ESC.cpp index 25c70ad3b3..713561ecb9 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor_ESC.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor_ESC.cpp @@ -35,6 +35,7 @@ void AP_BattMonitor_ESC::read(void) float current_sum = 0; float temperature_sum = 0; uint32_t highest_ms = 0; + _state.consumed_mah = delta_mah; for (uint8_t i=0; i