The per-read VBAT_ENABLE gating from 4d46abb2 (energy optimizations)
powered the battery voltage divider HIGH for only 10ms before each ADC
read, then LOW. 10ms is too short for the high-impedance divider node
to settle before the nRF52 SAADC samples it, so readings came out high
and inconsistent (e.g. 4.6-5.0V on a LiPo that maxes ~4.2V).
Hold VBAT_ENABLE HIGH continuously again (as before 4d46abb2) so the
node is always settled at sample time, and drop the toggle + delay(10)
from getBattMilliVolts(). Standby cost is ~2uA on the 2x1M divider,
negligible next to the device's mA-level draw.
The CPU-sleep and LED-off energy optimizations from 4d46abb2 are left
untouched — those are the real savings; only the VBAT gating is reverted.
- 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>
The startOTAUpdate() is the same for all NRF52 boards. Use a common
implementation for all boards that currently have a specific
implementation.
The following boards currently have an empty startOTAUpdate() for
whatever reasons and therefore are not inheriting NRF52BoardOTA to
keep the same state: Nano G2 Ultra, Seeed SenseCAP T1000-E,
Wio WM1110.
Signed-off-by: Frieder Schrempf <frieder@fris.de>
Some NRF52 boards are able to use the internal power-efficient DC/DC
regulator. Add a new class that can be inherited by board classes to
enable this feature and reduce the power consumption.
Signed-off-by: Frieder Schrempf <frieder@fris.de>
Use a common begin() method that can be called from derived classes
to contain the shared initialization code.
Signed-off-by: Frieder Schrempf <frieder@fris.de>