Add software LiPo UV protection with energy-save boot.

Detect under-voltage on GPIO1/11, persist UV state in NVS, enter a minimal
power mode without ESP-NOW, and recover after charge; expose LED mode 6
battery-low for host testing via goTool.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-23 18:22:52 +02:00
co-authored by Cursor
parent be18b758ed
commit f006f8b912
26 changed files with 418 additions and 37 deletions
+13 -1
View File
@@ -31,6 +31,7 @@
#include "led_ring.h"
#include "pod_settings.h"
#include "uart.h"
#include "battery_uv.h"
#include <stdint.h>
enum MASTER_STATES {
@@ -78,6 +79,16 @@ void app_main(void) {
ESP_LOGW(TAG, "settings NVS init failed; using defaults");
}
if (board_input_init_adc_only() != ESP_OK) {
ESP_LOGW(TAG, "LiPo ADC init failed");
}
#if POWERPOD_BATTERY_UV_ENABLE
if (battery_uv_evaluate_boot()) {
battery_uv_run_mode();
}
#endif
// Get Master Mode Pin
gpio_reset_pin(DIP_MASTER);
gpio_set_direction(DIP_MASTER, GPIO_MODE_INPUT);
@@ -167,7 +178,8 @@ void app_main(void) {
ESP_LOGI(TAG, "Running Partition: %s (OTA slot %d)",
app_config.running_partition, ota_slot);
board_input_init();
board_input_start_lipo_monitor();
board_input_init_button();
err = esp_now_comm_init(&app_config);
if (err != ESP_OK) {