Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions connections/debug/debug_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
self.device_address = device_address
self.device_id = device_id
self.stage = stage
self.kiss_address = None
self.nmea_serial_port = nmea_serial_port
self.nmea_baud_rate = nmea_baud_rate
self.start_time = time.time()
Expand Down
14 changes: 4 additions & 10 deletions connections/serial/serial_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def __init__(
):
self.device = serial.Serial(comPort, baudRate, timeout=1)
self.stage = stage

self.kiss_address = None
self.nmea_serial_port = nmea_serial_port
self.nmea_baud_rate = nmea_baud_rate

Expand All @@ -38,11 +40,6 @@ def _read_serial(self):
if self.device.in_waiting > 0:
new_data = self.device.read(self.device.in_waiting)
self.buffer.extend(new_data)
# Print each byte in base 10
print("Received new_data (base 10):", end=" ")
for byte in new_data:
print(byte, end=" ")
print()

# Process complete packets from the buffer
self._process_buffer()
Expand All @@ -51,6 +48,8 @@ def _read_serial(self):
time.sleep(0.01)
except Exception as e:
print(f"Serial read error: {e}")
self.buffer = bytearray()
time.sleep(0.5)

def _process_buffer(self):
"""Process complete packets from the buffer"""
Expand All @@ -77,11 +76,6 @@ def _process_buffer(self):

def _newData(self, data):
if self.callback:
# Print each byte in base 10
print("[!!!] Received data (base 10):", end=" ")
for byte in data:
print(byte, end=" ")
print()
message = ConnectionMessage(
device_address=None,
connection=self,
Expand Down
3 changes: 2 additions & 1 deletion connections/sim/sim_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(
self.callback = None
self.stage = stage

self.kiss_address = None
self.nmea_serial_port = nmea_serial_port
self.nmea_baud_rate = nmea_baud_rate

Expand Down Expand Up @@ -305,7 +306,7 @@ def getKissAddress(self) -> Optional[str]:
# Returns the stage number of the connection
def getStage(self) -> int:
return self.stage

def getNMEASerialPort(self) -> Optional[str]:
return self.nmea_serial_port

Expand Down
Loading