首次提交完整的python工程代码
This commit is contained in:
13
structure/b_frame.py
Normal file
13
structure/b_frame.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# structure/b_frame.py
|
||||
|
||||
import struct
|
||||
|
||||
B_STAR_TIME_OFFSET = 41 # 根据你协议计算出的星上时偏移(可精调)
|
||||
B_STAR_TIME_LEN = 6
|
||||
|
||||
def build_b_frame(data_id: int, processed_values: list[float]) -> bytes:
|
||||
# 每个结果占8字节大端double
|
||||
payload = b"".join(struct.pack('>d', v) for v in processed_values)
|
||||
data_len = len(payload)
|
||||
frame = struct.pack('>II', data_id, data_len) + payload
|
||||
return frame
|
||||
Reference in New Issue
Block a user