fix Respeaker USB Mic Array v2 LEDs (#357)
Fix ReSpeaker USB LED control and suppress stale peripheral disconnect replay --------- Co-authored-by: Florian Asche <github@florian-asche.de>
This commit is contained in:
1 parent
8f788eeff0
commit
201896196f
2 files changed
+67
-43
No files matched your search
@@ -281,14 +281,20 @@ class PeripheralAPIServer:
|
||||
# Replay the current event state so the client immediately shows the
|
||||
# right animation — e.g. a timer ticking animation when reconnecting
|
||||
# mid-timer, or the muted indicator when reconnecting while muted.
|
||||
if self._current_state is not None:
|
||||
state_payload: Dict[str, Any] = {"event": self._current_state.value}
|
||||
if self._current_state_data:
|
||||
state_payload["data"] = self._current_state_data
|
||||
try:
|
||||
await websocket.send(json.dumps(state_payload))
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
current_state = self._current_state
|
||||
if current_state is None:
|
||||
return
|
||||
|
||||
if current_state == LVAEvent.DISCONNECTED and state.connected:
|
||||
return
|
||||
|
||||
state_payload: Dict[str, Any] = {"event": current_state.value}
|
||||
if self._current_state_data:
|
||||
state_payload["data"] = self._current_state_data
|
||||
try:
|
||||
await websocket.send(json.dumps(state_payload))
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Command dispatch
|
||||
|
||||
Reference in new issue
Block a user