mirror of
https://github.com/ALLFATHER-BV/wadamesh.git
synced 2026-09-26 22:28:00 +00:00
Mine, from the fuel-gauge change earlier today. bq27220ReadU16() returned 0 on an I2C failure, which is indistinguishable from a real reading of zero. The voltage reader had always defended against that by range-checking (2500-4600 mV) and keeping the last good value, but the new state-of-charge reader accepted anything <= 100 — so every lost transaction was taken as a genuine 0%, and the display alternated between 0 and the real figure as reads succeeded and failed. The gauge shares this I2C bus with the XL9535 expander, the RTC and the touch controller, so an occasional lost transaction is normal rather than exceptional. Encoding that as a valid measurement was the mistake. The transport now returns false when the gauge does not answer, and both readers keep their previous good value on a failure. Once the gauge has answered once, the percentage never falls back to the voltage curve either, so the number cannot jump between two different scales. Reported by Kaj on hardware. P4 builds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>