- Ubx-packetizer: disable debug
This commit is contained in:
+1
-2
@@ -106,7 +106,6 @@ class NetworkBackend(ABackend):
|
||||
if mask & selectors.EVENT_WRITE:
|
||||
data = sock['queue'].get()
|
||||
key.fileobj.send(data)
|
||||
print(f"Writing {key.data} to {sock['name']}")
|
||||
if sock['queue'].empty():
|
||||
self.sel.modify(sock['sock'], selectors.EVENT_READ, None)
|
||||
|
||||
@@ -148,7 +147,7 @@ if __name__ == "__main__":
|
||||
# UbxReceiver('UBX-NAV-SIG', 0x01, 0x43),
|
||||
UbxReceiver('UBX-ACK-ACK', 0x05, 0x01),
|
||||
UbxReceiver('UBX-ACK-NACK', 0x05, 0x00),
|
||||
UbxReceiver('default'),
|
||||
UbxReceiver('UBX:default'),
|
||||
]
|
||||
|
||||
# Topology
|
||||
|
||||
@@ -5,6 +5,11 @@ from msg_source import MsgSource
|
||||
from ubx.ubx import UBX_SYNC_WORD, frame_parse, frame_create
|
||||
from receiver.ubx_receiver import UbxReceiver
|
||||
|
||||
UBX_PKT_DEBUG = False
|
||||
def ubx_pkt_debug(s: str):
|
||||
if UBX_PKT_DEBUG:
|
||||
print(s)
|
||||
|
||||
class UbxPacketizer(MsgSink, MsgSource):
|
||||
def __init__(self, sync_bytes: bytes = UBX_SYNC_WORD):
|
||||
MsgSink.__init__(self)
|
||||
@@ -28,9 +33,9 @@ class UbxPacketizer(MsgSink, MsgSource):
|
||||
self.d_save += struct.pack('B', d)
|
||||
self.sync_count += 1
|
||||
if self.sync_count == len(self.sync_bytes):
|
||||
print(f"{msg.name}:UBX-sync")
|
||||
ubx_pkt_debug(f"{msg.name}:UBX-sync")
|
||||
if len(self.packet) > 0:
|
||||
print(f"{msg.name}:Remaining packet: {self.packet}")
|
||||
ubx_pkt_debug(f"{msg.name}:Remaining packet: {self.packet}")
|
||||
self.sync_count = 0
|
||||
self.d_save = b''
|
||||
self.packet = b''
|
||||
@@ -55,6 +60,7 @@ class UbxPacketizer(MsgSink, MsgSource):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
UBX_PKT_DEBUG = True
|
||||
class MySink(MsgSink):
|
||||
def __init__(self):
|
||||
MsgSink.__init__(self)
|
||||
|
||||
Reference in New Issue
Block a user