Continue BullTron refresh after write timeout

This commit is contained in:
2026-07-11 15:57:30 +02:00
parent 421cea6ea1
commit c22b2cf995
+7 -1
View File
@@ -454,8 +454,14 @@ class BleWorker:
if self.client and self.client.is_connected: if self.client and self.client.is_connected:
if len(data) >= 6 and data[0] == 0xD2 and data[1] == 0x03: if len(data) >= 6 and data[0] == 0xD2 and data[1] == 0x03:
self.pending_reads.append((int.from_bytes(data[2:4], "big"), int.from_bytes(data[4:6], "big") * 2)) self.pending_reads.append((int.from_bytes(data[2:4], "big"), int.from_bytes(data[4:6], "big") * 2))
await self.client.write_gatt_char(WRITE_CHAR, data, response=response)
self.ui_queue.put(("tx", data.hex(" ").upper())) self.ui_queue.put(("tx", data.hex(" ").upper()))
if response:
try:
await asyncio.wait_for(self.client.write_gatt_char(WRITE_CHAR, data, response=True), timeout=1.5)
except asyncio.TimeoutError:
self.ui_queue.put(("log", "GATT write response timed out; continuing with protocol ACK/refresh"))
else:
await self.client.write_gatt_char(WRITE_CHAR, data, response=False)
async def _poll_loop(self) -> None: async def _poll_loop(self) -> None:
slow_counter = 0 slow_counter = 0