mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 02:36:11 +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:
@@ -9,7 +9,9 @@ void WioTrackerL1Board::begin() {
|
||||
|
||||
pinMode(PIN_VBAT_READ, INPUT); // VBAT ADC input
|
||||
pinMode(VBAT_ENABLE, OUTPUT);
|
||||
digitalWrite(VBAT_ENABLE, LOW); // keep voltage divider off; enabled only during ADC read
|
||||
digitalWrite(VBAT_ENABLE, HIGH); // voltage divider always on: gating it per-read left
|
||||
// the divider node unsettled at sample time (10ms was
|
||||
// too short), reading high & jittery. ~2uA standby cost.
|
||||
// Set all button pins to INPUT_PULLUP
|
||||
pinMode(PIN_BUTTON1, INPUT_PULLUP);
|
||||
pinMode(PIN_BUTTON2, INPUT_PULLUP);
|
||||
|
||||
Reference in New Issue
Block a user