feat(esc_battery): let boards set an open circuit voltage

ESCs can stay powered without a battery, e.g. when VBAT is back-fed from
USB, and then report a low voltage that is flagged as a low battery.
A board can now set BOARD_ESC_BATTERY_OPEN_CIRCUIT_V so that such a
reading counts as no battery connected. The default of 0V keeps the
current behavior.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: alexcekay <alexander@auterion.com>
This commit is contained in:
alexcekay authored and Alexander Lerach committed 2026-11-25 18:43:29 +01:00
1 parent 29bad58304
commit 14a7e79a23
2 files changed
+7 -1

No files matched your search

@@ -137,6 +137,12 @@
# define BOARD_ADC_OPEN_CIRCUIT_V (1.5f)
#endif
/* Define the default ESC-reported battery voltage at or below which no battery is considered connected */
#if !defined(BOARD_ESC_BATTERY_OPEN_CIRCUIT_V)
# define BOARD_ESC_BATTERY_OPEN_CIRCUIT_V (0.0f)
#endif
/* Define the default Under voltage Window on the LTC4417 as set by resistors on the
* board. Default is that of the FMUv2 at 3.7V
*/
+1 -1
View File
@@ -111,7 +111,7 @@ EscBattery::Run()
average_voltage_v /= online_esc_count;
_battery.setConnected(true);
_battery.setConnected(average_voltage_v > BOARD_ESC_BATTERY_OPEN_CIRCUIT_V);
_battery.updateVoltage(average_voltage_v);
_battery.updateCurrent(total_current_a);
_battery.updateAndPublishBatteryStatus(esc_status.timestamp);