diff --git a/minimateplus/client.py b/minimateplus/client.py index de61826..56c8a86 100644 --- a/minimateplus/client.py +++ b/minimateplus/client.py @@ -703,6 +703,13 @@ def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None: # "Tran2" at a later position won't match because its surrounding bytes differ. try: tran_pos = data.find(b"Tran", 1000) + log.warning("compliance_config: 'Tran' search from 1000 → pos=%d cfg_len=%d", tran_pos, len(data)) + if tran_pos >= 0: + pre = data[max(0, tran_pos - 30) : tran_pos + 8] + log.warning( + "compliance_config: bytes around 'Tran'@%d: %s", + tran_pos, pre.hex(), + ) if ( tran_pos >= 24 and data[tran_pos + 4 : tran_pos + 5] != b"2" # not "Tran2" @@ -712,18 +719,22 @@ def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None: config.trigger_level_geo = struct.unpack_from(">f", data, tran_pos - 18)[0] config.alarm_level_geo = struct.unpack_from(">f", data, tran_pos - 10)[0] config.max_range_geo = struct.unpack_from(">f", data, tran_pos - 24)[0] - log.debug( + log.warning( "compliance_config: trigger=%.4f alarm=%.4f max_range=%.4f in/s", config.trigger_level_geo, config.alarm_level_geo, config.max_range_geo, ) - elif tran_pos >= 0: - log.debug( - "compliance_config: 'Tran' at %d but unit strings absent " - "— channel block not yet in cfg (frame D duplicate?)", + elif tran_pos >= 24: + log.warning( + "compliance_config: 'Tran' at %d — unit string check failed: " + "label-14..label-10=%s (want 696e2e00) label-6..label-2=%s (want 2f730000)", tran_pos, + data[tran_pos - 14 : tran_pos - 10].hex(), + data[tran_pos - 6 : tran_pos - 2 ].hex(), ) + elif tran_pos >= 0: + log.warning("compliance_config: 'Tran' at %d but too close to start (< 24)", tran_pos) else: - log.debug("compliance_config: channel block not present in cfg (len=%d)", len(data)) + log.warning("compliance_config: channel block not present in cfg (len=%d)", len(data)) except Exception as exc: log.warning("compliance_config: channel block extraction failed: %s", exc)