Replace USB serial/HID with Bluetooth Low Energy

Move all communication from USB to BLE. The device now advertises as
"Claude Controller" and acts as both a BLE HID keyboard (for touch
gestures) and a GATT data server (for usage updates from the daemon).

- Add NimBLE-Arduino BLE module with custom GATT service + HID keyboard
- Add third screen (Bluetooth) with connection status, MAC, reset button
- Rewrite daemon in bash using bluetoothctl/busctl for BLE GATT writes
- Add screenshot capture via LVGL snapshot over serial
- Remove TinyUSB mode — normal pio upload works again
- Update README with BLE architecture, screenshots, gesture docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hermann Björgvin Haraldsson
2026-04-04 19:30:19 +00:00
co-authored by Claude Opus 4.6
parent 930055170f
commit 10b8052bcc
22 changed files with 917 additions and 167 deletions
+3 -31
View File
@@ -1,7 +1,5 @@
#!/bin/bash
# Flash helper for TinyUSB mode firmware.
# The built-in JTAG bootloader doesn't auto-reset with TinyUSB, so we
# trigger a reset via DTR/RTS on the CDC serial port before flashing.
# Build and flash firmware to the SC01 Plus.
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
@@ -11,34 +9,8 @@ echo "=== Flashing Claude Usage Tracker ==="
echo "Port: $PORT"
echo ""
# Build first
echo "[1/3] Building firmware..."
cd "$SCRIPT_DIR/firmware"
~/.platformio/penv/bin/pio run
# Reset the device into bootloader via DTR/RTS
echo "[2/3] Resetting device into bootloader..."
python3 -c "
import serial, time
port = serial.Serial('$PORT', 115200)
port.dtr = False; port.rts = True; time.sleep(0.1)
port.dtr = True; port.rts = False; time.sleep(0.05)
port.dtr = False; time.sleep(0.1); port.close()
"
sleep 0.5
# Flash with no_reset (device is already in bootloader)
echo "[3/3] Flashing..."
python3 ~/.platformio/packages/tool-esptoolpy/esptool.py \
--chip esp32s3 \
--port "$PORT" \
--before no_reset \
--baud 921600 \
write_flash -z \
0x0 .pio/build/sc01plus/bootloader.bin \
0x8000 .pio/build/sc01plus/partitions.bin \
0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin \
0x10000 .pio/build/sc01plus/firmware.bin
~/.platformio/penv/bin/pio run -t upload --upload-port "$PORT"
echo ""
echo "=== Done! Device will reboot automatically. ==="
echo "=== Done! ==="