diff --git a/bulltron_gui.py b/bulltron_gui.py index b555ba9..44000ce 100644 --- a/bulltron_gui.py +++ b/bulltron_gui.py @@ -454,8 +454,14 @@ class BleWorker: if self.client and self.client.is_connected: 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)) - await self.client.write_gatt_char(WRITE_CHAR, data, response=response) 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: slow_counter = 0