fix: refine SUB 1A compliance config read parameters and logging

This commit is contained in:
Brian Harrison
2026-04-01 14:20:12 -04:00
parent 824322597a
commit d4b1b834a7

View File

@@ -397,7 +397,7 @@ class MiniMateProtocol:
def read_compliance_config(self) -> bytes: def read_compliance_config(self) -> bytes:
""" """
Send the SUB 1A (CHANNEL_SCALING / COMPLIANCE_CONFIG) two-step read. Send the SUB 1A (COMPLIANCE_CONFIG) two-step read.
Returns the full 2090-byte compliance config block (E5 response) Returns the full 2090-byte compliance config block (E5 response)
containing: containing:
@@ -413,22 +413,33 @@ class MiniMateProtocol:
Raises: Raises:
ProtocolError: on timeout, bad checksum, or wrong response SUB. ProtocolError: on timeout, bad checksum, or wrong response SUB.
Confirmed from protocol reference §7.6: Confirmed from raw BW captures (3-11-26):
- SUB 1A request uses all-zero params Probe (Frame A): [5]=0x00, params[7]=0x64
- E5 response is 2090 bytes (0x082A fixed length) Data req (Frame D): [5]=0x2A, params[2]=0x08, params[7]=0x64
- Response data section: data[11:11+0x082A]
The 16-bit length 0x082A is split across two fields:
byte[5] = 0x2A (offset/length low byte, as in all two-step reads)
params[2] = 0x08 (length high byte, packed into params rather than byte[4])
params[7] = 0x64 = 100 is required in both probe and data request.
Purpose unknown — possibly max channel count or backlight timeout.
""" """
rsp_sub = _expected_rsp_sub(SUB_COMPLIANCE) rsp_sub = _expected_rsp_sub(SUB_COMPLIANCE)
length = 0x082A # 2090 bytes, fixed length for compliance config
# Probe — params[7]=0x64 required (confirmed from BW capture)
_PROBE_PARAMS = bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00])
log.debug("read_compliance_config: 1A probe") log.debug("read_compliance_config: 1A probe")
self._send(build_bw_frame(SUB_COMPLIANCE, 0)) self._send(build_bw_frame(SUB_COMPLIANCE, 0, _PROBE_PARAMS))
self._recv_one(expected_sub=rsp_sub) self._recv_one(expected_sub=rsp_sub)
log.debug("read_compliance_config: 1A data request offset=0x%04X", length) # Data request — 0x082A encoded as: byte[5]=0x2A, params[2]=0x08, params[7]=0x64
self._send(build_bw_frame(SUB_COMPLIANCE, length)) # NOT as a uint16 split across bytes[4:5] — confirmed from BW capture 3-11-26.
_DATA_PARAMS = bytes([0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00])
log.debug("read_compliance_config: 1A data request offset=0x2A params[2]=0x08")
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
config = data_rsp.data[11:11 + length] config = data_rsp.data[11:11 + length]
log.debug("read_compliance_config: received %d config bytes", len(config)) log.debug("read_compliance_config: received %d config bytes", len(config))
return config return config