- LED panel BLE protocol (partial RE from glove firmware) - Panel MAC: E0:6E:41:94:39:70, BLE name: YS623B101069L - led-panel-ble.py: scan, slot switch, cycle tool - ble-capture-only.py: GATT server capture proxy - Glove firmware docs (ESP32 WROOM, 4-button controller) - Slot switch command doesn't work — capture needed
75 lines
2.7 KiB
Markdown
75 lines
2.7 KiB
Markdown
# Glove Firmware Notes
|
|
|
|
Source: `/home/seb/glove/` on saltylab-orin
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
glove/
|
|
├── platformio.ini # ESP32 WROOM (upesy_wroom), espressif32 6.7.0
|
|
├── partitions.csv # Custom partition table
|
|
├── src/
|
|
│ ├── main.cpp # Current main (V13 + WLED + LED panel)
|
|
│ ├── main.cpp.good # Known working version
|
|
│ ├── main.cpp.v14 # V14 variant?
|
|
│ ├── main.cpp.test # Test version
|
|
│ └── main.cpp.inmotion # Inmotion-only version
|
|
├── lib/
|
|
│ ├── Device/
|
|
│ │ ├── Device.h # Base device interface
|
|
│ │ ├── common.h # Globals (mutex)
|
|
│ │ ├── led/
|
|
│ │ │ ├── Led.h # LED panel BLE client
|
|
│ │ │ └── Led.cpp # Slot switch implementation
|
|
│ │ ├── wled/
|
|
│ │ │ ├── Wled.h # WLED HTTP client
|
|
│ │ │ └── Wled.cpp # Preset switching via /json/state
|
|
│ │ └── EUC/Inmotion/
|
|
│ │ ├── Inmotion.h # V13 BLE client
|
|
│ │ ├── Inmotion.cpp # Speed/brake event parsing
|
|
│ │ └── InmotionUtils.h
|
|
│ └── InputManager/
|
|
│ ├── InputManager.h # 4-button interrupt handler
|
|
│ └── InputManager.cpp # Debounce + sequence detection
|
|
```
|
|
|
|
## Key Implementation Details
|
|
|
|
### InputManager
|
|
- 4 GPIO inputs (32, 33, 25, 26) with pull-up, interrupt on CHANGE
|
|
- Debounce: 175ms
|
|
- Sequence detection: 700ms timeout timer — accumulates button presses into a string
|
|
- "1" = button 1 single, "11" = button 1 double-tap, etc.
|
|
|
|
### Led (BLE Panel Client)
|
|
- Connects by MAC address (passed as constructor string)
|
|
- Uses `BLE_ADDR_TYPE_RANDOM` for connection
|
|
- Single write characteristic for commands
|
|
- Slot command: 20-byte packet with offset calculation from slot_id 61
|
|
- **The slot command doesn't work on current panel — needs re-reverse-engineering**
|
|
|
|
### Wled (WiFi WLED Client)
|
|
- Resolves via mDNS or direct IP
|
|
- Fetches `/presets.json` on connect, builds name→ID map
|
|
- Switches presets via POST to `/json/state` with `{"ps":"<id>"}`
|
|
- Actions mapped by preset name: "LEFT", "RIGHT", "BRAKE", "NEUTRAL"
|
|
|
|
### Inmotion V13
|
|
- BLE connection to EUC
|
|
- Parses speed data from notifications
|
|
- Fires BRAKE event when decelerating, NEUTRAL when stable
|
|
- Also supports HORN and TOGGLE_LIGHT commands
|
|
|
|
### WiFi
|
|
- SSID: SASI, password: h3ll0w1f1
|
|
- Hostname: "controller"
|
|
- mDNS enabled
|
|
- BLE/WiFi coexistence: `ESP_COEX_PREFER_BALANCE`
|
|
|
|
### Build
|
|
```bash
|
|
cd /home/seb/glove
|
|
pio run -e upesy_wroom # build
|
|
pio run -e upesy_wroom -t upload # flash
|
|
```
|