3a6df9d7f44cd7ee40d1e99f9a4fdd4ff0bf35fe
597
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3a6df9d7f4 |
merge: Series-3 waveform times from the instrument's embedded event record
Brings fix/waveform-time-from-record ( |
||
|
|
7100d8344a |
docs(reference): point §7.8.9's open items at the Series-III audit, #53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL |
||
|
|
6cfcd04513 |
fix(sfm): an estimated event time never overwrites, merges into or duplicates a row
Brian: keep an event whose time is only an estimate (no validated embedded
event record) -- never discard a measurement for want of an exact timestamp --
but it must not silently cause an overwrite, merge or dedup collision.
insert_events, for timestamp_source 'estimate' (_estimate_guard):
- never restamps (moves) a row;
- if its file (a Blastware name) is already stored under another time, writes
nothing -- no second row, the stored time kept;
- if a different event already holds that second, writes nothing -- the old
upsert would have written this event over that one;
- otherwise stores it, or refreshes its own row at the same second, as before.
Each refusal is a WARNING naming both sides; the file and sidecar (which says
'estimate' and carries the decode problem) are already in the store. A generic
upload name ('imported.bw') is not taken as identity.
Tests: each rule, an estimate on a free second kept, generic names, and an
import end to end (a corrupted record next to a different event's second).
3 mutants, each caught. Suite vs clean origin/dev: the same 16 failing tests,
failure reasons byte-identical; 582 passed vs 553.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
|
||
|
|
f91949be89 |
fix(decode): a Series-3 waveform's time comes from the instrument's embedded event record
Brian's requirements: the instrument's data is the only time source; a filename is a cross-check, never a fallback (an event SFM receives itself has none). The record (found by reading a seismo_lab Inspector dump; Series-III reference §7.8.9): 00 28 05 00 ?? ?? | fe 80 | trigger | stop, times dd mm yyyy(BE) 00 hh mm ss. Measured on 7,935 waveforms (DL2 + prod store): exactly one candidate validates in every file; trigger = Blastware's report 1,320/1,320, = filename 7,935/7,935, = the unit's 0C record 10/10. Provenance (requirement 6, measured): in Blastware's download of 8 BE9441 events the record -- with 24 B before and 22 after -- occurs exactly once in the unit's own A5 reply payloads; SFM-only downloads (no Blastware) carry it too. It is instrument data, not Blastware's. - _embedded_event_record(): every fe 80 before the footer is a candidate; it counts only with the lead bytes, two well-formed times (zero byte zero), footer ts1 <= trigger <= stop, stop = footer ts2 or a second before, and a length matching the record time. Exactly one must count; none or several is a decode problem, never a guess. - Without one: the footer estimate, timestamp_source 'estimate', a decode_problems entry, a WARNING. No filename fallback. - A filename that disagrees is logged; the decoded time is kept. A paired report fills in only without a validated record (apply_report_to_event, the sidecar dict overlay, event_to_sidecar_dict) and is logged when it disagrees. - decode_blastware_bytes(raw, name=None): no file or name needed; save_imported_bw uses it (no temp file). Event gains timestamp_source and decode_problems; the sidecar records both. - Histograms unchanged (#51): their record (fe f5) is noted, not used. Tests: raw bytes with no name (ZI0, 7 BE12844 oracles), a disagreeing name, each validation rule alone, two valid candidates, no filename fallback, report precedence, sidecar. 7 mutants, each caught. Real data, decoded with no name: 7,961/7,961 waveforms on the record, 0 disagreements with filename or report; 10,433/10,433 prod histograms unchanged. Suite: only the 16 known failures. Open (reported, not changed): 3 DL2 files named as waveforms whose body the waveform codec does not recognise keep the footer start, 4 s off, as on dev. None in prod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL |
||
|
|
895ce4917e |
chore(release): v0.32.0 — event times you can trust, and Series 4 mapped
Series-3 waveform times carry Blastware's own (from the filename), re-stored events move their rows instead of duplicating, prod's ISO-dated reports are read, mic-off / mic-on sub-minute histograms decode right (#47, #49), Micromate .h5 samples are on Thor's own scale (#42). Plus the Series-4 live protocol, read-only client and setup decode (no shipped code path yet) and the SFM Diagnostics tab. TOOL_VERSION 0.31.0 -> 0.32.0: the deploy owes backfill_sidecars.py --force --reparse-txt, backfill_thor_events.py, backfill_event_shape.py (~2 h on the NAS), rehearsed on prod's 2026-09-30 store snapshot -- see Migration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL |
||
|
|
4058dec641 |
docs(changelog): waveform times from the Blastware filename, restamp in place, ISO report dates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL |
||
|
|
5737168173 |
merge: Series-3 waveform times from the Blastware filename; a corrected time moves its row instead of duplicating it
Brings fix/waveform-time-restamp ( |
||
|
|
3948dc1a3c |
fix(decode): a Series-3 waveform's time comes from its Blastware filename
The review of this branch measured (and I re-measured) that the binary's
trigger -- ts2 minus the record time, from
|
||
|
|
a0fd5fcc25 |
docs(changelog): sub-minute histograms read big-endian, mic on and off (#47, #49)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL |
||
|
|
6ed46dc3a3 |
merge: sub-minute histograms read big-endian from byte 5, mic on and off -- issues #47, #49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL |
||
|
|
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 |
||
|
|
abb671a440 |
fix(decode): a paired report's event time is read in ISO form and survives a backfill
The event-time fix makes a Blastware report's Event Time + Event Date
authoritative over the binary, which gives the trigger only to the second.
On prod's own data it never applied (measured on the 2026-09-30 store
snapshot, all 81 report-paired Series-3 waveforms):
- every one of those reports writes Event Date as ISO ('2026-08-14');
_parse_event_date read only 'August 14, 2026', so event_datetime was None
(Brian's own laptop writes the long form -- it follows the PC's settings);
- the sidecar's bw_report block never stored the event time, and
apply_bw_report_dict_to_event -- the backfill's overlay -- never set it.
The binary's trigger matched Blastware's printed time on 66 of the 81 and was
a second late on 15; 8 of those 15 hold the right time in prod today, so the
release backfill would have made them a second worse.
- _parse_event_date accepts ISO dates too (81/81 now parse to the time
Blastware printed; 0/81 before).
- _bw_report_to_dict stores event_datetime (additive key).
- apply_bw_report_dict_to_event applies it, as apply_report_to_event does.
Prod's sidecars were written by the old parser, so the deploy runs
backfill_sidecars.py with --reparse-txt to re-read the saved .TXTs.
Tests: both date forms, the round trip through the saved block, a block with
no time, and the backfill (--force --reparse-txt) on a prod-shaped row.
Suite: only the 16 known fixture failures.
Codec-library change (report parser): TOOL_VERSION to be bumped at release.
No schema or DB migration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
|
||
|
|
847900baeb |
fix(sfm): a re-stored event at a corrected time moves its row instead of duplicating it
The waveform event-time fix ( |
||
|
|
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 |