Skip to content

Commit

Permalink
fix ble code
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Jul 3, 2024
1 parent f401056 commit 4f61a19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions services/pixljs_alert/zero_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ async def main(config):
for buffer in slice_bytes(c, rx_char.max_write_without_response_size):
await client.write_gatt_char(rx_char, buffer)
while ">" not in scan_result.received_data \
.getvalue().decode("iso-8859-1") and not t.is_set():
.getvalue().decode("iso-8859-1") and not t.is_set() and client.is_connected:
await asyncio.sleep(0.1)
return_messages = scan_result.received_data.getvalue().decode("iso-8859-1")
if "mode=1" not in return_messages:
if "mode=1" not in return_messages or not client.is_connected:
print("Exit install mode %s" % return_messages)
break
except (BleakError, asyncio.TimeoutError) as e:
Expand Down

0 comments on commit 4f61a19

Please sign in to comment.