How zou-shui/muggleswand-src works
Muggles’ Wand is ESP32-S3 wand firmware. Its principal workflow samples motion, buffers gesture data, runs TensorFlow Lite inference, publishes detected gestures, and dispatches them to wand actions such as lighting, BLE HID, ESP-NOW, or POV drawing. The event bus also connects hardware and system services. The README documents AP/Web management and OTA; those capabilities are included, though their complete runtime wiring is not shown in the excerpts. Edges reflect shown calls, references, or README statements; unsampled details are not inferred.
Components 27
Motion Recognition
- Gesture Buffer
src/Model/gesture_buffer.cpp - Gesture Inference
src/Model/gesture_inference.cpp - TFLite Model
src/Model/gesture_model.h
Hardware Layer
- IMU Sampling
src/HAL/HAL_IMU.cpp - ICM42670P Driver
src/HAL/HAL_ICM42670P.cpp - LED Animation HAL
src/HAL/HAL_WS2812.cpp - Animation Engine
src/HAL/WS2812_Animation/AnimationBase.hpp - Power Management
src/HAL/HAL_Power.cpp - Button Input
src/HAL/HAL_Button.cpp
Wand Applications
- App Dispatcher
src/APP/APP.cpp - Lumos
src/APP/APP_Lumos.cpp - BLE HID
src/APP/APP_BLE_HID.cpp - ESP-NOW Actions
src/APP/APP_EspNow.cpp - POV Drawing
src/APP/APP_POV.cpp - POV Patterns
src/APP/APP_POVPatterns.h
System Services
- System Service
src/Service/Service.cpp - Serial Console
src/Service/Console.cpp - BLE Service
src/Service/BLE.cpp - Wi-Fi Access Point
src/Service/AP.cpp - Web Management
src/Service/AP_Web.cpp - OTA Update
src/Service/OTA.cpp - Sleep Service
src/Service/Sleep.cpp
Other components
- Wand User
- BLE Host
- Browser
Connections 34
- Wand User → IMU Sampling: moves wand
- Startup → Event Bus: initializes
src/main.cpp - Startup → System Service: starts
src/main.cpp - Startup → Gesture Inference: starts
src/main.cpp - Startup → ICM42670P Driver: initializes
src/main.cpp - Startup → App Dispatcher: initializes
src/main.cpp - IMU Sampling → Gesture Buffer: fills buffer
src/HAL/HAL_IMU.cpp - IMU Sampling → Event Bus: publishes data
src/HAL/HAL_IMU.cpp - IMU Sampling → ICM42670P Driver: reads sensor
src/HAL/HAL_IMU.cpp - Gesture Inference → Gesture Buffer: acquires samples
src/Model/gesture_inference.cpp - Gesture Inference → TFLite Model: loads model
src/Model/gesture_inference.cpp - Gesture Inference → Event Bus: publishes gesture
src/Model/gesture_inference.cpp - Event Bus → App Dispatcher: delivers events
src/APP/APP.cpp - App Dispatcher → LED Animation HAL: starts effects
src/APP/APP.cpp - App Dispatcher → ESP-NOW Actions: sends signals
src/APP/APP.cpp - App Dispatcher → BLE HID: dispatches controls
src/APP/APP.cpp - App Dispatcher → Lumos: triggers
src/APP/APP.cpp - App Dispatcher → POV Drawing: controls mode
src/APP/APP.cpp - POV Drawing → POV Patterns: uses patterns
src/APP/APP_POV.cpp - POV Drawing → LED Animation HAL: renders drawing
src/APP/APP_POV.cpp - LED Animation HAL → Animation Engine: manages animations
src/HAL/HAL_WS2812.cpp - Button Input → Event Bus: reports presses
- System Service → Event Bus: subscribes
src/Service/Service.cpp - System Service → BLE Service: toggles
src/Service/Service.cpp - System Service → Wi-Fi Access Point: toggles
src/Service/Service.cpp - System Service → OTA Update: starts update
src/Service/Service.cpp - System Service → Sleep Service: enters sleep
src/Service/Service.cpp - System Service → Power Management: reads status
src/Service/Service.cpp - Serial Console → Event Bus: issues commands
- Wi-Fi Access Point → Web Management: serves management
- Web Management → OTA Update: accepts firmware
- Browser → Web Management: uploads firmware
- BLE HID → BLE Service: uses BLE
src/APP/APP_BLE_HID.cpp - BLE Service → BLE Host: connects