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