#!/usr/bin/env python3 """mm_config_diff.py — snapshot a Micromate's config blocks and diff them. **Read-only.** Sends only the five config reads plus POLL/SERIAL. It never writes, never erases, never starts or stops monitoring. Why it exists ------------- `docs/micromate_protocol_reference.md` has about a dozen fields read out of `SUB 0x1A` (2,103 bytes) and *nothing* out of `0x2C`, `0x2E`, `0x08` or `0x01`. They are fetched and undecoded. The method that mapped the Series III config was a diff loop: change exactly one setting, re-read, see which bytes moved. This is that loop for Series IV. The one thing that loop needs first ----------------------------------- **Which bytes move on their own.** A config block read twice, thirty seconds apart, with nothing touched, is not byte-identical — it carries a clock, a free -memory figure and at least one counter. Diff two snapshots taken either side of a setting change and those bytes show up alongside the real answer, and there is no way to tell which is which from a single pair. So `volatile` runs first: N reads back to back, nothing changed, and every byte that differs is recorded as noise. `diff` then reports the two sets separately. Without that baseline a diff is suggestive; with it, it is evidence. Usage ----- # establish the noise floor FIRST -- nothing touched between reads python3 scratch/mm_config_diff.py /dev/ttyACM0 volatile -n 4 # baseline, then change ONE setting on the unit's keypad, then: python3 scratch/mm_config_diff.py /dev/ttyACM0 snap before python3 scratch/mm_config_diff.py /dev/ttyACM0 snap after-rectime-4s python3 scratch/mm_config_diff.py /dev/ttyACM0 diff before after-rectime-4s Snapshots live in `scratch/mm_config_snaps//