mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(wio-tracker-l1): battery voltage reads high/jittery — divider always on
The per-read VBAT_ENABLE gating from4d46abb2(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 before4d46abb2) 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 from4d46abb2are left untouched — those are the real savings; only the VBAT gating is reverted.
This commit is contained in:
@@ -67,9 +67,11 @@ void initVariant() {
|
||||
pinMode(PIN_QSPI_CS, OUTPUT);
|
||||
digitalWrite(PIN_QSPI_CS, HIGH);
|
||||
|
||||
// VBAT_ENABLE: keep LOW by default, WioTrackerL1Board::getBattMilliVolts() toggles it
|
||||
// VBAT_ENABLE: hold HIGH so the battery voltage divider is always on and its
|
||||
// node stays settled for the ADC read (getBattMilliVolts). Per-read gating
|
||||
// left it unsettled at sample time -> high/jittery readings.
|
||||
pinMode(VBAT_ENABLE, OUTPUT);
|
||||
digitalWrite(VBAT_ENABLE, LOW);
|
||||
digitalWrite(VBAT_ENABLE, HIGH);
|
||||
|
||||
// set LED pin as output and set it low
|
||||
pinMode(PIN_LED, OUTPUT);
|
||||
|
||||
Reference in New Issue
Block a user