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
2.1 KiB
2.1 KiB