- refactored

- added claude.md
This commit is contained in:
2026-05-24 09:21:26 +02:00
parent 670c4db7a4
commit 74b949f864
4 changed files with 89 additions and 10 deletions
+15
View File
@@ -0,0 +1,15 @@
UBX_SYNC1 = 0xB5
UBX_SYNC2 = 0x62
UBX_CLASS_NAV = 0x01
UBX_ID_CLOCK = 0x22
UBX_ID_NAV_SVINFO = 0x30
UBX_ID_NAV_SAT = 0x35
UBX_ID_NAV_SIG = 0x43
UBX_CLASS_RXM = 0x02
UBX_ID_RXM_RAW = 0x15
UBX_CLASS_ACK = 0x05
UBX_ID_ACK_NACK = 0x00
UBX_ID_ACK_ACK = 0x01
+5 -4
View File
@@ -1,6 +1,8 @@
import struct
UBX_SYNC_WORD = b'\xb5\x62'
from ubx.msg_types import *
UBX_SYNC_WORD = struct.pack('BB', UBX_SYNC1, UBX_SYNC2)
def checksum(data: bytes) -> bytes:
ck_a = 0
@@ -11,14 +13,13 @@ def checksum(data: bytes) -> bytes:
return struct.pack("BB", ck_a, ck_b)
def frame_create(_class: int, _id: int, _data: bytes) -> bytes:
_sync = b'\xb5\x62'
def frame_create(_class: int, _id: int, _data: bytes = b'') -> bytes:
_hdr = struct.pack('B', _class)
_hdr += struct.pack('B', _id)
_hdr += struct.pack('<H', len(_data))
_check = checksum(_hdr + _data)
return _sync + _hdr + _data + _check
return UBX_SYNC_WORD + _hdr + _data + _check
class Hdr:
def __init__(self, _class: int, _id: int, _length: int):