Update drivers
This commit is contained in:
@ -11,6 +11,8 @@ from typing import Optional
|
||||
import serial
|
||||
from loguru import logger
|
||||
|
||||
from .common import format_comm_debug
|
||||
|
||||
# Protocol constants
|
||||
STX = 0x02
|
||||
ETX = 0x03
|
||||
@ -640,18 +642,14 @@ class PelicanSimulator:
|
||||
message = bytes(buffer[stx_idx : etx_idx + 1])
|
||||
buffer = buffer[etx_idx + 1 :]
|
||||
|
||||
logger.debug(
|
||||
f"RX: {' '.join(f'{b:02X}' for b in message)}"
|
||||
)
|
||||
logger.debug(format_comm_debug("RX", message))
|
||||
|
||||
# Parse and handle message
|
||||
parsed_data = self.parse_message(message)
|
||||
if parsed_data:
|
||||
response = self.handle_command(parsed_data)
|
||||
if response:
|
||||
logger.debug(
|
||||
f"TX: {' '.join(f'{b:02X}' for b in response)}"
|
||||
)
|
||||
logger.debug(format_comm_debug("TX", response))
|
||||
self.serial_conn.write(response)
|
||||
except ValueError:
|
||||
pass # ETX not found yet
|
||||
|
||||
Reference in New Issue
Block a user