dfc5aefef720219dd640a8e5e68d8adfdf803f2b
585
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dfc5aefef7 |
fix(histogram_codec): read multi-interval blocks big-endian from byte 5, mic on and off (#47, #49)
Measured 2026-10-26. A sub-minute histogram block is [00][segment][ctr LE][0a] (5 bytes), then one record per interval of BIG-endian peak / half-period pairs per channel, then 0000 and one more word, then a 7-byte trailer. A record is 20 bytes with the mic and 16 without (4 x channels + 4); the standard 32-byte block is the same thing holding one record. The last block is short, not padded: it holds only the intervals recorded and ends on 9c 06 00 42. #47: a mic-off histogram (16-byte records) decoded to nothing, so a Blastware import carried no histogram data and SFM's download check would refuse it. BE9441's K441LTOK.QZ0 (2 s, 22 intervals; fixture) now matches its Blastware export on 66/66 peaks and 66/66 frequencies. #49: the old reader took the mic-on records as little-endian from byte 6 -- the same bytes shifted by one, identical while every high byte is zero. It also required byte 5 to be 0 (the first record's Tran peak high byte) and read the last block at full stride, trimming what it overran. Regression over every DL2 histogram with a Blastware ASCII export (13,089 files, interval counts + every geo peak, frequency and mic dB): old reader 13,087 exact, new 13,089. The two the old one got wrong were one interval each: K440KZP4.560H #4764 (Long half-period 1 read as 257, mic peak 389 as 133) and M462KZUD.6R0H #145 (mic peak 6 read as 262). Walk: blocks follow by block_ctr + 1, or the next segment every 256 blocks; the last block is bounded by its terminal tail; with no terminal tail the old trimming rule remains as the fallback. Mic-off records give m_peak None and an empty MicL channel, as a mic-off waveform does. Inferred, not yet seen in a file: mic-off 1-minute (28-byte) and 15 s / 5 s mic-off strides. Not fixed here, noted on #47: half_period_to_hz assumes 1024 sps (512/hp); the 2048-sps histogram's frequencies are 1024/hp. Operational: a decoder change -- needs a TOOL_VERSION bump at release, then backfill_sidecars.py + backfill_event_shape.py (~2 h on the NAS) to regenerate stored histograms. No schema change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 |
||
|
|
6690434ecf |
docs(changelog): Micromate .h5 samples on Thor's own LSB (#42)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a5373deae7 |
merge: Thor .h5 samples on Thor's own LSB -- issue #42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e506bcff9b |
fix(sfm): Thor .h5 samples use Thor's LSB, not the MiniMate count scale (#42)
Every idf-import .h5 converted Thor's raw geo counts with the MiniMate body-codec scale, full_scale / _GEO_INT16_FS. A Thor count is 0.000310308 in/s (micromate.idf_file._GEO_LSB_IPS), so the float samples disagreed with the event's own peak by a constant: 10/32768 (until |
||
|
|
618fcb7770 |
docs(changelog): Series-4 config decoding -- get_setup(), the 0x1A map, and one checksum rule
Folded into the existing Unreleased sections. Added: MicromateClient.get_setup() (verified line by line against UM20147's screen), micromate.setup_block.crc_ok() for 0x1A/0x08/0x2E, the config diff harness, and the decoded setup in mm_client_check. Changed: the 0x1A field map; channel blocks 4/5/6 are the active mic and two stored mic setups; 0x1A reads the edit buffer and a load replaces it byte-for-byte; the unit's own conversion constants (3.2808, 2.21); 0x08 is preferences; the geophone scale confirmed from the unit's config; the 0x1C sub-second tick; the never-write-modem-baud rule; two corrected 16-byte slips; and the Series III anchor hypothesis, flagged inferred with no code change. Fixed: the watcher overwriting previous sessions, and two stale bench-tool labels. Migration stays None -- additive modules only, no codec/store/DB change, no TOOL_VERSION bump, no backfill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 |
||
|
|
fa017b0ee7 |
merge: Series-4 config decoding -- the setup block mapped from the keypad, and get_setup()
Closes the gap the 10-13 recap named: config blocks were fetched but barely read. Two keypad passes on UM20147 (10-17, 10-19), every byte that moved attributed to a setting the operator named, then the map turned into code. 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, trigger levels, mic type and level, job number, scaled distance, notes. Measured fields only. Every value matched UM20147's screen. Findings that shape what comes next: 1. ONE CHECKSUM RULE (CRC-16/AUG-CCITT) covers 0x1A, 0x08 and 0x2E -- a free integrity check on every config read. Thor's write omits it; the unit computes it, so it is not a write obligation. 2. LOADING A SETUP REPLACES THE ACTIVE CONFIG BYTE-FOR-BYTE, and 0x1A reads the keypad's edit buffer live. The name is the only link between a file and its contents, and even its spelling varies (.MMB / .mmb). 3. THE SIX CHANNEL BLOCKS ARE 3 GEOPHONES + THE ACTIVE MIC + TWO STORED MIC SETUPS. Read the mic from block 4 only. 4. THE UNIT CONVERTS UNITS WITH ITS OWN CONSTANTS (ft / 3.2808, lb / 2.21). Convert back with them or 45 lb reads 44.89. 5. 0x08 IS THE PREFERENCES BLOCK; display units live there and never touch the stored setup values. 6. NEVER WRITE MODEM BAUD OR MODEM TYPE REMOTELY -- the remote link is the modem port. INFERRED, Series III, no code changed: S3's 6-byte "stable anchor" sits where Series IV keeps pre-trigger + stop mode, so an S3 unit in Auto stop mode may lose it. One Blastware capture in Auto mode settles it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 |
||
|
|
6bd45b56ec |
docs(claude): get_setup() exists -- the checksum is wired in, not pending
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 |
||
|
|
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 |
||
|
|
a74d3c9b00 |
docs(series4): loading a setup is an exact replacement -- plus the prefs block, a checksum rule, and the firmware's own unit constants
23 more snapshots of UM20147, keypad-driven. MEASURED: loading a .MMB replaces the active config byte-for-byte -- three loads, each moving exactly the fields that differ, the loaded block identical to the file's saved state, no load marker. The setup name's spelling (.MMB/.mmb) depends on whether it was saved or loaded. MEASURED: job number [40:42], report flags [39] (0x02 job no., 0x08 scaled distance; 0x01 unknown); distance [30:34] in metres and charge weight [34:38] in kg, converted bit-exactly with ft / 3.2808 and lb / 2.21 -- the firmware's own constants, not the textbook ones. Scaled distance is not stored. Location confirmed at [144]. MEASURED: 0x08 is the preferences block (display units at content[31]), not an event index; switching units moves nothing in 0x1A. 0x1A, 0x08 and 0x2E share one checksum rule (N = content[0:2]; CRC over [0:N-2] at [N:N+2]); 0x2C has none. 0x2C session timeout is at [118:120], encoding unknown; modem baud is in none of the six blocks. CORRECTED IN PLACE: the 9-24 notes-label offset (0x8A -> 0x7A) and channel-block start (0x06BC -> 0x06AC), both 16-byte slips. RULE: never write modem baud or modem type remotely -- the remote link is the modem port. 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 |
||
|
|
7c010e42a4 |
docs(claude): leave the next config step written down -- load a setup and diff it
Brian's hypothesis from the end of the 10-17 pass: selecting a .MMB repopulates the active config, so a single load moves every field that differs between two setups -- a check of the whole map in one step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 |
||
|
|
56b8aac4cb |
docs(series4): the 0x1A field map from a keypad pass -- a CRC, an edit buffer, and three mic blocks that are not channels
47 snapshots of UM20147 while settings were changed on its own keypad, one at a time. Every byte that moved is accounted for; nothing outside 0x1A moved. MEASURED (operator named setting + values): record mode [5] (01 Waveform, 02 Manual, 03 Histogram, 04 Combo -- S3's encoding, one byte later than the S3 analogy put it), sample rate [6:8], histogram interval [8:10] s, pre-trigger [12:16] f32 negative s (all four values), stop mode [17], record time [18:22] f32, auto-stop [23], active-sensor and trigger-source bitmasks [25]/[29], trigger level at channel +30 (geo in/s, mic psi). MEASURED: the trailer is CRC-16/AUG-CCITT over content[0:2088] -- 47/47 and a second unit. Thor's write omits it, so it is read-side integrity, not a write obligation. MEASURED: blocks 1-3 are geophones, block 4 is the ACTIVE mic (a byte copy of 5 or 6), 5 and 6 are the stored linear / SLM mic setups. No separate mic-type byte; block 4's +4:8 code is the type. Promotes the 10-15 "+4 channel type" guess; retracts "+46:48 is a trigger-source flag" in place. MEASURED: 0x1A reads the keypad's edit buffer live; discard reverts; commit timing differs by widget (list / spinner / sub-window). INFERRED, Series III: the 6-byte "stable anchor" sits exactly where Series IV keeps pre-trigger (-0.25 s) + stop mode (Fixed). An S3 unit in Auto stop mode would lose it and decode no mode/rate/interval/record time. Not measured on S3; noted in instantel_protocol_reference.md, code untouched. 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 |
||
|
|
75cbe23214 |
fix(micromate): config watcher no longer overwrites the previous session -- and checks the 0x1A CRC
`watch` saved every session as `watch-000..NNN`, so each run silently overwrote the last. Harmless while those snapshots were clock ticks; data loss once they were findings. Labels now default to `watch-MMDD-HHMM-NNN` (`--prefix` overrides). Each 0x1A change also prints its trailer check: CRC-16/AUG-CCITT over content[0:2088], stored BE at content[2090:2092]. Measured on 47/47 snapshots of UM20147 plus UM12947's 9-24 capture; a mismatch means a short or corrupt read, or a layout this does not assume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 |
||
|
|
ba021df6b2 |
docs(claude): say where config decoding actually stands -- set up, waiting on a keypad press
"Where things stand" said config decoding "needs a bench session varying one setting at a time -- not desk work", which was true when written and now sends a reader off to build tooling that exists. This is the same staleness that had the file claiming micromate/ had no live client. What it now says, because these are the things that cost time to rediscover: - The harness is scratch/mm_config_diff.py and the baseline is already captured. - THE METHOD IS VERIFIED VIABLE: all five config blocks are bit-stable, so any byte differing between two snapshots IS the setting. That was the open question about whether the Series III approach transfers at all. - Start with SAMPLE RATE. A large distinctive power of two pins endianness in one shot; a boolean toggle moves one byte 0 -> 1 and teaches nothing. - The keypad works. No Windows VM, no contending for the modem's single TCP session. - `sg dialout -c` is required to open /dev/ttyACM0, because the group membership exists in /etc/group but not in shells started before it was added -- AND THE FAILURE LOOKS LIKE A DEAD UNIT, which is worth a line on its own. - watch-001..005 on disk are clock ticks, not findings. - channel+24 = 3.1030800342559814, independently confirming _GEO_LSB_IPS to 1.1e-8 and 32,226.05 counts exactly. - The rest of that channel map is GRADED and the grades are load-bearing: +4 "channel type" and the +8:24 uint16 split are single-setup guesses, recorded as guesses on purpose. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
66171ffe36 |
docs(series4): the 0x1A channel blocks -- graded, because one of these is strong
and two are guesses
Six 48-byte channel blocks at content[1708], stride exactly 48: Tran, Vert,
Long, Mic, LMic, SMic. (Mic is 3 chars, so a 4+-printable scan misses it and
the stride looks like 96 across that gap.)
RECORDED IN THREE EXPLICIT GRADES, because I wrote them in one voice first and
that is the failure mode this reference already carries retractions for -- the
0x0C float from a single sample, the cost model fitted to sub-1 KB responses,
offset detector v1. All three were an interpretation presented with the
confidence of a measurement.
MEASURED, and the one worth having: channel+24 is a float32 BE reading
3.1030800342559814 on all three geo channels. Divided by 10,000 that is
0.00031030800342559815 -- the documented _GEO_LSB_IPS to 1.1e-8. It implies
10.0/3.10308 = 3.222605 V full scale, which at 10,000 counts/V gives 32226.05
counts, the documented figure exactly.
That is an INDEPENDENT confirmation of a number that until now rested purely on
statistical inference: _GEO_LSB_IPS was pinned by intersecting 991,415 rounding
constraints from Thor's own CSV exports. The unit reports it directly. Two
unrelated derivations agreeing to eight digits. It is also almost exactly half
Series III's 6.206053 (ratio 1.99997, the residual being S3's rounded display
value).
Also measured: the units strings ("in."/"/s.", "psi"/"(L)", "dB"/"(A)") are
literal ASCII, and Tran/Vert/Long are byte-identical EXCEPT +47, which reads
0x01 on Tran and Vert and 0x00 on Long.
INFERRED (one setup, one unit): that +24 is the calibration constant rather than
another field holding the same number -- the arithmetic proves the number, not
the field's purpose; and that +47 is an enable or trigger-source flag.
GUESSED, explicitly flagged not to build on: +4 as a uint32 "channel type", from
six correlated observations in a single setup; and +8:24 as eight uint16 BE
values, where the split itself is an assumption.
TOOLING FIX in the same commit, from a real miss: the volatile baseline ran four
reads over eight seconds, so it never crossed a minute boundary and never saw
the minutes byte. Five "changes" then came in a row that were just the clock.
Hours and the date would have slipped through identically. An empirical noise
floor only catches what moves WHILE sampling, so 0x1C's known clock span
(content[2:10]) is now seeded regardless, and the report says which bytes were
observed versus seeded. Memory-free is deliberately left unmasked -- it moves
only when the unit records, which is worth being told about.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
|
||
|
|
711277131a |
feat(micromate): a config diff harness -- and the blocks turn out to be bit-stable
The Series III config map was built by changing one setting and seeing which bytes moved. Whether that method transfers to Series IV depended on an unmeasured question: how much of a config block moves ON ITS OWN. If a block carries a clock or a counter, every diff arrives polluted and there is no way to tell the real answer from the noise in a single pair. MEASURED ON UM20147 (11.0BD), FOUR READS BACK TO BACK, NOTHING TOUCHED: 0x1A compliance 2103 B 0 bytes moved 0x2C call home 137 B 0 0x2E trigger 39 B 0 0x08 event index 101 B 0 0x01 device info 163 B 0 0x1C monitor status 59 B 2 (and those two are explained below) Every config block held every byte still, so the method transfers directly and needs no noise floor subtracted. That was the open question. scratch/mm_config_diff.py drives it: `volatile` establishes the floor, `snap` saves a labelled read of all five blocks, `diff` reports changed runs with each plausible field interpretation (u8/u16be/u32be/f32be) and reports any volatile bytes separately rather than silently hiding them. CORRECTION TO content[6] OF 0x1C, long recorded only as "NOT the hour": it is a sub-second tick, ~4020 counts/second in steps of exactly 4, wrapping at 256 -- about a 64 ms period, consistent with the low 6 bits of a millisecond counter. Consequence worth knowing: a 0x1C block is never byte-identical to itself, so any "has the status block changed?" check answers yes ~15 times a second. Compare named fields, never whole blocks. I nearly recorded that byte wrong, and the trap is cheap enough to document: sampled once per second it reads as a smooth monotonic counter at ~16/s with a 16-second wrap. Twelve consecutive samples supported it. It is aliasing -- a 64 ms counter read once a second is noise that happens to look tidy. Measure a counter back to back before trusting any rate from spaced samples. Also: the settings do not have to be changed from THOR. The unit's own keypad works, which needs no Windows VM and does not contend for the modem's single TCP session. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
4c29820831 |
docs(changelog): the Series-4 call-home session, and two more corrections
Folded into the existing Unreleased sections. Added: bridges/mm_ach_server.py, flagged as implementing the listener path only. Changed: the captured ACH session (101 frames, every command already implemented bar one); the two call-home paths and what decides between them; the 0xA2 collision with series III's CONFIRM ERASE; monitor-while-calling-home blocking erase while THOR reports success; THOR rewriting unit IPs from the call-home source; and the CLAUDE.md refresh. Fixed: mm_client_check misreporting its own request count, the ACH server buffering its output and leaving modem chatter as a hex dump, and .gitignore missing capture artefacts beside tracked bridge source. TWO ENTRIES CORRECT THIS FILE'S OWN EARLIER TEXT, which is the part worth reading: 0x06 content[4:8] was recorded here as "a constant, 9 on both units" and is the monitor-log count; SUB 0x49 was recorded as two states and has three. Migration stays None -- no codec, store, DB or schema change and no TOOL_VERSION bump -- but the note now says explicitly that THE 0xA2 COLLISION IS DOCUMENTATION RATHER THAN A FIX. minimateplus can already send 0xA2 as the last step of its erase sequence, and nothing yet stops a future shared path confusing the two meanings. A guard is outstanding, and a reader deciding whether this release is safe deserves to know that. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
8b48b3f42b |
merge: the Series-4 call-home session, captured end to end
Closes the last protocol unknown. A MITM between UM12947's modem and THOR 1.5.0.29 captured a complete working ACH session: 101 request frames, 101 responses, 0 bad checksums, 34,872 B of event data in 65 seconds. EVERY COMMAND IN A REAL ACH SESSION IS ONE micromate/protocol.py ALREADY IMPLEMENTS -- POLL, BULK_DOWNLOAD, STATE, EVENT_RECORD, EVENT_NEXT, STORAGE_RANGE, MONITOR_STATUS, ARM_EVENT, SERIAL, EVENT_FIRST -- bar one. Three findings that change how a receiver must be built: 1. CALL-HOME HAS TWO PATHS, decided by who holds the modem's single TCP session. If something is already connected, the unit's RADIO RING travels up THAT connection; if nothing is, the modem dials out to a listener. THOR's UnitWatchDogTimer reconnects continuously, so THOR usually holds the slot -- which is why probes and relays saw "connected, no reply" all afternoon. That was contention, not a fault. 2. SUB 0xA2 ENDS A CALL-HOME ON SERIES IV AND IS CONFIRM ERASE ON SERIES III. Same opcode, same 0x5D response, opposite consequence. minimateplus and micromate already share a transport, so any shared path must dispatch on series before that byte reaches a wire. This is a hazard in code that already ships, which is the main reason this merge should not wait. 3. "MONITOR WHILE CALLING HOME" SILENTLY BLOCKS ERASE, and THOR reports the session successful anyway. A receiver therefore cannot rely on erase to manage storage -- the server-side high-water mark is load-bearing, and the condition is detectable from event count plus free memory on every call. Two corrections to entries made earlier this month: 0x06 content[4:8] is the monitor-log count rather than a constant, and SUB 0x49 has a third state (0x03, in-call-home) which is why that flag is tested for non-zero. bridges/mm_ach_server.py implements the LISTENER path only and says so; the poller half -- holding outbound connections and watching for the ring -- is the next piece of work. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
9c8eb5c5b8 |
docs(claude): refresh "Where things stand" -- it claimed there was no live client
Stale since 2026-09-26, and wrong in two ways that matter to anyone picking the project up: - "micromate/ still has no live client -- it is codec-only." There has been a full client since 2026-10-02: framing/protocol/client + models, 119 tests, verified on hardware across both firmware lines and both transports. - "the inbound call-home session is the only protocol unknown left." It was captured end to end on 2026-10-14. There are no protocol unknowns left. Replaced with the current state, and added the three things a reader most needs up front: that ACH has TWO paths decided by who holds the modem's single session (so silence from a probe is usually contention with THOR, not a fault); that 0xA2 ends a call-home on series IV and CONFIRMS ERASE on series III across a shared transport; and that monitor-while-calling-home blocks erase while THOR calls the session a success, which makes the server-side high-water mark load-bearing. Also named the real remaining gap honestly: config decoding, not protocol. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
7645c91ae2 |
docs(series4): monitor-while-calling-home blocks erase, and THOR calls it success
Manual 11.4.4: a Micromate can call home WHILE IT CONTINUES TO MONITOR, or pause monitoring and send. UM12947 is on the former, which is why the captured session logged "CANNOT DOWNLOAD MONITOR LOG" and "CANNOT DELETE ALL EVENTS -- The unit is monitoring". THOR REPORTS THAT SESSION AS "SESSION COMPLETED SECCESSFULLY" ANYWAY. The refusals are INFO lines. From outside, a unit quietly accumulating looks identical to one being managed correctly. Correcting my own framing from earlier today: I flagged "Delete Events and Logs from Unit = Yes" as a risk to the test data. It is TMI's normal and necessary fleet setting -- without it a unit fills up and re-offers every event on every call. A unit left on monitor-while-calling-home is the misconfigured one, and drifts toward a full buffer by itself. DESIGN CONSEQUENCE FOR SFM: a receiver cannot rely on erase to manage storage. The erase can fail for a reason the unit considers normal, so the server-side high-water mark is LOAD-BEARING rather than an optimisation -- it is the only thing preventing a full re-download every session. Series III's ach_state.json (downloaded_keys / max_downloaded_key) is the pattern and has to carry over deliberately. Also a detectable fleet-health signal: "memory filling AND deletes refused" is visible on every call from 0x06's event count and 0x1C's memory fields. Worth surfacing precisely because THOR calls it success. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
08d2d31a09 |
docs(series4): a complete ACH session captured -- and 0xA2 is a loaded gun
MITM between UM12947's modem and THOR 1.5.0.29: 101 request frames, 101 responses, 0 bad checksums, 34,872 B of event data in 65 seconds. EVERY COMMAND IN A REAL ACH SESSION IS ONE WE ALREADY IMPLEMENT -- POLL, SERIAL, STORAGE_RANGE, MONITOR_STATUS, STATE, ARM_EVENT, EVENT_FIRST/NEXT, EVENT_RECORD, BULK_DOWNLOAD -- except one. SUB 0xA2 ENDS A CALL-HOME, AND COLLIDES WITH SERIES III'S ERASE. The session's final command is 0xA2 at offset 0xFFFF, answered 0x5D, and THOR's log at that instant reads "StartMonitoringAfterCallhome / Switching unit back to monitoring". So on series IV it means exit call-home and resume monitoring. On SERIES III, 0xA2 -> 0x5D is CONFIRM ERASE -- the last step of 0xA3/0x1C/0x06/0xA2, after which the unit's memory is cleared. Same opcode, same response SUB, opposite consequence. This is the most dangerous collision found in this protocol: minimateplus and micromate already share a transport, and sending 0xA2 to a MiniMate Plus to "end a session" erases it. Any shared path must dispatch on series before that byte goes near a wire. It also corroborates the firmware string found by static analysis in September, CMD_EXIT_CALL_HOME_DELETE_EVENTS_START_MONITORING. TWO CORRECTIONS TO EARLIER ENTRIES OF MINE: - 0x06 content[4:8] was recorded on 2026-10-01 as "9 on both units regardless of count -- a constant, not a count". It reads 47 here, where THOR's log twelve minutes earlier reported "Monitor Log count: 45" on the same unit. It is almost certainly the monitor-log count; both units reading 9 just meant both held 9 records. - SUB 0x49 was recorded as 0x00 idle / 0x02 monitoring. It reads 0x03 throughout this session, ten for ten -- a distinct in-call-home state. Precisely why the rule is "test for non-zero": a client checking == 0x02 would call a unit mid-call-home idle. Also softened the claim that mm_ach_server is "built on the wrong model". ListenerAchTcp HAS now accepted a connection -- when nothing else holds the modem's single session, the unit dials out and the listener takes it; when THOR already holds a connection, the ring rides that instead. Both paths are real. The listener model is valid, it just loses the race against anything already connected -- which explains every failed probe and relay attempt today as contention rather than bugs. And noted: THOR rewrites a unit's stored IP from the call-home source address, so a relay silently poisons THOR's record of where that unit lives. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
8f67608e0f |
feat(micromate): answer a RADIO RING the way THOR does -- SERIAL, immediately
THOR's ACH log exposed two differences between what it does on seeing a ring and
what we were doing, and either could explain why the unit never answered us:
| ours | THOR
command | POLL (0x5B) | ReadSerialNumber (0x15)
delay | 8 s (grace window)| 36 ms
We sat silent for the whole grace window and then asked a different question.
The unit may well have given up long before we spoke.
So the grace window now ENDS THE MOMENT a RING is seen, and the ring is answered
with SERIAL first -- which is THOR identifying which unit rang before doing
anything else. The push-vs-pull experiment the window was built for is
unaffected: silence still runs the full duration.
This does not change the bigger finding that mm_ach_server is built on the wrong
model for a PAD-connected unit -- THOR's working path is a POLLER holding an
outbound connection, not a listener. But if a unit whose modem dials out can be
made to answer on the inbound path too, that is worth knowing before the rewrite,
and it costs two small changes to find out.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
|
||
|
|
90ac7ff76a |
docs(series4): SOLVED -- call-home is an in-band wake signal, not a dial-out
From THOR's own ACH log, 4,414 lines, UM12947 over an RX55. This overturns the model this document has carried from the start and explains every confusing result of the past weeks. A MICROMATE DOES NOT DIAL ANYBODY. It emits the ASCII string "RADIO RING" over its serial port, and that text travels up a TCP connection THE SERVER ALREADY HAS OPEN TO THE UNIT. The server recognises it and runs a session on that same connection. 17:18:17 TcpClientSystemNet #1: RADIO RING IS RECEIVED FROM IP:63.45.161.30 Port:9034 17:18:17 ListenerAchRadioRing #2 RADIO RING IS DETECTED 17:18:17 ConnectorWorkerThread Process Request: ReadSerialNumber 17:18:18 ListenerAchRadioRing #3 RADIO RING UNIT SERIAL NUMBER = UM12947 17:18:18 ACHManager #8 RADIO RING STARTED A NEW SESSION TcpClientSystemNet is THOR's outbound TCP CLIENT -- the ring arrives on the connection THOR itself opened to unit:9034, the ordinary call-UP path. No inbound connection, no dial, nothing to accept. THOR keeps that connection alive on purpose: UnitWatchDogTimer reconnects continuously, 1,039 log lines in 37 minutes. THOR's OTHER ACH path was never used. ListenerAchTcp logs "Waiting for a ACH connection on Port 12346" and in 4,414 lines NEVER ACCEPTED ONE. All twelve ACH events came through ListenerAchRadioRing. CONSEQUENCE: bridges/mm_ach_server.py is built on the wrong model for this deployment. It listens for an inbound connection -- ListenerAchTcp's model, the one THOR never exercises here. The right shape is a POLLER that holds an outbound connection to each unit, watches the stream for RADIO RING, identifies the unit, and runs a session on the same socket. That also dissolves the single-session contention that dogged every experiment today: the receiver must hold the modem's one session slot PERMANENTLY. Our probes and MITM attempts were not fighting a bug, they were fighting the design. Also captured: the full ACH state machine (15 steps), the eight request types with counts, and two corroborations -- StartMonitoringAfterCallhome matches the firmware string found by static analysis in September, and ReadEventRecordCount returning "Event count: 19" independently supports the SUB 0x06 event-count finding. Flagged, unexplained: events are addressed as 90000001 (length 4076) in THOR's ACH path, where our chain walk returns 055d4a81 for an event of exactly that length. Same event, different address space. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
52d18b0d5d |
docs(series4): OBSERVED -- THOR's ACH side is POLL, byte-identical to ours
First capture of THOR's half of a Micromate call-home, taken with ach_mitm.py between UM12947's modem and a THOR 1.5.0.29 ACH server on port 8070. THOR sends POLL (SUB 0x5B, offset 0x0030) and NOTHING ELSE -- four times over ~21 s, then gives up. No greeting, no answer to the RADIO RING, no CONNECT. And that POLL is BYTE-IDENTICAL to what micromate.protocol builds: build_request(SUB_POLL, 0x0030) reproduces all four frames exactly. So the ACH session is PULL, and bridges/mm_ach_server.py already implements it correctly. The "inbound call-home session" -- carried for weeks as the last protocol unknown -- was never a separate protocol at all. It is the ordinary command set on an inbound socket, exactly as series III's 72 captured sessions suggested it would be. THE OPEN PROBLEM IS NOW CLEARLY ELSEWHERE. In the same capture the unit sent only "RADIO RING", four times, and never a protocol frame. THOR polled four times and got nothing -- identically to our own server in three attempts the same afternoon. THE VENDOR'S OWN SOFTWARE FAILS THE SAME WAY WE DO, which eliminates the receiver as a suspect and places the fault between modem and unit. Established: cellular healthy (151 ms connect, outbound dial works), bytes do reach us from the unit's side, modem serial config matches spec (115200 8N1, no flow control, PAD/TCP), cable is FTDI and cold-booted with it attached. Not established: whether the unit or the modem emits "RADIO RING" -- it is the literal string in this unit's own 0x2C dial-string field, and the cheap disambiguation is to disconnect the unit and see if it still appears. Next step is a config diff against a working deployed unit's modem, not more protocol work. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
fc0a7b2a88 |
chore: ignore capture artefacts beside the bridge scripts
A stale Windows checkout had ten March-era capture files staged as new and deleted from the working tree -- .bin/.log/.set artefacts in bridges/ and bridges/s3-bridge/ that .gitignore never covered, since it only had /bridges/captures/. Deliberately NOT ignoring /bridges/s3-bridge/ wholesale: proxy.py and s3_bridge.py live there and are tracked. Only the artefact extensions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
3fa2a4035e |
fix(micromate): the ACH server now names modem chatter, and flushes its output
Three things the first real call-in exposed. UM12947's modem dialled in at 14:16:56 from 63.45.161.30 -- the network path works -- and sent 60 bytes of "RADIO RING", space-padded and newline-separated, four times. 1. THAT IS MODEM CHATTER, NOT THE UNIT, and the server left it as a hex dump to interpret by hand. CLAUDE.md already records that an RV50/RV55 "sends \r\nRING\r\n\r\nCONNECT\r\n over TCP to the caller even with Quiet Mode enabled"; an RX55 on AirLink OS says RADIO RING instead. The server now recognises the known modem strings and says so. ⚠ The diagnostic value is in what was MISSING: four RINGs and NO CONNECT. RING means the modem is ringing the serial device, CONNECT means something answered. Rings without a connect, plus no answer to POLL, means TCP is fine and the unit is not on the other end of the serial link. The server now prints that conclusion and the three things to check -- cabled at all, cable chipset (FTDI/CDC-ACM only, never Prolific), and a cold boot with the cable attached, since the USB-A host port only enumerates at power-on. 2. STDOUT WAS BLOCK-BUFFERED. With output redirected, every print sat in a buffer, so the log read EMPTY while a call was in progress and the session was only discoverable on disk afterwards. For a tool whose whole job is to be watched during a one-shot event, that is close to useless. Line-buffered now. 3. THE DOCSTRING PROMISED SCANNERS LEAVE NO TRACE ON DISK, AND THEY DID. The failed-handshake path created a session directory unconditionally -- my own loopback sanity check produced one. Now a connection that sends nothing AND fails the handshake is discarded with no directory; one that sent something unprompted is always kept, because that is the interesting case. Also recorded in session.json: modem_chatter, ring_count and a diagnosis string, so a session can be triaged without re-reading the raw bytes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
67de2c18da |
fix(tooling): mm_client_check reported THOR's request count, not its own
The download line computed `size // 1024` -- THOR's chunk size -- while the download used the 16 KB default. So a 72,560 B event that took 5 requests was printed as "71 chunks", and I nearly read a working 16 KB download as a broken 1 KB one. A diagnostic that misreports what it did is worse than one that says nothing. Now prints the real count and the size used: "5 req @ 16384 B". Verified by counting the frames in a capture of that run: 5 x SUB 0x5A at offsets 0x4000 0x4000 0x4000 0x4000 0x1b70, summing to exactly 72,560. That is also the FIRST time the 16 KB chunk size has run through the real download loop on hardware -- previously only the probe had issued 16 KB single requests, and the loop itself had only been exercised at 1024 B against THOR's frames and at 16 KB against simulated responses. Also recorded: USB identification for the Micromate's own ports. Its PC port is 2504:0300 (Instantel Inc. MICROMATE COM PORT), appearing as CDC-ACM, against 0403 FTDI and 067b Prolific for the USB-A host-port cables. Address it by /dev/serial/by-id/ and not /dev/ttyACM<n>, because the number moves whenever another CDC-ACM device appears -- which has already cost a session aimed at a TMI-Seismo MCU by mistake. And: passing one through to a Proxmox guest hot-plugs with no VM restart via `qm set <vmid> -usb0 host=2504:0300`. UM20147 is now on tmi-dev (10.0.0.44) this way, which means the unit can be driven from the dev VM directly instead of relaying commands. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
bdf4909d2a |
docs(series4): no Micromate has ever been observed calling home
Correcting an implication I made. The 72 ach_inbound_* sessions in bridges/captures/ are MiniMate Plus, and I framed the Series III ACH setup as though it transfers to a Micromate. It is not known to. What we actually have for Series IV is prior, not observation: - THOR manual 6.2 and the firmware's own strings (CMD_EXIT_CALL_HOME_DELETE_EVENTS_START_MONITORING, "Call Home Deleting Events") say the unit dials in and waits to be told what to do -- server-driven, the same shape as Series III's pull model. - UM12947's 0x2C dial string reads literally "RADIO RING", which is modem ANSWER vocabulary rather than a destination. With the RV50 debug string ATQ1 ATE0 ATS0=2 ... RADIO RING -- ATS0=2 being auto-answer-after-2-rings -- that reads as the unit arranging to ACCEPT calls, i.e. the call-UP path. Which argues the ACH destination lives in the modem, as it does for series III. If both priors hold, mm_ach_server.py is just MicromateClient on an inbound socket and the unknown evaporates. But there is a specific failure mode worth naming in advance: THE MICROMATE DEMONSTRABLY TALKS AT TO ITS MODEM. If it drives an AT dial for call-home, that exchange happens on the SERIAL LINK and a TCP listener sees none of it. So the first experiment has an AMBIGUOUS NULL -- no connection could mean the trigger did not fire, or that the interesting part is invisible from the network. The escalation is a serial-level capture between unit and modem, not more fiddling with the server. Recorded in both the protocol reference and the server's own docstring, so whoever runs the experiment reads the caveat before being puzzled by a silence. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
4579896b6d |
feat(micromate): inbound ACH server -- and the push-vs-pull experiment
The inbound call-home session is the last unmapped part of the Series IV protocol, and it may well not be a separate protocol at all. Series III's answer, from the 72 ach_inbound_* sessions on disk, is that the unit DIALS IN AND THEN WAITS: ach_server.py accepts the socket, wraps it in SocketTransport -> MiniMateClient, runs the ordinary handshake and drives with the ordinary command set. If Series IV behaves the same way, this file is just MicromateClient attached to an inbound socket. THE ONE QUESTION THAT MATTERS IS PUSH VS PULL, and no packet capture can answer it -- you have to connect and keep quiet. So the server says NOTHING for --grace seconds after accepting. Bytes in that window mean the unit speaks first, and it reports the hex, the ASCII, and whether they parse as a response frame (series III sends an "Operating System" banner on cold boot, so a banner is the likely shape). Silence means pull, and the normal handshake follows. READ-ONLY, and deliberately more so than its series III sibling: that one has "rescue actions" that stop monitoring and disable ACH on a runaway unit, and those are absent here. No command has ever been originated against a unit by this project, and an inbound session is the worst place to break that. --depth defaults to walking the event chain WITHOUT downloading. Captures land as raw_bw_*/raw_s3_* so scratch/mm_frame_parse.py reads the pair with no arguments, plus a session.json recording what was learned -- including the push flag, which is the result worth keeping. The session directory is created only after the handshake succeeds, so a port scanner leaves nothing on disk. Smoke-tested both paths against a fake unit that dials in: PULL detected over silence and driven to a full chain walk (33 frames, 0 bad checksums, parses with the existing tool), and PUSH detected from a 10-byte banner with the frame-parse attempt reported honestly as "none parsed". Worth recording for the setup: for series III the call-home DESTINATION lived in the MODEM's config (ACEmanager), not in the seismograph. If that holds for the RX55 then nothing on the instrument needs changing, which keeps the no-writes line intact. If it has to come from the unit, its 0x2C block holds a 40-byte dial string -- and writing that is THOR's job, not ours. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
263daa0f96 |
docs(changelog): the Series-4 event chain, and two corrections to this file
Folded into the existing Unreleased sections. Added: the event chain (list_events / iter_events / download_event / get_event / decode_error) with the 74-frame replay test behind it, the per-event PVS decode self-check, and 0x06 as the event count. Changed: 16,384 B per request with the byte-driven loop the silent clamp forces; the retraction of the 0x5A streaming mode; and the hardware verification across both firmware lines and transports, including that event keys collide across units. Fixed: the 64 KB download cap, and the probe's own control being circular. TWO OF THESE CORRECT THIS FILE'S OWN EARLIER ENTRY, which is the part worth reading: - The previous entry stated "~0.65 s per round trip, regardless of payload" and drew the advice "minimise round trips, not bytes". Measured against a 14 KB response, cost is ~0.21 s + bytes/2,350. Every sample behind the old claim was under 1 KB, so the byte term was small and uniform and per-command cost looked constant -- a narrow-range fit extrapolated past its evidence. The advice now splits: status work is round-trip bound, downloads are throughput bound, and the 16 KB chunk size is a ~30% win rather than 14x. - The previous Migration note said nothing under micromate/ was touched, which the preceding merge had already made false; this merge changes the download loop as well. Still Migration: None -- no codec, store, DB or TOOL_VERSION change, and no shipped path calls the loop that changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
4a11eadc91 |
merge: the Series-4 event chain, a 64 KB cap closed, and a cost model corrected
Step 4 of docs/micromate_client_spec.md plus what measuring it turned up. Read-only throughout; still nothing in this project has ever originated a command against a unit. The event chain: MicromateEventRef, list_events(), iter_events(), download_event(), get_event() and decode_error(). The load-bearing test replays THOR's captured six-event session and asserts every byte we emit matches its 74 frames, while decoding all six events and cross-checking each waveform's peak vector sum against the float the device computed itself. Three things hardware found that captures could not: 1. A 64 KB DOWNLOAD CAP, one event away from biting. The 0x5A chunk offset was a uint16 because every offset THOR sends fits in two bytes; UM20147 holds a 72,560-byte event. params[0:4] is one 4-byte field (chunk 0 puts the key there), so a uint32 is byte-identical below 65,536 and reaches past it. Confirmed on the unit: 71 chunks, exact size. This is the Series III 64 KB page-boundary bug wearing a different hat, and that one is still open. 2. NO 0x5A STREAMING MODE -- retracted. The offset field is simply a byte count and the device returns offset + 11 bytes in one frame. But the probe that killed the hypothesis showed 1024 B is THOR's choice, not the device's limit: the ceiling is 16,384, and above it the device CLAMPS SILENTLY with correct bytes and no error. That is why the download loop now tracks its offset by bytes received rather than striding by chunk index. 3. CELLULAR COST IS NOT INDEPENDENT OF PAYLOAD. I had it as ~0.65 s per round trip regardless of size and built design advice on it. Measured against a 14,176 B response: t ~ 0.21 s + bytes/2,350. The old figure was right for a 1 KB response and was a narrow-range fit extrapolated past its evidence -- every sample behind it was under 1 KB. Status work is round-trip bound; downloads are throughput bound, so 16 KB chunks save ~30%, not 14x. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
338ce4fea7 |
docs(series4): CORRECTED -- cellular cost is NOT independent of payload
I had it as "~0.65 s per round trip, independent of payload size", and based
design advice on it ("minimise round trips, not bytes"). The first claim is
wrong and the second is too strong.
Every measurement behind it had a SMALL payload -- 59 B status, 266 B setup
records, 1024 B download chunks. With the byte term small and similar across all
of them, per-command cost looked constant. It was a narrow-range fit
extrapolated past its evidence.
Measured against a 14,176 B single response on UM12947 over an RX55:
1,024 B 0.67 s 8,192 B 3.59 s
2,048 B 1.22 s 14,176 B 6.25 s
4,096 B 2.13 s
t ~ 0.21 s + bytes / 2,350 -- fits within +/-11% over a 14x size range
The old 0.65 s figure was right FOR A 1 KB RESPONSE and is that model evaluated
at 1 KB. Round trips still cost (0.21 s each; 24 of them for a setup walk is
still 16 s), but bytes cost more than round trips on anything over ~500 B, and
that reverses the advice: for STATUS work minimise commands, for DOWNLOADS the
floor is throughput and batching does not beat it.
So the 16 KB chunk size is a ~30% win, not 14x. UM20147's 72,560-byte event is
~46 s at THOR's 1024 B and ~32 s at 16,384 B, because ~31 s of it is bytes on the
wire. Still worth keeping -- 30% faster, and 14x fewer requests is 14x fewer
chances for a link to drop mid-download -- but the earlier "~3.2 s" projection
was wrong and is withdrawn.
Corrected in all four places it had propagated: the protocol reference, the
CHUNK_SIZE comment, the probe's verdict, and mm_client_check's banner. The probe
now also prints a net time per measurement, since its raw timings include the
idle gap while the control reads to frame completion -- comparing them directly
was misleading.
Also confirmed in the same run: 16 KB-class responses survive a cellular PAD.
1,024 / 2,048 / 4,096 / 8,192 / 14,176 B all arrived in one frame, byte-identical,
over an RX55. 14,176 B is UM12947's largest event so the ceiling itself was not
reached, but a 14 KB response crossing the PAD intact is what needed proving.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
|
||
|
|
eefc846c8c |
scratch(micromate): pin the probe's control to THOR's 1024, not the new default
The probe compared each candidate request size against a "known-good" download that used micromate's DEFAULT chunk size -- which is now 16,384. That makes the experiment circular: if 16 KB is broken on a given link, the reference is broken the same way and every comparison passes. The control is now pinned to THOR_CHUNK_SIZE. 1024 is the size with THOR's own captures behind it and the only one proven over a cellular modem, so it is the thing to measure against. Also raised the default idle gap from 2 s to 3 s. A 16 KB response is ~1.4 s of serial time at 115200 before the modem's ~1 s forwarding delay, and too small a gap makes a slow link look like a clamp -- which would read as a device limit that is really a timeout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
423608ccd1 |
perf(micromate): 16 KB per request, not 1024 -- 14x fewer round trips
The chunk-size ceiling, measured on UM20147 with every size checked byte-for-byte against a known-good download: 1024 / 2048 / 4096 / 8192 / 16384 -> served in full 32768 / 65535 -> SILENTLY CLAMPED to 16384 The clamp is the important part: a 32,768 B request returns 16,384 B of perfectly good data and no error. Nothing in the response says it was truncated; the length is the only signal. THAT DICTATES HOW THE LOOP MUST BE WRITTEN. read_event_file() now tracks its offset by BYTES RECEIVED rather than striding by chunk index. A fixed stride would either fail on a clamp or skip the bytes it never collected; tracking what actually arrived makes a clamp cost one extra request, and makes the loop self-correcting against any short response -- precisely the failure mode that has bitten the Series III side repeatedly. Consequence of that change, recorded because it reverses an earlier decision: a short chunk is NO LONGER AN ERROR. It used to raise, on the principle that a silently short event is this codebase's recurring bug. But the device returns short legitimately, and the real protection is the offset arithmetic plus the final total-length check -- which still raises on a genuinely truncated event. The test was rewritten rather than deleted, and says why. CHUNK_SIZE = 16384. For UM20147's events: 4,796 B goes 5 requests -> 1, 30,230 B goes 30 -> 2, and 72,560 B goes 71 -> 5. Over cellular at ~0.65 s per round trip that is ~46 s -> ~3.2 s on the large one. Measured on one unit over USB, so THOR_CHUNK_SIZE = 1024 stays available and the replay tests pin it -- reproducing THOR's exact traffic is one argument away, and client.download_event()/get_event() take chunk_size for a link where large responses are not surviving. Full suite: 472 passed, 16 pre-existing failures unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
248ddc9cda |
docs(series4): RETRACTED -- there is no 0x5A streaming mode; offset is a byte count
Measured directly on UM20147. offset 0x1014 (4,116) returned one frame of 4,127 B data = 4,116 B of file; offset 0x111c (4,380) returned 4,391 B = 4,380 B. So `offset` is simply a BYTE COUNT, the device returns exactly offset + 11 bytes in one frame, and page_key is offset // 256. `0x1000` is not a bulk-stream marker; it is part of the number. One model now covers every 0x5A request ever observed, THOR's and ours. The 2026-09-23 note that offset_word = 0x1000 + 2*pages returned an entire 11 KB event is therefore wrong -- 0x102C is 4,140, and 4,140 bytes is what it would have returned. Most likely the 11,049 figure was the whole capture rather than one frame's payload. Those captures never landed in the repo so the error cannot be traced further, and does not need to be: the live measurement is unambiguous. The probe tried BOTH escapings of offset_hi, which is why this negative counts -- a malformed frame would have produced the same silence. The escaped form answered, so the uniform escape set holds for 0x10 in offset_hi too, and the Series III exception does not carry over. AND THE NEGATIVE TURNED UP SOMETHING BETTER. In establishing that offset is a byte count, the unit served 4,380 bytes in a SINGLE frame. 1024 is THOR's choice, not the device's limit. Since a round trip costs ~0.65 s over cellular regardless of payload, and a 72,560-byte event is 71 requests ~ 46 s at THOR's chunk size, the ceiling is worth knowing precisely: the offset field is a uint16, so 65,535 B per request would make that same event 2 requests, ~1.3 s. mm_stream_probe.py repurposed to walk ascending request sizes, checking each against a known-good chunk-loop download so a pass means byte-identical output rather than a plausible length. micromate/protocol.py still uses 1024 -- THOR's value, the one with captures behind it. Raising it is a one-constant change once the ceiling is MEASURED, and it should not be raised on inference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
18ed1a27be |
scratch(micromate): differential probe for the 0x5A streaming mode
Downloads the SAME event twice -- once with the verified chunk loop, once with a single offset_hi = 0x10 request -- and diffs the bytes. A differential test rather than a suggestive one: byte-identical output means the streaming form is safe to adopt, anything else tells us exactly what it is instead. Why it is worth asking: a round trip over cellular costs ~0.65 s regardless of payload, so UM20147's 72,560-byte event is 71 chunks ~ 46 seconds. If one request fetches it, that becomes under a second. Our 2026-09-23 probes recorded exactly that behaviour with offset = 0x1000 + 2*ceil(size/512), but those captures never landed in the repo and cannot be re-derived. IT TRIES BOTH ESCAPINGS OF offset_hi, and that is the point of the design. On Series III, `offset_hi = 0x10` in a 5A frame must be written RAW -- doubled to `10 10` the device SILENTLY IGNORES the frame, which is a documented rule for this exact command. The Micromate escapes 0x04 in that position (218/218 captured THOR frames), which argues the uniform set applies to 0x10 as well, but Series III is a direct counter-example in the same command. Testing one form risks concluding "no streaming mode" when the real finding is "that frame was malformed" -- so a null result here only counts because both were tried. Defaults to the SMALLEST event, as the gentlest first attempt; --event largest is the one that matters. Ends by re-POLLing, because the honest risk of this experiment is leaving the session wedged and the script should say so rather than leave it to be discovered later. Read-only. 0x5A is a read we have sent thousands of times; the only new thing is a value in its offset field. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
faac59b283 |
verify(micromate): the uint32 chunk offset is confirmed -- 72,560 B in 71 chunks
UM20147's event 055d4a83 downloaded at exactly its promised size over USB, exercising the carry into params[1] on chunks 64-70. The uint32 reading was inference for one commit; it is now evidence, and the 64 KB cap that would have made this event unfetchable is closed. Worth noting what the same run prices: 71 chunks x ~0.65 s is roughly 46 SECONDS for one 72 KB histogram over cellular, against 0.2 s over USB. That is the round-trip cost model doing real work -- the bytes are nothing, the commands are everything. A unit holding several events this size is a multi-minute call, so the untested single-request offset_hi = 0x10 streaming mode (which would collapse a download to one round trip) moves up the list. Docstrings and the protocol reference downgraded from "inference" to "confirmed" only where the hardware actually settled it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
0cfec2f098 |
tooling(micromate): --event selects what to download, incl. 'largest'
The tool downloaded only the first event, which on UM20147 is a 4,796 B histogram -- so it could not reach the 72,560 B event that is the whole point of the uint32 chunk-offset change. --event takes a key in hex, 'first', 'largest' or 'all'. 'largest' is the one worth running on an unfamiliar unit, since it is what exercises offsets past 64 KB; the output flags any event over 64 KB as carrying into params[1], and prints the chunk count so a 71-chunk walk is visible as such. Selected events are downloaded from inside iter_events(), so the chain cursor sits where THOR's would -- non-selected events are walked past without a download, which the browse walk already attests is fine. Also: connect() returning nothing now prints a hint rather than just a bare timeout. /dev/ttyACM* numbering shifts whenever another CDC-ACM device is plugged in, and this cost a debugging session when the tool was aimed at a TMI-Seismo MCU instead of the Micromate. `ls -l /dev/serial/by-id/` names each device and is stable, so the hint says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
9c28b586bb |
fix(micromate): the 0x5A chunk offset is a uint32 -- a 64 KB cap was one event away
UM20147 holds a 72,560-byte event. chunk_params() wrote the offset as a uint16 at params[2:4], because every offset THOR was observed to send fits in two bytes (largest 0x3400 = 13,312), which caps a download at 65,536 B -- so that event could not have been fetched at all. params[0:4] is demonstrably ONE 4-byte field: chunk 0 puts the 4-byte event key there. Writing the offset as a uint32 BE in the same slot is BYTE-IDENTICAL for every offset below 65,536, so nothing verified against THOR's 74 captured frames changes -- the replay test still matches all of them -- and the range extends to 4 GB. Above 64 KB this is inference and the docstring says so: the field's width is established, the device's handling of a non-zero high byte is not. Also newly reachable: at offset 1 MiB params[1] is 0x10, which must go out as `10 10`. Nothing below 64 KB can produce that, so the uint32 change is what first makes the case possible -- and an unescaped 0x10 in 5A params is the exact bug that cost the Series III walk a release. Tested. THIS IS THE SERIES III 64 KB PAGE-BOUNDARY BUG WEARING A DIFFERENT HAT. There, parse_strt_end_offset() discards the key's page byte and the walk crashes once a unit's buffer crosses 64 KB; that one is still open. The transferable lesson: an address field whose high bytes are zero in every capture is not a narrow field, it is an untested one. Same mistake, found twice, in code written years apart. Confirmed in the same run: 0x06 content[0:4] IS the event count -- UM20147 holds 5 events and reads 5, making it three for three across both firmware lines (0->0, 6->6, 5->5). And content[4:8] is a CONSTANT, not a count: it reads 9 on a unit with 6 events and on a unit with 5. list_events() still walks to the sentinel; the count is worth adopting as a pre-check, not a replacement. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
15be9eafdb |
tooling(micromate): exercise the event chain, and test the 0x06 count candidate
mm_client_check now drives the step-4 client methods rather than the protocol layer directly -- list_events(), iter_events(), get_event() and decode_error() -- so a bench run exercises the code that will actually be used. Prints each ref with the filename it would be stored under, and reports the PVS self-check result per event. The download uses iter_events(), which reproduces THOR's interleaved order. Adds the 0x06 test: reads storage range BEFORE the chain walk, prints content[0:4] as the candidate event count and content[4:8] as the unexplained companion value, then reports AGREES or DISAGREES against the chain length. Two samples on one unit said the count is right; a third value from a different unit either confirms it or kills it, and the tool now answers that in one run. The 0x06 read is wrapped in the same step() helper as everything else, so a unit that does not answer it degrades to a FAILED line rather than aborting the run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
d7d72cadf8 |
feat(micromate): the event chain -- walk, records, download, and a self-check
Step 4 of docs/micromate_client_spec.md. MicromateEventRef plus list_events(), iter_events(), download_event(), get_event() and decode_error(). 14 new tests; 112 micromate tests total. The load-bearing test replays THOR's captured six-event download session through iter_events() + get_event() and asserts EVERY BYTE WE EMIT MATCHES THOR'S, in order -- 74 frames -- while decoding all six events and cross-checking each waveform's peak vector sum against the float the device computed itself. Two design decisions worth recording: 1. iter_events() EXISTS BECAUSE THOR INTERLEAVES. Its captured order is 0x93 -> 1E -> 0C -> 5A*n -> 0x93 -> 1F -> 0C -> 5A*n, downloading each event before advancing the chain. list_events() walks to the end first, which is fine for browsing but leaves the device cursor parked past the event a later download addresses. 0x5A is key-addressed so it very probably does not care -- but nothing observed says either way, so the interleaved path is the one offered for downloads, and it is the one the replay test exercises. 2. get_event(verify=True) RECOMPUTES THE PEAK VECTOR SUM from the decoded samples and compares it against the device's own 0x0C float. Two independent computations over the same samples, so a disagreement means our decode is wrong. Agreement on the bench events is 0.000%. Cheap insurance in a codebase whose decode failures have historically been silent -- unhandled block tags shorten a channel and nothing raises. It is a decode-correctness check, NOT a truncation detector: a channel cut after its peak still yields the right PVS, and the docstring says so. A test corrupts a stored peak to prove the check actually fires. MicromateEventRef.uid is SERIAL:key, because the key alone is ambiguous across units, and .filename generates THOR's name (<serial>_<YYYYMMDDHHMMSS>.IDFW/H) -- returning None rather than guessing when the record type is unknown, since read_idf_file() dispatches on exactly that suffix. Recorded as a CANDIDATE, not used: 0x06 content[0:4] looks like the EVENT COUNT -- 6 on a unit holding 6 events, zeros on an empty one, and THOR reads it BEFORE the walk then downloads exactly six events without ever reading the chain sentinel. If it holds it lets a caller decide whether to walk at all, which over cellular is the useful part. Two samples on one unit, and content[4:8] reads 9 unexplained, so list_events() still walks to the sentinel: slower by one round trip and correct on evidence rather than inference. Full suite: 465 passed, 16 pre-existing failures unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
e95d8e3b8c |
docs(changelog): Series-4 live client, verified on hardware
Folded into the existing Unreleased sections rather than adding new headings. Added: the three new micromate/ modules with 98 offline tests, the hardware verification across both transports and both firmware lines, and bridges/mm_client_check.py. Changed: the six spec rules the captures refuted before any code shipped; the 0x0C peak-vector-sum resolution and the decoder self-check it enables; the ~0.65 s per-round-trip cellular cost and what it implies for design; event keys colliding across units; and setup names being spelled three ways by three commands. Fixed: scratch/mm_frame_parse.py accepting either checksum rule, which is why it could not falsify either. Migration: None -- corrected the previous entry's claim that nothing under micromate/ was touched, which this merge makes false. The new modules are additive, micromate/idf_file.py (the codec) is untouched, no TOOL_VERSION bump, and no backfill is owed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
af8eebd724 |
merge: Series-4 live client -- framing, protocol and read client, verified on hardware
The Series-4 live half of SFM: micromate/{framing,protocol,client}.py with 98
offline tests, driven against two real units over both physical transports.
Read-only throughout. No command has ever been originated against a unit by
this project -- every write in the protocol reference was performed by THOR
while we recorded, and keeping that true through the read client is deliberate.
Six errors in docs/micromate_client_spec.md were found by measuring against the
captures before writing code rather than after. All six fail silently:
* requests need FOUR escaped bytes, not one (161/218 frames without)
* the response checksum is plain SUM8, not the DLE-aware variant (55/251)
* SUB 0x5A is a 1024-byte chunk loop, not one request per event
* SUB 0x0A is the monitor-log walk, not a keyed event-header read
* 1E/1F carry token 0xFE at params[7]
* SUB 0x01 has no THOR precedent at all
Hardware verification: identical wire bytes over USB CDC-ACM and an RX55 in PAD
mode; every 11.0BD inference confirmed on UM20147; a monitoring unit answers
reads with no SESSION_RESET; and all six bench events decode with the existing
IDF codec.
Two findings that constrain SFM's design rather than just documenting a unit:
cellular costs ~0.65 s PER ROUND TRIP regardless of payload, and event keys
COLLIDE ACROSS UNITS, so any store must key on (serial, event_key).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
|
||
|
|
a5237bb3b4 |
docs(series4): RESOLVED -- the 0x0C float is the PER-SAMPLE peak vector sum
Exact to 0.000% on all four bench waveforms, against a PVS recomputed from the decoded samples. The offset (Tran label - 12) is now established rather than inferred: four independent confirmations plus a fifth on the other firmware line. RETRACTION. The previous entry observed the float running 2-5% above max(T,V,L) and concluded it was NOT the peak vector sum, "because computed PVS runs higher than both". That computed PVS was sqrt(T^2+V^2+L^2) from the three REPORTED CHANNEL PEAKS, which is an upper bound on the real quantity rather than the quantity -- the channel maxima do not occur at the same instant, so combining them overstates the true peak. Every row of the old table is in fact consistent with max(T,V,L) <= stored <= sqrt(sum of squares). I also got this wrong in the other direction today and want it recorded. On UM20147's event the stored float matched sqrt(sum of peak squares) to 0.048%, and I called it the vector sum on that basis. It is not -- that event's peaks merely happen to be nearly coincident in time. The six CB events separated the two formulas immediately, with errors to -9.5%. ONE SAMPLE AGREEING WITH A FORMULA IS NOT EVIDENCE WHEN A SECOND FORMULA FITS IT EQUALLY WELL. Why it is worth having: it is a FREE SELF-CHECK ON THE DECODER. The device computed this number from the same samples we decode, independently of our codec, so a mismatch means the decode is wrong. Given this codebase's history of silent channel truncation -- walker bugs that shorten a channel and raise nothing -- a per-event invariant costing one float comparison is cheap insurance, and worth wiring into the download path. Also added the full 0x0C field map from real UM20147 bytes: timestamp, the record-type byte, sensor-location label, setup name, serial, the PVS float and the four channel labels with their offsets. Noted in passing: the setup name appears as "test2" in 0x0C, "test2.MMB" in 0x41 and "test2.mmb" in 0x40 -- three commands, three spellings of one file, in one session. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
7d1b033a05 |
docs(series4): BD download works -- and event keys COLLIDE across units
UM20147, event 055d4a81, 4,796 B, type read as histogram from the 0x0C byte and decoded as .IDFH on the first try. The chunk walk, the offset arithmetic, the 11-byte chunk prefix and the record-type byte all hold on the Thor firmware line unchanged. That closes the last BD gap. The type byte is now 7 events across both firmware lines -- 4 waveform, 3 histogram -- correct every time. Still not a large sample; the fallback stays. THE FINDING THAT MATTERS: UM20147's first event key is 055d4a81. So is UM12947's. Different units, different sizes (4,796 vs 4,076 B), different contents, identical key. This confirms keys are a sequential counter, and adds the consequence: the counter starts from the same value on every unit, so a key is MEANINGLESS WITHOUT ITS SERIAL. Anything that stores, deduplicates or addresses Series IV events must key on (serial, event_key). A store keyed on the event key alone silently treats one unit's event as a duplicate of another's, and the failure is invisible -- the second event is simply never ingested. Series III has a related hazard the ACH server already handles: its counter resets after an erase, so keys are reused WITHIN a unit, which is why ach_state.json tracks max_downloaded_key per serial. Series IV inherits that and adds cross-unit collision on top. Incidentally resolved: memory free is a usable signal after all. Run 1 showed 15,000,000 free and no events; run 3 showed 14,799,296 free, idle, with events stored. The earlier ambiguity was monitoring overhead confounding it, not memory being meaningless. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
080fb92ba2 |
test(micromate): real 11.0BD fixtures replace the synthesised ones
UM20147 captured over USB with mm_client_check.py --capture, read out with
scratch/mm_frame_parse.py: 11 frames each direction, 0 bad checksums. The two
BD-specific response data sections are now verbatim fixtures; only the frame
wrapper is rebuilt, which is sound because the framing is verified 251/251
elsewhere in the same file, and the reconstruction is pinned against the
payload length the parser reported.
Every field lands where the forward-offset model says it should:
data[0] = 0x30 = 48 = 59 - 11 (CB declares 0x2C = 44; the +4 holds)
content[1] = 0x0e monitoring
content[2:10] = 30 Sep 2026 14:00:49 matches the wall clock
content[34:36] = 3.50 V
content[36:44] = 15,000,000 total / 14,848,448 free
AND THE WARNING IS NOW DEMONSTRATED ON THE UNIT IT PREDICTED. Series III reads
battery from data[-10:-8], which on this block is e1 c0 -> 577.92 V. That is
the exact figure the A/B section named, and there is now a test asserting it,
so the reason the offsets are forward cannot be quietly refactored away.
Two corrections to the reference:
1. The four extra BD bytes are `0f a0 00 04`, not `0f a0 00 00`. Only the
first two look fixed. Nothing reads them, but the last is not padding.
2. POLL content[3] VARIES BETWEEN UNITS -- 0x50 on UM12947, 0x56 on UM20147.
It is printable in both cases ("P" and "V"), which is a second, independent
reason the POLL block cannot be parsed by scanning for printable runs: a
scan returns "PInstantel" on one unit and "VInstantel" on the other. The
fixed offset content[4] was the right call for a reason I had not seen.
The model string sits at content[26] on both firmware lines; only its tail
differs, so anchoring on "MM/" remains correct.
98 micromate tests pass. Full suite unchanged at 16 pre-existing failures.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
|
||
|
|
ea229ed19d |
docs(series4): monitoring reads confirmed, and setup-name case is inconsistent
Two findings from a UM20147 run that was only meant to capture fixture bytes. 1. A MONITORING UNIT ANSWERS READS NORMALLY. UM20147 was read while actively monitoring -- monitoring=True on both indicators, which agree -- and served POLL, serial, state, monitor status and a 5-entry setup walk with no special handling. This confirms the SESSION_RESET finding with our own client. Series III REQUIRES a bare 41 03 before POLL or a monitoring unit will not answer over TCP. That was inferred from its absence in THOR's captures; it is now demonstrated directly, on the other firmware line, by a client that never sends one. (THOR's refusal to send a SETUP while monitoring is a write restriction -- reads are unaffected.) Monitoring moves two values, so neither is stable to compare against: battery drifted 3.55 -> 3.50 V and memory free 15,000,000 -> 14,848,448. 2. SETUP-NAME CASE IS NOT CONSISTENT BETWEEN COMMANDS. Same unit, same session, same file: 0x41 reported "test2.MMB" and 0x40 reported "test2.mmb". A run 45 minutes earlier reported "test2.mmb" from both, so it is not fixed per command either; what changed between is that the unit started monitoring. Cause is a guess from two samples. The consequence does not depend on it: compare setup file names CASE-INSENSITIVELY. An exact-string test of "is the active setup one I know about?" answers no on this unit. Worth fixing before it is a field bug, since name matching is on the path for anything that replaces THOR's setup/scheduler coupling. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
b55e4e946a |
verify(micromate): 11.0BD confirmed on hardware -- every inference held
UM20147 read over USB by mm_client_check.py. The Thor firmware line was entirely inference until now, and two of its three differences were covered only by SYNTHESISED test frames. All three held: - flags = 0x03 identifies the line -> reported firmware_line="thor". That is only reachable if `10 03` in the flags position destuffs before indexing, since 0x03 is ETX -- so the escaped-flags case is confirmed too. - the model string is shorter -> reported "MM/ISEE/S" exactly. Anchoring the search on b"MM/" rather than a fixed span is what made this work. - the 0x1C block is 4 bytes longer with the extras TRAILING, so from-the-start offsets survive -> battery 3.55 V and a clock correct to the second. That last one is the one that mattered. Series III's from-the-end offsets would have given this unit 577.92 V, which is why mm_client_check watches for an impossible voltage: it is a free self-check on exactly the inference most likely to be wrong. Also clean: serial UM20147, 5 setups (factory.MMB -> test2.mmb), active setup test2.mmb, 15,000,000 B total and free, 21 reads / 2,165 B in. "One protocol stack drives the whole fleet regardless of firmware line" -- the headline finding of 2026-09-23 -- is now demonstrated by a working client rather than by matching response SUBs. Test and docstring claims downgraded from inference to confirmed where the hardware settled them, and left as synthesised-frame notes where it did not: the BEHAVIOUR is confirmed but raw BD bytes are still not in the repo. Added --capture DIR to mm_client_check: writes a raw_bw_*/raw_s3_* pair in the layout scratch/mm_frame_parse.py already reads, so a run on an unfamiliar unit becomes a test fixture without setting up a relay. Verified by round-tripping its own output through that parser: 28 frames, 0 bad checksums. Still not covered: a download from a BD unit (UM20147 had no events stored, so the chunk walk remains CB-only), raw BD fixture bytes, a monitoring unit, a nearly-full buffer, and the inbound call-home session. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
0d6eb1621f |
verify(micromate): read client works on real hardware, both transports
Run against UM12947 by bridges/mm_client_check.py, read-only, over the USB-B CDC-ACM port and over the RX55 to TCP :9034. THE WIRE BYTES ARE IDENTICAL ON BOTH PATHS -- 11,580 B in and 761 B out, to the byte, with matching identity, state and a 24-entry setup walk. The protocol does not care which physical layer it runs over, which is the thing the modem path needed to prove. Three findings, one of them a correction to my own prediction: 1. THE MODEM NEEDS FEWER READS, NOT MORE. 36 against USB's 83. The tool's banner claimed the opposite. The modem coalesces -- it buffers ~1 s then forwards one large TCP segment, where CDC-ACM delivers many small chunks. That is reassuring rather than alarming: the risk was a frame arriving split across reads, and the modem splits LESS than USB does. Banner fixed to state the measured numbers instead of a guess. 2. ~0.65 s PER ROUND TRIP over cellular, independent of payload size. A 1,024 B chunk and a 16 B state read cost the same. list_setups() takes 16.05 s over the modem against 0.46 s over USB, for 24 commands. This is the number that matters for SFM's design: over cellular, minimise round trips, not bytes. Enumerating setups costs 16 s -- cache it, never refresh it on a timer. A 13 KB event is 14 chunks ~ 8.4 s of latency against ~0.03 s of data, which makes the unconfirmed single-request 0x5A streaming mode worth its two-minute bench test on its own. 3. THERE IS A RECORD-TYPE FIELD: 0x0C content[11], 0x07 waveform, 0x08 histogram. The reference says no type field is known and that the type must be carried out of the chain walk. Found by diffing the six bench events' 0x0C records against their known types -- exactly one byte separates the groups and is constant within each -- then confirmed by predicting the right suffix for 6 of 6 on a blind re-run. Six events split 4/2 is thin evidence for a byte that could be a counter or a channel count, so it is recorded as a strong candidate, not settled, and mm_client_check keeps a fallback: it tries the other suffix on failure and says when the guess was wrong. Also flagged: the reference's claim that the type comes from SUB 0x0A's length is not visible in the download capture, where 0x0A is a standalone monitor-log walk after the last chain entry, not a per-event probe. END TO END: all six bench events assembled by read_event_file() from captured 0x5A responses decode with the existing codec -- 4 waveforms at 12,288 / 12,288 / 12,288 / 8,192 samples and 2 histograms. No new codec work needed; /db/import/idf_file ingests a directly downloaded event unchanged. Not covered: 11.0BD (still pure inference), a monitoring unit, a nearly-full buffer, and the inbound call-home session. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
f7d9a1d9cb |
tooling(micromate): drop the pyserial dependency from mm_client_check
Hit on the bench: mint-mac has no pyserial, and `pip install pyserial` is refused outright by PEP 668 (externally-managed-environment) on Mint 22 / Ubuntu 24.04 / Debian 12. A field diagnostic that needs a pip install on a locked-down host is one you cannot run at the moment you need it -- which is exactly when this tool is for. Replaced minimateplus.SerialTransport with a ~30-line stdlib `termios` port, the same approach bridges/mm_link.py and scratch/fake_unit.py already take in this repo. Runs on a stock Python 3 anywhere. Not a general SerialTransport replacement: no flow control, no parity options, Linux/macOS only. Enough for a Micromate, which is 8N1 with no handshaking. Verified end to end against a fake unit on a pty, dribbling responses in 64-byte pieces: 194 reads for 10,958 B, identity/state/setup-walk all correct, and a 4,076 B event downloaded across 4 chunks at the exact expected length. Also clarified --baud in the help: it applies to the USB-A/FTDI path, and is ignored by the USB-B "PC" port, which is CDC-ACM and negotiates its own rate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL |
||
|
|
c7ffdab570 |
tooling(micromate): mm_client_check -- exercise the read client on real hardware
Read-only: POLL, SERIAL, state, monitor status, the setup walk, and optionally
one event download. Never writes, erases, or changes monitoring state.
Exists because everything in micromate/{framing,protocol,client}.py is
verified against captures taken over USB on one firmware line (11.0CB). Two
things that cannot be verified that way:
- The modem path. An RX55/RV55 buffers up to ~1 s before forwarding, so one
logical response arrives as many small reads. The client reads to frame
completion rather than using read_until_idle's idle-gap detection, which
should be strictly more robust for this -- but that needed proving.
- The 11.0BD firmware line, which reports flags=0x03, a shorter model string,
and a 0x1C block 4 bytes longer. All inference from one 2026-09-23 sweep
whose captures never landed in the repo. The tool says so loudly when it
meets one, and flags an impossible battery voltage as the signature of the
from-the-end offset bug.
Run it over both paths and diff; anything differing beyond timings is a
finding. It counts reads and bytes per transport, because a higher read count
for the same bytes IS the buffering, made visible.
Smoke-tested against a scripted TCP unit replaying captured response bytes in
37-byte dribbles: 289 reads to carry 10,958 B, every frame reassembled, a
4,076 B event downloaded across 4 chunks with the assembled length exact.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
|