Repository navigation
Touch Pond effect: MPR121 capacitive touch with audio reactivity - #2
Merged
Merged
Conversation
Replace fade_out() (which fades toward Color 2, not black) with a manual color_fade(..., false) loop. Replace addPixelColor (saturates to white under sustained touch) with blendPixelColor. Remove proximity glow pending MPR121 setThresholds register fix (tracked in todo.md). Apply MPR121_IRQ_PIN build flag to irqPin default. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace static "illuminate and fade" with a wave pond model: each new touch spawns up to 8 simultaneous expanding wavefronts that radiate outward from the electrode anchor in both directions, fading as they travel. Held electrodes keep their anchor lit. Key changes: - TouchWave/TouchRippleData struct in SEGENV.data (42 bytes) - Rising-edge detection via prevTouched bitmask - Each electrode gets a distinct palette hue (spread across 12 slots) - c2 parameter controls trail length; c1 = MPR121 Hz Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace diagnostic version with full wave effect: - Touch onset spawns an expanding wave with a 3-pixel bright wavefront and a comet tail filling the interior toward the origin - Up to 8 simultaneous waves, each with palette hue from electrode index - While held: anchor pixel pulses with beatsin8 (30 bpm, ±3 pixels) - Background fades at configurable rate (c2 param) - Renamed to "Touch Pond" in PROGMEM string Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Wave lifetime was 20–80 frames (too fast). Now 50–200 frames so the default (sx=40) expands over ~6 seconds. Speed slider still goes up to ~1.7 s at maximum. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
When no real touch occurs for ~3s, the effect replays recently recorded touches as dim ghost waves (~31% brightness), preserving the original inter-touch timing. The history ring buffer holds up to 16 touch events; after each full replay cycle the effect pauses 5s before looping again. Any new real touch immediately interrupts replay and resets the sequence. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
New "Audio" slider (c3, default 0 = off) drives spontaneous waves from audio volume. Higher mix lowers the trigger threshold, shortens the spawn cooldown, and increases wave brightness — blending smoothly from silent (pure touch/ghost) to fully audio-reactive. Brightness of audio waves (ghostBri 120-220) sits between ghost replay (80) and real touches (255), keeping the three sources visually distinct. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- AGC: instant-attack / slow-decay (~8s half-life) running peak tracks recent loudness so normVol is always relative to what was loud recently - Slider curve: sqrt mapping makes half-position (~128) behave like ~70% of maximum sensitivity, so the useful range spans the whole slider - Wave brightness scales with normalized amplitude (loud = bright, 80-220) keeping audio waves visually distinct from real touches (255) and ghosts (80) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Raise threshold (200->165), lengthen cooldown (3-20 -> 8-40 frames), raise AGC floor (10->30). Full slider still reactive; half slider now roughly 1-2 waves/sec during loud passages, quiet ambient no longer triggers after peak decays. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Old sqrt curve mapped c3=50 to effective mix≈113 (the working zone). New curve: sqrt16 on [0,128] reaches exactly 113 at audioMix=128, then linear [128,255]→[113,255] for full upper-range control. Default stays at c3=50 but the slider now feels natural — midpoint is the good zone. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Touch Pondeffect: touching MPR121 electrodes spawns expanding wave rings on the LED stripPart of aphelps/WLED_dev#14 in the parent repo.