feat(wio-tracker-l1): energy optimizations

- CPU sleep: board.sleep(0) in main loop puts NRF52 into WFE/sd_app_evt_wait
  between iterations; wakes on any interrupt (radio, BLE, timer). Largest
  power saving of the three changes.

- VBAT_ENABLE gating: voltage divider now powered only during ADC read
  (HIGH for 10ms, then LOW). Previously stayed HIGH continuously.
  Fixed in both variant.cpp (init) and WioTrackerL1Board::getBattMilliVolts().

- LED off with display: PIN_LED is cleared when auto-off triggers and
  restored (handed back to userLedHandler) when display wakes. Avoids
  idle LED current draw during screen-off periods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-13 21:09:46 +02:00
co-authored by Claude Sonnet 4.6
parent e445c0a325
commit 4d46abb2c1
5 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -22,11 +22,12 @@ public:
#endif
uint16_t getBattMilliVolts() override {
int adcvalue = 0;
digitalWrite(VBAT_ENABLE, HIGH);
analogReadResolution(12);
analogReference(AR_INTERNAL);
delay(10);
adcvalue = analogRead(PIN_VBAT_READ);
delay(10); // allow voltage divider to stabilize
int adcvalue = analogRead(PIN_VBAT_READ);
digitalWrite(VBAT_ENABLE, LOW);
return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096;
}