fix: update compliance config reading to handle variable payload sizes and improve logging

This commit is contained in:
Brian Harrison
2026-04-01 14:31:03 -04:00
parent d4b1b834a7
commit 6e0b83efa5

View File

@@ -439,9 +439,19 @@ class MiniMateProtocol:
self._send(build_bw_frame(SUB_COMPLIANCE, 0x2A, _DATA_PARAMS))
data_rsp = self._recv_one(expected_sub=rsp_sub)
length = 0x082A # 2090 bytes total expected
config = data_rsp.data[11:11 + length]
log.debug("read_compliance_config: received %d config bytes", len(config))
# Slice off the 11-byte echo header; take ALL remaining data (not 0x082A limit —
# actual E5 payload is ~4245 bytes, varying by firmware/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
# ── Internal helpers ──────────────────────────────────────────────────────