Add runtime UV protection toggle and treat near-zero sense as external power.

Per-pod NVS enable (default off) via UART/ESP-NOW/dashboard, and skip UV latch when LiPo ADC reads ~0 mV so USB/external supply still boots.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-01 22:51:17 +01:00
co-authored by Cursor
parent c3b20887bf
commit 7f28a48a10
33 changed files with 1411 additions and 240 deletions
+26
View File
@@ -47,6 +47,11 @@ enum MessageType {
* (best_effort / fast / wait / reliable).
*/
INPUT_SEND_MODE = 35;
/**
* Host → master: get/set software LiPo UV protection enable (NVS per pod).
* client_id 0 = master; >0 = one slave; all_clients = master + every slave.
*/
BATTERY_UV = 36;
}
message UartMessage {
@@ -92,6 +97,8 @@ message UartMessage {
ClientIdMapResetResponse client_id_map_reset_response = 43;
InputSendModeRequest input_send_mode_request = 44;
InputSendModeResponse input_send_mode_response = 45;
BatteryUvRequest battery_uv_request = 46;
BatteryUvResponse battery_uv_response = 47;
}
}
@@ -122,6 +129,8 @@ message ClientInfo {
bool tap_notify_single = 9;
bool tap_notify_double = 10;
bool tap_notify_triple = 11;
/** Master cache: software UV protection enabled on this slave (NVS on device). */
bool uv_protection_enabled = 12;
}
message ClientInfoResponse {
@@ -202,6 +211,23 @@ message InputSendModeResponse {
uint32 slaves_updated = 4;
}
// write=false: read UV enable; write=true: persist enable (and clear latch when disabling).
// client_id 0 = local master; >0 = one slave; all_clients = master + every registered slave.
message BatteryUvRequest {
bool write = 1;
bool enabled = 2;
uint32 client_id = 3;
bool all_clients = 4;
}
message BatteryUvResponse {
uint32 client_id = 1;
bool success = 2;
bool enabled = 3;
bool latched = 4;
uint32 slaves_updated = 5;
}
/** Host → master: read LiPo ADC voltages (master local and/or slaves via ESP-NOW). */
message BatteryStatusRequest {
/** 0 = master only; >0 = one slave; ignored when all_clients */