fix(Power): survive a BQ27220 fuel gauge that fails to init (#11401)

* fix(Power): survive a BQ27220 fuel gauge that fails to init

Keep the BQ25896 as the battery source when only the gauge fails, so Power
stays enabled instead of falling through to an ADC that these variants do not
have. Null-guard the gauge in getBattVoltage() and isCharging().

Retry the gauge from the power thread (3 attempts, 60s apart, address probe
first) since it is soldered on, and reset the I2C master after a failed init
so the bus scan does not run against a stale transaction.

Fixes #11372

* fix(Power): address review feedback on the BQ27220 retry

Derive "no attempt yet" from gaugeAttemptsLeft instead of a millis() zero
sentinel, drop the zero-padding on the logged I2C address, and condense the
new comment blocks.
This commit is contained in:
Thomas Göttgens
2026-08-11 07:00:01 +00:00
committed by GitHub
parent b8dee13d0b
commit bcf486fa8b
2 changed files with 76 additions and 22 deletions
+2
View File
@@ -121,6 +121,8 @@ class Power : public concurrency::OSThread
bool max17048Init();
/// Setup a Lipo charger
bool lipoChargerInit();
/// Retry a fuel gauge that did not come up during setup
void lipoChargerRetry();
/// Setup a meshSolar battery sensor
bool meshSolarInit();
/// Setup a serial battery sensor