Files
linux-voice-assistant/linux_voice_assistant
imonlinux dc9049e899 Add button_controller.py
Introduced a new ButtonController responsible for handling the ReSpeaker (or generic GPIO) button:

Uses RPi.GPIO with BCM numbering and internal pull-up (PUD_UP), assuming an active-low button.

Starts a dedicated polling thread that:

Reads the GPIO level at a configurable interval (default 10 ms / 100 Hz),

Detects press and release transitions,

Computes press duration to classify short vs long press.

Short press behavior:

If state.tts_player.is_playing or state.music_player.is_playing:

Schedules state.satellite.stop() on the asyncio loop,

Also stops music via state.music_player.stop().

Otherwise:

Schedules state.satellite.manual_wakeup("button") to start a new voice interaction (wake-like behavior without needing a model instance).

Long press behavior:

Toggles mic mute using the existing event path:

Publishes set_mic_mute on the EventBus with {"state": not state.mic_muted}.

This ensures MicMuteHandler remains the single writer for mic state, updates mic_muted_event, and syncs MQTT mute state/LEDs.

Designed to fail gracefully:

If ButtonConfig.enabled is False or RPi.GPIO is unavailable, logs a message and disables button support without affecting the rest of the system.
2025-11-29 23:41:24 -08:00
..
2025-08-26 09:30:58 -05:00
2025-11-29 14:37:18 -08:00
2025-11-18 15:15:46 -08:00
2025-11-20 20:01:13 -08:00
2025-11-29 23:41:24 -08:00
2025-11-17 17:42:40 -08:00
2025-11-29 23:40:16 -08:00
2025-10-12 10:09:45 -07:00
2025-11-17 21:50:53 -08:00
2025-11-21 16:59:04 -08:00
2025-11-29 14:38:13 -08:00
2025-11-21 11:00:03 -08:00
2025-11-29 14:38:52 -08:00
2025-11-29 14:39:46 -08:00
2025-11-21 17:17:56 -08:00
2025-11-19 18:46:05 -08:00