fix: update compliance config reading to handle variable payload sizes and improve logging
This commit is contained in:
@@ -439,9 +439,19 @@ class MiniMateProtocol:
|
|||||||
self._send(build_bw_frame(SUB_COMPLIANCE, 0x2A, _DATA_PARAMS))
|
self._send(build_bw_frame(SUB_COMPLIANCE, 0x2A, _DATA_PARAMS))
|
||||||
data_rsp = self._recv_one(expected_sub=rsp_sub)
|
data_rsp = self._recv_one(expected_sub=rsp_sub)
|
||||||
|
|
||||||
length = 0x082A # 2090 bytes total expected
|
# Slice off the 11-byte echo header; take ALL remaining data (not 0x082A limit —
|
||||||
config = data_rsp.data[11:11 + length]
|
# actual E5 payload is ~4245 bytes, varying by firmware/config).
|
||||||
log.debug("read_compliance_config: received %d config bytes", len(config))
|
config = data_rsp.data[11:]
|
||||||
|
log.warning(
|
||||||
|
"read_compliance_config: E5 response total=%d data=%d cfg=%d bytes",
|
||||||
|
len(data_rsp.data) + 5, len(data_rsp.data), len(config),
|
||||||
|
)
|
||||||
|
# Hex dump first 128 bytes for field mapping
|
||||||
|
for row in range(0, min(len(config), 128), 16):
|
||||||
|
chunk = config[row:row+16]
|
||||||
|
hex_part = ' '.join(f'{b:02x}' for b in chunk)
|
||||||
|
asc_part = ''.join(chr(b) if 32 <= b < 127 else '.' for b in chunk)
|
||||||
|
log.warning(" cfg[%04x]: %-48s %s", row, hex_part, asc_part)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
# ── Internal helpers ──────────────────────────────────────────────────────
|
# ── Internal helpers ──────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user