Skip to content

Bump ArduinoLibs and HMTL: MPR121 anti-wedge fix, packed TIMESYNC - #37

Merged
aphelps-claude-bot merged 1 commit into
mainfrom
bump-mpr121-antiwedge
Aug 22, 2026
Merged

aphelps-claude-bot merged 1 commit into
mainfrom
bump-mpr121-antiwedge

Conversation

@aphelps-claude-bot

Copy link
Copy Markdown
Collaborator

Two gitlinks, no source changes:

submodule from to
ArduinoLibs 9194ddf 002f6d7
HMTL ab149d6 c65f1a3

Why this exists

#36 did not deliver the fix Adam approved at the bench. It moved ArduinoLibs only as far as 9194ddf (the PixelUtil bounds fix). ArduinoLibs#15 — "MPR121: report read health, and stop a failed read from wedging the driver", which he approved 2026-08-21 — is three commits further on, so it is still not in the firmware this repo builds.

The bug it carries in

MPR121 is on the ampworks build path (WLED/platformio.ini:535, -D USERMOD_MPR121), so this is not confined to host tests.

readTouchInputs() clears triggered, then early-returns when Wire.available() < 2. The chip holds its IRQ line asserted until a successful status read — so with an edge-triggered IRQ no further edge is ever delivered, the driver wedges permanently, and touchStates keeps its last good value forever. 002f6d7 restores the flag on that path and adds readOk() so a consumer can distinguish "no edge" from "data untrustworthy".

Its choice to restore the flag rather than move the clear below the read is the right one: clearing before the transaction preserves an edge arriving mid-read, including a release edge — the event whose loss would leave a poof stuck on.

Scope, stated so it is not over-read: the wedge is only reachable when an IRQ pin is configured. usermod_mpr121.h:123 defaults irqPin to -1 (polling), and in polling mode line 48 re-arms triggered every loop, so a default-configured device cannot wedge. Devices with irqPin set in their JSON config can.

Also in the range

  • a62c389 — RS485SocketTool ESP32 testing guide (docs only).
  • 3b6f393 — drops noInterrupts()/interrupts() from both ESP32 IRAM_ATTR ISRs and makes triggered volatile. Those macros are task-context and not IRAM-safe; the ISR body is a null check plus a single bool store, so the critical section protected nothing and volatile is the correct fix for the cross-context handoff.
  • HMTL ab149d6 -> c65f1a3 is Touch Pond effect: MPR121 capacitive touch with audio reactivity #14, the serial connect path against a non-resetting ESP32.

Verification

Run against this exact tree, not the parts separately:

  • make test STRICT=1 — exit 0
  • rs485_bridge host tests — ALL PASSED, under both host and -fpack-struct=1 AVR layout
  • pio run -e ampworks — SUCCESS (flash 83.7%, RAM 25.5%)

Needs a human review — this description is bot review input, not an approval.

🤖 Generated with Claude Code

https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

…SYNC

  ArduinoLibs 9194ddf -> 002f6d7
  HMTL        ab149d6 -> c65f1a3

WLED_dev#36 moved ArduinoLibs only as far as 9194ddf (the PixelUtil bounds
fix). The change Adam actually approved at the bench -- ArduinoLibs#15,
"MPR121: report read health, and stop a failed read from wedging the
driver" -- is three commits further on, so it is still not in the firmware
this repo builds. This bump delivers it.

Why it matters, since MPR121 is on the ampworks build path
(WLED/platformio.ini:535, -D USERMOD_MPR121):

readTouchInputs() clears `triggered`, then early-returns when
`Wire.available() < 2`. The chip holds its IRQ line asserted until a
successful status read, so with an edge-triggered IRQ no further edge is
delivered -- the driver wedges permanently and touchStates keeps its last
good value forever. 002f6d7 restores the flag on that path and adds
readOk() so a consumer can tell "no edge" from "data untrustworthy".

Scope note: the wedge is only reachable when an IRQ pin is configured.
usermod_mpr121.h:123 defaults irqPin to -1 (polling), and in polling mode
line 48 re-arms `triggered` every loop, so a default-configured device
cannot wedge. Devices with irqPin set in their JSON config can.

Also in the ArduinoLibs range: a62c389 (RS485SocketTool testing guide,
docs) and 3b6f393, which drops noInterrupts()/interrupts() from both ESP32
IRAM ISRs and makes `triggered` volatile. Those macros are task-context and
not IRAM-safe; the ISR body is a null check plus a single bool store, so
the critical section protected nothing and volatile is the correct fix.

HMTL ab149d6 -> c65f1a3 is #14, the serial connect path against a
non-resetting ESP32.

Verified on this exact tree, not on the parts separately:
  - make test STRICT=1 -> exit 0
  - rs485_bridge host tests -> ALL PASSED, host and -fpack-struct=1 AVR layout
  - pio run -e ampworks -> SUCCESS (flash 83.7%, RAM 25.5%)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ
@aphelps-claude-bot
aphelps-claude-bot merged commit c0ff0f2 into main Aug 22, 2026
1 check passed
@aphelps-claude-bot
aphelps-claude-bot deleted the bump-mpr121-antiwedge branch August 22, 2026 07:48
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.

2 participants