Skip to content

Commit 2e639f1

Browse files
author
sidey79
committed
fix(controller): Bypass STX messages during command response
STX messages (sensor data) can be interleaved with command responses, similar to MU/MS messages. The controller must skip these messages and continue waiting for the actual command response. The STX message is parsed to ensure sensor data is handled correctly while waiting.
1 parent 8cc5295 commit 2e639f1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

signalduino/controller.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ async def send_command(
8282
timeout=timeout or SDUINO_CMD_TIMEOUT
8383
)
8484

85-
# If it's an interleaved message, get next response
86-
if response and (response.startswith("MU;") or response.startswith("MS;")):
85+
# If it's an interleaved or STX message, get next response
86+
if response and (response.startswith("MU;") or response.startswith("MS;") or response.startswith("\x02")):
87+
# Parse STX message if present
88+
if response.startswith("\x02"):
89+
self.parser.parse_line(response.strip())
8790
# Create a new read task for the actual response
8891
read_task2 = asyncio.create_task(self.transport.readline())
8992
response = await asyncio.wait_for(

0 commit comments

Comments
 (0)