feat(t-deck): audible detection alerts via I2S speaker - #5
Open
thehappydinoa wants to merge 2 commits into
Open
thehappydinoa wants to merge 2 commits into
thehappydinoa wants to merge 2 commits into
Conversation
Design exploration ranking which Flipper interface/feature ideas are worth bringing to the flockdar T-Deck firmware (main menu, audio/haptic alert cues, saved-session browser, RSSI detector screen, mini-map, settings, etc.), with what's already built and what's explicitly out of scope (Sub-GHz/IR/NFC — no radios for it; flockdar is a passive detector). Proposal only, no code.
Add Flipper-style audio cues on the T-Deck's MAX98357A I2S speaker — a
confidence-tiered chirp on each Flock detection plus a power-up chirp, so the
operator gets eyes-up alerting while driving.
- tone_synth.{h,cpp}: pure 16-bit PCM tone/cue synthesis (square wave with a
raised-cosine anti-click envelope). No hardware deps -> host-unit-testable.
Cues: HIGH = rising triple-beep, MED = two-note ping, LOW = single blip, boot.
- audio.{h,cpp}: I2S driver (FD_ENABLE_AUDIO). Plays cues on a background task
(queue depth 1, drops overlaps) so the scan loop never blocks. No-op inline
stubs when disabled, so call sites stay clean on non-T-Deck builds.
- Hook: serial_out_emit() fires audio_alert(flock_det_confidence(...)) next to
the existing display_note(); only wifi/ble detections reach it.
- serial_cmd: `sound on|off|test` runtime control.
- pins: I2S WS/BCK/DOUT in tdeck_board.h (note GPIO7 BCK overlaps the vestigial
pin_spec OLED_SDA=7, which the T-Deck never consumes).
- platformio: -DFD_ENABLE_AUDIO on env:t-deck. README documents the feature.
- tests/test_tone_synth.py: host cross-check of sample counts, envelope/peak,
buffer-cap safety, and silent rests (159 Python tests pass; compiles clean,
incl. the disabled-build stub path).
thehappydinoa
force-pushed
the
claude/flipper-inspired-features
branch
from
June 2, 2026 23:50
ea03a41 to
1eae4da
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.
Flipper-style audio cues on the T-Deck's MAX98357A I²S speaker — a confidence-tiered chirp on each Flock detection plus a power-up chirp, so the operator gets eyes-up alerting while driving.
What's here
tone_synth.{h,cpp}— pure 16-bit PCM tone/cue synthesis (square wave + raised-cosine anti-click envelope). No hardware deps → host-unit-testable. Cues: HIGH = rising triple-beep, MED = two-note ping, LOW = single blip, plus boot.audio.{h,cpp}— I²S driver behindFD_ENABLE_AUDIO. Plays cues on a background FreeRTOS task (queue depth 1, drops overlaps) so the scan loop never blocks. No-opstatic inlinestubs when disabled keep call sites clean on non-T-Deck builds.serial_out_emit()firesaudio_alert(flock_det_confidence(...))next to the existingdisplay_note(); only wifi/ble detections reach it.sound on|off|testserial command for runtime control.tdeck_board.h;-DFD_ENABLE_AUDIOonenv:t-deck; README documents the feature + commands.Hardware note
The T-Deck has a speaker (MAX98357A I²S amp), not a piezo buzzer — hence PCM-over-I²S rather than
tone(). GPIO7 (I²S BCK) overlaps a vestigialOLED_SDA=7inpin_spec.pythat the T-Deck never consumes (it usesFD_ENABLE_TDECK_UI). Harmless today; flagged in a code comment. Happy to scrub it frompin_spec.pyin a follow-up.Tests
tests/test_tone_synth.pyhost-compiles the synth core and checks sample counts, envelope/peak scaling, buffer-cap safety, and silent rests.sound test→ HIGH cue.https://claude.ai/code/session_01J5wD9G5ms5hPL3rGZsieWC
Generated by Claude Code