Skip to content

Battery: charge only while a pack is in the bay (no 100% / 0% flicker or speaker pops with the bay empty) - #45

Merged
finger563 merged 4 commits into
mainfrom
fix/charge-only-with-pack
Nov 29, 2026
Merged

finger563 merged 4 commits into
mainfrom
fix/charge-only-with-pack

Conversation

@finger563

@finger563 finger563 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With the battery bay empty, the Tab5 charged nothing at all. The IP2326 kept retrying and caused two visible problems:

  • The status bar flipped between 100% and 0%. The charger's output pulsed between 8.4 V, read as a full pack, and about 4.4 V, every ~16 s.
  • The speaker popped on each retry. The BSP's BatteryStatus::is_present already says to leave charging off without a pack.

Now the Tab5 charges only while a pack is in the bay:

  • At boot: initialize_battery() enables charging only if the first reading sees a pack.
  • After that: the battery task follows the bay. It turns charging on when a pack appears and off when it goes, and logs battery: charging on (a pack is in the bay) / off (the bay is empty).

With the charger off, an empty bay reads a steady ~1.9 V, so it stays empty. A pack inserted later reads its own voltage, so it's seen at once and starts charging.

Dependencies (espp 1.4.9, all from the component registry)

Testing (Tab5, empty bay, USB-C power)

  • This change on 1.4.5:
    • charging stayed off from boot;
    • 65 readings over two minutes were 1.84–1.96 V, all "no pack".
  • With espp#931 (override_path), charging forced on for 90 s after boot by a test hook:
    • the charger pulsed between 8.39–8.40 V and 4.39–5.26 V, and the bay read as empty throughout (44 readings);
    • after the 90 s the task turned charging off ("the bay is empty") and the bay read a steady 1.9 V.
  • Not run on this build: inserting and pulling a pack, since the pack was out.
  • On espp 1.4.9 (every espp component from the registry, fa9bdd0's dependencies):
    • builds clean; flashed to the Tab5 over USB (emulink ota);
    • boots to the launcher (software reset, no panic), and the USB link (CDC + vendor) is up;
    • the settings were kept;
    • touch with the same driver changes, run as overrides before the release, worked in the launcher, menus and games.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

finger563 and others added 4 commits November 28, 2026 10:53
… or speaker pops with the bay empty)

With the bay empty, initialize_battery() still enabled charging. The IP2326
then keeps retrying to charge nothing: its output pulsed between 8.4 V (read
as a full pack) and ~4.4 V, every ~16 s, so the launcher's status bar flipped
between 100% and 0%, and each retry pops on the speaker (the BSP's
BatteryStatus::is_present says to leave charging off without a pack).

initialize_battery() now enables charging only if the first reading sees a
pack, and the battery task follows the bay: charging on when a pack appears,
off when it goes (logged). With the charger off an empty bay reads a steady
~1.9 V, so it reads as empty from then on.

Pulling a pack while it charges is caught once the BSP stops reading the
charger's 8.4 V pulses as a pack (esp-cpp/espp#931); with espp/m5stack-tab5
1.4.5 a 4.4 V pulse still passes its 4 V test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
…red ST7123 touch interrupt (espp#933)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
usb_device was pinned to espp's 08295c0 for take_msc_from_ejected_host()
(esp-cpp/espp#898), released in 1.4.3. 1.4.7 also checks the endpoints
against the port's USB-OTG core (#925). hid-rp 1.4.7 brings the latest
gamepad decoding (#918) and the rumble report fixes (#921, #927).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
@finger563
finger563 merged commit 528b129 into main Nov 29, 2026
1 check passed
@finger563
finger563 deleted the fix/charge-only-with-pack branch November 29, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant