Fix OLED autosleep timing and battery sampling cadence

- Track last OLED activity to avoid double timeout; keep power gating on transitions
- Copy TZ before setenv() in timegm_fallback to avoid invalid pointer reuse
- Add BATTERY_SAMPLE_INTERVAL_MS and only refresh cache at batch start when due
- Keep battery sampling to a single ADC read (Arduino core lacks explicit ADC power gating)
This commit is contained in:
2026-02-02 23:01:55 +01:00
parent 90d830da6f
commit 2199627a35
6 changed files with 29 additions and 33 deletions

View File

@@ -69,6 +69,7 @@ constexpr uint32_t OLED_AUTO_OFF_MS = 10UL * 60UL * 1000UL;
constexpr uint32_t SENDER_OLED_READ_MS = 10000;
constexpr uint32_t METER_SAMPLE_INTERVAL_MS = 1000;
constexpr uint32_t METER_SEND_INTERVAL_MS = 30000;
constexpr uint32_t BATTERY_SAMPLE_INTERVAL_MS = 60000;
constexpr uint32_t BATCH_ACK_TIMEOUT_MS = 3000;
constexpr uint8_t BATCH_MAX_RETRIES = 2;
constexpr uint8_t METER_BATCH_MAX_SAMPLES = 30;