Skip to content

Touch Pond effect: MPR121 capacitive touch with audio reactivity - #14

Merged
aphelps merged 7 commits into
mainfrom
touch-ripple
Jun 14, 2026
Merged

aphelps merged 7 commits into
mainfrom
touch-ripple

Conversation

@aphelps-claude-bot

Copy link
Copy Markdown
Collaborator

Summary

  • New Touch Pond WLED effect: touching MPR121 electrodes spawns expanding wave rings on a 23-pixel APA102 strip
  • Idle ghost replay: records last 16 touch events and replays them as dim ghost waves after ~3s inactivity
  • Audio reactivity via c3 slider: AGC-normalized waves with brightness scaling by amplitude; piecewise curve maps slider midpoint (128) to the sweet spot
  • Wave brightness hierarchy: real touch=255, audio=80–220 (amplitude-scaled), ghost replay=~80

Submodule PRs

WLED: aphelps/WLED#2

aphelps and others added 7 commits April 27, 2026 01:13
Update WLED submodule pointer to touch-ripple branch.
Touch Pond spawns expanding comet waves from electrode anchors,
with distinct palette hues per electrode and pulsing hold feedback.

Note: I2C must be configured in WLED UI (SDA=19, SCL=22) or via:
  curl -X POST /json/cfg -d '{"hw":{"if":{"i2c-pin":[19,22]}}}'
Build-time I2CSDAPIN/I2CSCLPIN defaults are overridden by cfg.json.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Maps slider midpoint (c3=128) to the working sweet spot. Previous sqrt
curve had the sweet spot around c3=50; piecewise curve shifts it to 128.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@aphelps
aphelps merged commit 319c1f5 into main Jun 14, 2026
aphelps-claude-bot added a commit that referenced this pull request Jul 30, 2026
ArduinoLibs d047ce2 (#9) -- pack rs485/xbee/rfm69 socket headers + assertion sweep
WLED 3c11ec16 (#14)     -- RS485B_SOCKET_HDR_LEN 8 -> 7, host-test coverage, readme

Both squash-merged, so this replaces the branch-tip pointers this PR opened with.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ
aphelps-claude-bot added a commit that referenced this pull request Jul 30, 2026
…rget) (#24)

* bump ArduinoLibs + WLED: pack the RS485 socket header (7B on every target)

Both pointers move in ONE commit deliberately. rs485_socket_hdr_t goes from an
unpacked struct (7 bytes on AVR, 8 on ESP32) to a packed 7 everywhere, and
RS485B_SOCKET_HDR_LEN follows it from 8 to 7. Any intermediate state with one side
advanced fails `pio run -e ampworks` at the static_assert in
usermod_rs485_bridge.cpp:19 -- which is the build the hardware bring-up depends on.

What this unblocks: until now the rs485_bridge usermod could not exchange a single
frame with a real HMTL module. sizeof(rs485_socket_hdr_t) positions the payload at
both ends, so the ESP32 emitted [7 header][1 pad][payload] while an ATMega328 read
the payload from offset 7, and vice versa -- every frame misparsed by one byte, in
both directions. The bench session for the bridge was blocked on this and nothing
else.

  aphelps/ArduinoLibs#9 -- pack rs485/xbee/rfm69 socket headers + static_assert sweep
  aphelps/WLED#14       -- RS485B_SOCKET_HDR_LEN 8 -> 7, host-test coverage, readme

Submodule PRs merge first; this pointer pair is re-pointed at the merged shas before
this PR lands.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

* bump submodules: self-review fixes on the socket-header stack

ArduinoLibs f4afaab -- README scopes the packing guarantee and names TCPSocket as
not covered.
WLED 40d4ecdf -- the new host-test assert was tautological (7 == 7, green even with
the packing attribute removed); replaced with a packed replica plus offsetof checks
that actually fail, and the three comments that overclaimed cross-ABI coverage now
say what the check can and cannot see. Also documents a pre-existing sizing bug the
review surfaced: a full 64-byte TX slot goes on the wire as 71 bytes and overflows a
default 64-byte receive buffer, so the real payload ceiling is 57. Filed separately
rather than fixed here.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

* re-point submodules at the merged socket-header packing commits

ArduinoLibs d047ce2 (#9) -- pack rs485/xbee/rfm69 socket headers + assertion sweep
WLED 3c11ec16 (#14)     -- RS485B_SOCKET_HDR_LEN 8 -> 7, host-test coverage, readme

Both squash-merged, so this replaces the branch-tip pointers this PR opened with.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

---------

Co-authored-by: aphelps-claude-bot <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
aphelps-claude-bot added a commit that referenced this pull request Jul 30, 2026
…rged main

The WLED gitlink was the only conflict. This branch pointed at c88a3c46, the tip of
the attach-protocol PR branch; that PR was squash-merged as 586c6136, and meanwhile
four RS485 pointer bumps landed on WLED_dev main. Resolved to 586c6136, which contains
BOTH workstreams -- socket-header packing (#14), the receive-path fixes (#15) and the
attach-protocol wire format (#13).

esp-now-router keeps this branch's 08bd6e2: main still records the initial commit, and
08bd6e2 is strictly newer (it also contains cfa6554, which is what the superseded #22
was advancing to).

Also fixes CLAUDE.md's submodule table, which still said custom work branches from
base-wled-16.0.1 -- that branch was renamed to main today and no longer exists, so the
instruction pointed at nothing.

Verified at the resolved pointers:
  * make test -- all suites green, and the esp-now-router tests now actually RUN.
    They were reporting "skipped: no tests/ at the pinned revision" because main
    records the router's initial commit; at 08bd6e2 the relay, election and attach
    suites all execute and pass. So this bump turns three silently-skipped suites into
    three real ones.
  * pio run -e ampworks and -e usermods both SUCCESS, with .pio/libdeps cleared first
    so the build could not read a stale cached copy of RS485Utils.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ
aphelps-claude-bot added a commit that referenced this pull request Aug 22, 2026
…SYNC (#37)

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%)


Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

Co-authored-by: aphelps-claude-bot <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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