From 6e0b83efa5ddd568459b35b15b5f38de9e542387 Mon Sep 17 00:00:00 2001 From: Brian Harrison Date: Wed, 1 Apr 2026 14:31:03 -0400 Subject: [PATCH] fix: update compliance config reading to handle variable payload sizes and improve logging --- minimateplus/protocol.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/minimateplus/protocol.py b/minimateplus/protocol.py index 09b05ff..bc1b3ea 100644 --- a/minimateplus/protocol.py +++ b/minimateplus/protocol.py @@ -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 ──────────────────────────────────────────────────────