Add LiPo battery monitoring with ESP-NOW cache and dashboard API.
Slaves report pack voltages every 30s; the master caches them for fast BATTERY_STATUS reads. goTool exposes REST/WebSocket and shows values in the dashboard, with a nanopb fix so optional lipo submessages encode. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,8 @@ enum EspNowMessageType {
|
||||
ESPNOW_ACCEL_SAMPLE = 12;
|
||||
ESPNOW_SET_ACCEL_STREAM = 13;
|
||||
ESPNOW_LED_RING = 14;
|
||||
ESPNOW_BATTERY_QUERY = 15;
|
||||
ESPNOW_BATTERY_REPORT = 16;
|
||||
}
|
||||
|
||||
message EspNowUnicastTest {
|
||||
@@ -69,6 +71,20 @@ message EspNowAccelSample {
|
||||
sint32 z = 4;
|
||||
}
|
||||
|
||||
/** Master → slave: on-demand LiPo read (optional; slaves also push every ~30 s). */
|
||||
message EspNowBatteryQuery {
|
||||
uint32 client_id = 1;
|
||||
}
|
||||
|
||||
/** Slave → master: LiPo voltages (periodic ~30 s and on query). */
|
||||
message EspNowBatteryReport {
|
||||
uint32 client_id = 1;
|
||||
bool lipo1_valid = 2;
|
||||
bool lipo2_valid = 3;
|
||||
uint32 lipo1_mv = 4;
|
||||
uint32 lipo2_mv = 5;
|
||||
}
|
||||
|
||||
/** Master → slave: LED ring command (same modes as UART LedRingProgressRequest). */
|
||||
message EspNowLedRing {
|
||||
uint32 client_id = 1;
|
||||
@@ -121,5 +137,7 @@ message EspNowMessage {
|
||||
EspNowAccelSample accel_sample = 13;
|
||||
EspNowAccelStream accel_stream = 14;
|
||||
EspNowLedRing led_ring = 15;
|
||||
EspNowBatteryQuery battery_query = 16;
|
||||
EspNowBatteryReport battery_report = 17;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user