Add a 'task complete' chime on entering celebrate state#15
Open
SnowWarri0r wants to merge 1 commit into
Open
Conversation
P_CELEBRATE drives the GIF animation (turn-complete from the desktop app / CLI bridge, plus level-up via triggerOneShot), but is silent — miss the screen, miss the cue. Two-note ascending chime (2000 Hz → 2800 Hz, the universal "ta-da" of completion sounds) on the activeState edge into P_CELEBRATE. Picked this over a single-tone beep because the existing palette (600 deny / 1200 prompt / 1800 cycle / 2400 approve) is dense — any single tone risks sounding like a button confirmation rather than a state event. Note 2 is scheduled via millis() because M5.Beep.tone() is one-at-a-time: calling it twice in the same tick stomps the first note. Routes through beep() so settings().sound still gates everything. Edge-triggered (`prev != cur`) so we get one chime per celebrate session, not one per loop tick.
1fd0380 to
5770d3e
Compare
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.
Why
The
P_CELEBRATEstate drives the GIF animation when a turn completes (or on level-up viatriggerOneShot), but it's silent. If you're looking at another screen when the buddy starts dancing, you miss it entirely — the visual cue is the only signal.What
Two-note ascending chime on the transition into
P_CELEBRATE, gated by an edge-triggered check onactiveState. Note 2 is scheduled viamillis()becauseM5.Beep.tone()is one-at-a-time — calling it twice in the same tick stomps the first note.Inserted right after
activeStateresolves for this tick, so it covers both code paths into celebrate:baseState == P_CELEBRATEdriven byrecentlyCompletedfrom the heartbeat (bridge / desktop app)triggerOneShot(P_CELEBRATE, 3000)fromstatsPollLevelUp()Design choices
activeStatetriggerOneShotpath and the bridgerecentlyCompletedpath uniformly.beep()settings().soundtoggle gates the entire chime (both notes). No new opt-out machinery.Testing
Flashed on M5StickC Plus (
pio run -t upload) and verified live via the Claude Code CLI bridge:Edge cases not exercised in this session but covered by the structure:
Settings → Sound = off(both notes route throughbeep()which gates on this)triggerOneShotlands whilerecentlyCompletedis already settingbaseState = P_CELEBRATE(single edge transition per celebrate window)🤖 Generated with Claude Code