Commit Graph
2 Commits
Author SHA1 Message Date
serversdownandClaude Opus 5.5 5ba72740dd feat(codec): one settings codec for both series, on the shared layout
micromate/setup_fields.py: the fields an operator can change (record
mode, sample rate, interval, record time, geophone trigger, Series 3's
range and -- read-only until benched -- alarm, job number and its report
flag, the four notes by slot), the units' own limits from Instantel's
manuals, field-only byte patching (bit fields bit by bit; Series 3's
[26:28] as Blastware writes it; Series 4's CRC recomputed), the
read-back verdict compared by bytes, and the preview revision.

All 11 Blastware compliance writes reproduce from the block before them
(BE11529's first also shows Blastware re-rendering two mic levels
through its dB value; SFM echoes the unit's bytes); Series 4 keypad
fixtures reproduce pairwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 21:33:01 -05:00
serversdownandClaude Opus 5.5 b3aff4ed66 feat(micromate): get_setup() -- the setup block decoded, checksum-verified, and read off a real unit
MicromateClient.get_setup() reads SUB 0x1A once and returns a MicromateSetup:
record mode, sample rate, histogram interval, pre-trigger, stop mode, record
time, auto-stop, active sensors, trigger sources, the three geophone trigger
levels, mic type and (linear) mic trigger, job number, scaled distance, and
the four notes.  MEASURED FIELDS ONLY -- everything graded inferred or
unknown in the reference stays in .raw.

micromate/setup_block.py holds the decode as pure functions (no I/O), plus
crc_ok(): one checksum rule for 0x1A, 0x08 and 0x2E.  A failed checksum
raises SetupChecksumError (a ProtocolError) unless verify=False; a short
block raises either way.

Two things the decoder gets right that a naive one would not:
- the mic comes from channel block 4 (the ACTIVE mic), never blocks 5/6,
  which hold the stored settings of whichever mic is NOT fitted;
- distance and charge weight convert back with the unit's own 3.2808 and
  2.21, so 45 lb entered on the unit reads 45.0, not 44.89.

TESTS: 69 new.  15 real fixtures (2,103 B each) -- 14 UM20147 reads from the
10-17/10-19 keypad passes, chosen so every field takes at least two values,
plus UM12947's read from Thor's 9-24 capture (other firmware line).
Expected values are what the operator read off the unit's screen, never the
decoder's own output.  Fixtures force-added, per the tests/fixtures/
convention.  Full suite 541 passed; the 16 pre-existing failures
(test_bw_ascii_report.py 15, test_event_file_io.py 1) are unchanged.

VERIFIED ON HARDWARE: bridges/mm_client_check.py now prints the decoded
setup; against UM20147 every line matched the unit's screen (Brian, 10-19).

Also: the scratch harness uses the library checksum and checks all three
blocks; mm_client_check's stale labels fixed (0x06 content[4:8] is the
likely monitor-log count, not "unexplained"; 11.0BD is no longer "the first
one this code has met").

No codec, store or DB change; no backfill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-19 18:20:25 -04:00