- Ubx-packetizer: disable debug
This commit is contained in:
@@ -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