Skip to content

fix(power): use BQ25896 ADC for both battery voltage and presence#10442

Draft
DatanoiseTV wants to merge 1 commit into
meshtastic:developfrom
DatanoiseTV:fix/power-bms-voltage-source
Draft

fix(power): use BQ25896 ADC for both battery voltage and presence#10442
DatanoiseTV wants to merge 1 commit into
meshtastic:developfrom
DatanoiseTV:fix/power-bms-voltage-source

Conversation

@DatanoiseTV
Copy link
Copy Markdown
Contributor

getBattVoltage on the BQ27220+BQ25896 combo returned the fuel-gauge
reading while isBatteryConnect derived presence from the BQ25896
charger ADC. The two could disagree on a freshly-attached cell before
the fuel gauge had learned: hasBattery would say false but voltage
4.0V, and the upstream PowerFSM would treat the unit as externally
powered. Read voltage from the same source as presence so both views
move together.

Split out from #10425 — single-concern PR.

Build verification

pio run -e t-deck-tft succeeds, no new warnings.

Attestations

  • I have tested that my proposed changes behave as described — review/static-analysis only, not on-air.
  • On-hardware testing requested from community: build-verified t-deck-tft only.

getBattVoltage on the BQ27220+BQ25896 combo returned the fuel-gauge
reading while isBatteryConnect derived presence from the BQ25896
charger ADC. The two could disagree on a freshly-attached cell before
the fuel gauge had learned: hasBattery would say false but voltage
4.0V, and the upstream PowerFSM would treat the unit as externally
powered. Read voltage from the same source as presence so both views
move together.
@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels May 9, 2026
@mverch67
Copy link
Copy Markdown
Collaborator

mverch67 commented May 9, 2026

@DatanoiseTV you wrote:

image

The T-Deck does not have a BQ27220/BQ25896 charger/gauge, it uses GPIO ADC battery pin 4.

Please use T-Lora Pager or T-Deck Pro for tests with BQ27220/BQ25896.

Also, the BQ27220 has a more accurate voltage reporting as it implements the calibrated charging curve and automatically learns the charge capacity from previous full battery cycles.

@mverch67 mverch67 marked this pull request as draft May 9, 2026 08:07
@NomDeTom
Copy link
Copy Markdown
Collaborator

Be very careful - the bq25896 is currently linked to another bq module for "fuel gauging" and also shares an i2c address with some other common sensors.

@mverch67
Copy link
Copy Markdown
Collaborator

yeah, T-Deck I2C keyboard and BQ27220 also have the same I2C address 0x55. Maybe that's where the confusion came from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants