How the-spire/esp32-smart-water-gun works
This is ESP32-C3 firmware for a configurable sound-and-light water-gun prop. The principal workflow is encoder/trigger input into the state machine, which handles firing, ammunition and reload behavior, updates the display, and controls the pump, laser, indicator, sound, and LEDs. Users navigate separate settings screens to adjust behavior and appearance; settings persist through Preferences. The README documents additional screen capabilities, but excerpts do not show every screen’s wiring, so uncertain links are omitted.
Main entry points: UIManager.cpp UI manager · WaterGunLogic.cpp Water-gun logic · main.cpp Firmware loop · OutputManager.cpp Output manager
Components 19
Control flow
- Firmware loop
src/main.cpp - Water-gun logic
src/logic/WaterGunLogic.cpp
Display and settings UI
- UI manager
src/ui/UIManager.cpp - Main screen
src/ui/screens/ScreenMain.cpp - Function settings
src/ui/screens/ScreenFuncSettings.cpp - Bullet settings
src/ui/screens/ScreenBulletSettings.cpp - Sound settings
src/ui/screens/ScreenSoundSettings.cpp - Light settings
src/ui/screens/ScreenLightSettings.cpp - Theme settings
src/ui/screens/ScreenThemeSettings.cpp - System information
src/ui/screens/ScreenSysInfo.cpp
Device hardware
- Trigger and encoder
src/hardware/InputManager.cpp - Output manager
src/hardware/OutputManager.cpp - LED strip
src/hardware/LedStrip.cpp - Voice module
src/hardware/VoiceModule.cpp
Settings persistence
- Settings manager
src/storage/SettingsManager.cpp - Preferences store
Other components
- Prop user
- Prop actuators
- Voice hardware
Connections 22
- Prop user → Trigger and encoder: operates controls
- Firmware loop → Water-gun logic: updates state
- Water-gun logic → Trigger and encoder: reads events
- Firmware loop → Output manager: updates outputs
- Firmware loop → LED strip: updates LEDs
- Firmware loop → UI manager: updates display
- Water-gun logic → UI manager: dispatches UI
- Water-gun logic → Output manager: controls actuators
- Water-gun logic → Voice module: plays sounds
- Water-gun logic → LED strip: controls lighting
- Water-gun logic → Settings manager: reads and saves
- UI manager → Main screen: creates screen
- UI manager → Function settings: dispatches actions
- UI manager → Bullet settings: dispatches actions
- UI manager → Sound settings: dispatches actions
- UI manager → Light settings: dispatches actions
- UI manager → Theme settings: dispatches actions
- UI manager → System information: dispatches actions
- Firmware loop → Settings manager: loads settings
- Settings manager → Preferences store: reads and writes
- Output manager → Prop actuators: drives actuators
- Voice module → Voice hardware: plays audio