Add Waveshare ESP32-S3-Touch-AMOLED-2.06 board port + Windows daemon fixes
- New board firmware/src/boards/waveshare_amoled_206/ (CO5300 410x502, FT3168 touch, AXP2101 PMU, QMI8658 IMU). PlatformIO env waveshare_amoled_206. CO5300_COL_OFFSET=22, fixed orientation, PWR button on GPIO10, FocalTech inline touch reader. - Windows daemon: fix advertised device name (Claude Controller -> Clawdmeter) to match firmware ble.cpp, and add CLAWDMETER_ADDRESS env fallback so it connects by address when the bonded HID device is not advertising (Windows keeps it HID-connected). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,12 @@ import httpx
|
||||
from bleak import BleakClient, BleakScanner
|
||||
from bleak.exc import BleakError
|
||||
|
||||
DEVICE_NAME = "Claude Controller"
|
||||
DEVICE_NAME = "Clawdmeter" # must match firmware ble.cpp DEVICE_NAME
|
||||
# Optional direct-connect address. Once the device is bonded as a BLE HID
|
||||
# keyboard, Windows keeps it connected, so it stops advertising and an active
|
||||
# scan (find_device_by_name) never sees it. Setting CLAWDMETER_ADDRESS lets the
|
||||
# daemon connect straight to the bonded device by address via WinRT.
|
||||
DEVICE_ADDRESS = os.environ.get("CLAWDMETER_ADDRESS")
|
||||
SERVICE_UUID = "4c41555a-4465-7669-6365-000000000001"
|
||||
RX_CHAR_UUID = "4c41555a-4465-7669-6365-000000000002"
|
||||
REQ_CHAR_UUID = "4c41555a-4465-7669-6365-000000000004"
|
||||
@@ -162,7 +167,12 @@ async def scan_for_device():
|
||||
device = await BleakScanner.find_device_by_name(DEVICE_NAME, timeout=SCAN_TIMEOUT)
|
||||
if device:
|
||||
log(f"Found: {device.address}")
|
||||
return device # BLEDevice or None — NOT an address string
|
||||
return device # BLEDevice
|
||||
if DEVICE_ADDRESS:
|
||||
# Bonded device that's connected to Windows won't advertise — connect by address.
|
||||
log(f"Not advertising; connecting by bonded address {DEVICE_ADDRESS}")
|
||||
return DEVICE_ADDRESS # address string — BleakClient accepts it on WinRT
|
||||
return device # None
|
||||
|
||||
|
||||
class Session:
|
||||
@@ -324,7 +334,8 @@ async def connect_and_run(device, stop_event: asyncio.Event, tray_state=None) ->
|
||||
|
||||
Returns True if at least one successful write occurred.
|
||||
"""
|
||||
log(f"Connecting to {device.address}...")
|
||||
addr = device if isinstance(device, str) else device.address
|
||||
log(f"Connecting to {addr}...")
|
||||
# D-01: retry wrapper — defeats WinRT post-wake failure modes
|
||||
# (Could not get GATT services: Unreachable, stale is_connected).
|
||||
# Rebuild a fresh BleakClient each attempt (locked D-05 recipe).
|
||||
|
||||
Reference in New Issue
Block a user