fix(minimateplus): read a MiniMate's settings by position, not the 'anchor' (#48)

The legacy SUB 1A decode found the record mode, sample rate, histogram
interval and record time by searching for be 80 00 00 00 00, believed a
stable anchor.  It is the block's [12:18]: the pre-trigger (-0.25 s) and
the stop mode (Fixed).  A unit in Auto stop mode, or with another
pre-trigger, has no such bytes, and all four read None -- in connect()'s
legacy routes (/device/info without a serial, the legacy event download's
sample rate).  The serial-routed settings path already read by position.

The block is now found by its own length field N = 2090 (08 2a, at
unescaped[12] on every recorded reply) and read by position, Series IV's
0x1A layout.

It never struck: every DL2 event file's setup copy has stop mode Fixed,
70,041 / 70,041, and Blastware's reports agree (7,631 / 7,631).
Tested on recorded replies patched to Auto stop and to a -0.5 s
pre-trigger (8 new tests; the 7 existing ones unchanged); not yet on a
unit in Auto stop mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-12-01 01:08:36 -05:00
1 parent 621c836109
commit 71bd14156d
4 files changed
+90 -35

No files matched your search

+10 -1
View File
@@ -225,6 +225,9 @@ Read this first when picking the project back up.
are re-rendered by keypad saves and are not identifiers.
⚠ **`0x1A` reads the keypad's edit buffer live** — unsaved values show while
someone is in the menu; a discard reverts them.
✅ **Fixed 2026-12-01 (#48):** the legacy decode now finds the block by its
length field N = 2090 and reads by position; no DL2 event was ever recorded in
Auto stop mode (70,041 / 70,041 Fixed). Kept below as history:
🔶 **Possible Series III bug, inferred only:** S3's 6-byte "stable anchor"
`be 80 00 00 00 00` sits exactly where Series IV keeps pre-trigger (−0.25 s)
+ stop mode (Fixed). An S3 unit in Auto stop mode would then lose the
@@ -1660,6 +1663,12 @@ frame D's channel block (trigger_level_geo, alarm_level_geo, max_range_geo) unre
producing only ~1071 bytes instead of ~2126.
### SUB 1A — anchor search range
> ⚠ **RETRACTED 2026-12-01 (#48):** there is no stable anchor. `be 80 00 00 00 00`
> is the block's `[12:18]`: the pre-trigger (−0.25 s) and the stop mode (Fixed).
> `_decode_compliance_config_into()` now unescapes the reply, finds the block by
> its length field N = 2090 (`08 2a`, at unescaped[12]) and reads mode `[5]`,
> rate `[6:8]`, interval `[8:10]` and record time `[18:22]` by position. The text
> below is history.
`_decode_compliance_config_into()` locates fields via the **6-byte stable anchor**
`b'\xbe\x80\x00\x00\x00\x00'`. Search range is `cfg[0:150]`.
@@ -1731,7 +1740,7 @@ Do NOT use fixed absolute offsets for sample_rate or record_time.
| setup_name | ASCII, null-padded, in cfg body |
| project / client / operator / sensor_location | ASCII, label-value pairs |
**True stable anchor: `b'\xbe\x80\x00\x00\x00\x00'` (6-byte suffix), search `cfg[0:150]`.**
**True stable anchor: `b'\xbe\x80\x00\x00\x00\x00'` (6-byte suffix), search `cfg[0:150]`.** (⚠ Retracted 2026-12-01, #48: not a constant; see "SUB 1A — anchor search range".)
The old "10-byte anchor" `b'\x01\x2c\x00\x00\xbe\x80\x00\x00\x00\x00'` is partially variable:
bytes `\x01\x2c` = 300 (5-minute default histogram interval); changes when interval changes.