From 56b8aac4cb6fc46f382f3c1df4c9f6dd7febee8c Mon Sep 17 00:00:00 2001 From: serversdown Date: Sat, 17 Oct 2026 02:22:00 -0400 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 --- CLAUDE.md | 63 +++++----- docs/instantel_protocol_reference.md | 9 ++ docs/micromate_protocol_reference.md | 168 +++++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 28 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d3bd363..bc21faf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,7 +10,7 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as --- -## Where things stand (updated 2026-10-14) +## Where things stand (updated 2026-10-17) Read this first when picking the project back up. @@ -40,33 +40,40 @@ Read this first when picking the project back up. about a dozen fields read; `0x2C`, `0x2E`, `0x08`, `0x01` are fetched and undecoded. Finishing it needs a bench session varying one setting at a time, as was done for Series III — not desk work. -- **Config decoding is set up and waiting on ONE keypad press (2026-10-15).** - `scratch/mm_config_diff.py` is the loop — read-only, four subcommands - (`volatile` / `snap` / `watch` / `diff`). Baseline and the noise mask are - saved under `scratch/mm_config_snaps/UM20147/` (gitignored). - **The method is verified viable: all five config blocks are bit-stable** - (0 bytes moved across repeated reads), so any byte that changes between two - snapshots *is* the setting — no noise floor to subtract. That was the open - question. - **Start here:** run `watch`, change exactly one setting on the unit's keypad, - and it prints the changed runs with content-relative offsets and each - plausible field type. **Sample rate first** — a large distinctive power of two - pins endianness in one shot where a boolean toggle teaches nothing. - ⚠ Settings do **not** have to be changed from THOR. The unit's own keypad - works: no Windows VM, and no contending for the modem's single TCP session. - ⚠ `sg dialout -c "..."` is needed to open `/dev/ttyACM0` — the `dialout` - membership is in `/etc/group` but shells started before it was added do not - see it, and the failure looks like a dead unit. - ⚠ `watch-001`..`005` in the snapshot dir are **clock ticks, not findings** — - taken before the mask covered the minutes byte. - 🔑 **`channel+24` (f32 BE) reads `3.1030800342559814` on every geo channel.** - Over 10,000 that is `_GEO_LSB_IPS` to 1.1e-8, and it implies 32,226.05 counts - full scale — the documented figure exactly. The LSB previously rested only on - intersecting 991,415 rounding constraints from Thor's exports; **the unit - reports it directly.** Two independent derivations, eight digits. - ⚠ The rest of the channel-block map in the reference is **graded** — one - measured, two inferred, two explicitly flagged as guesses. Respect the grades; - `+4` "channel type" and the `+8:24` uint16 split are single-setup guesses. +- **Config decoding: first keypad pass done (2026-10-17).** 47 snapshots of + UM20147 while settings were changed on its keypad; every byte that moved is + accounted for. `0x1A` content now reads: record mode `[5]` (`01` Waveform, + `02` Manual, `03` Histogram, `04` Combo), sample rate `[6:8]`, histogram + interval `[8:10]` s, pre-trigger `[12:16]` f32 **negative** s, stop mode + `[17]`, record time `[18:22]` f32, auto-stop `[23]`, active-sensor and + trigger-source bitmasks `[25]` / `[29]` (`0x07` geo, `0x08` mic), trigger + level at channel `+30` (geo in/s, mic **psi**). Full table, grades and + method in `docs/micromate_protocol_reference.md` → *The `0x1A` field map + from a keypad pass*. + 🔑 **`0x1A` ends in a CRC-16/AUG-CCITT** over `content[0:2088]`, stored BE at + `[2090:2092]` — 47/47 plus a second unit. Thor's write **omits** it (the + unit computes it), so it is a read-side integrity check, not a write + obligation. Not yet wired into `micromate/`. + ⚠ **The six channel blocks are 3 geophones + the active mic (block 4) + the + stored linear / sound-level mic setups (5, 6).** Read the mic from block 4 + and branch on its `+4:8` code (`2` linear, `9` SLM); labels and unit strings + are re-rendered by keypad saves and are not identifiers. + ⚠ **`0x1A` reads the keypad's edit buffer live** — unsaved values show while + someone is in the menu; a discard reverts them. + 🔶 **Possible Series III bug, inferred only:** S3's 6-byte "stable anchor" + `be 80 00 00 00 00` sits exactly where Series IV keeps pre-trigger (−0.25 s) + + stop mode (Fixed). An S3 unit in Auto stop mode would then lose the + anchor and decode no mode / rate / interval / record time. One BW capture + in Auto mode settles it — see the 2026-10-17 row in + `instantel_protocol_reference.md`. + Harness: `scratch/mm_config_diff.py watch` (now per-session snapshot labels + and a built-in CRC check). ⚠ `sg dialout -c "..."` is still needed to open + `/dev/ttyACM0` from shells started before the `dialout` membership. + ⚠ **When diffing, get the operator's own account of what was pressed** before + labelling a run — twice on 10-17 a run was attributed to the setting that + had been *asked for*, and both were wrong. + Not yet mapped: job number, scaled distance, GPS, aux I/O, SLM options, + four unknown head runs, channel `+46:48`. - **🔑 ACH / call-home, captured end to end (2026-10-14).** A Micromate signals `RADIO RING`; **two paths exist and timing decides which**: if anything already holds the modem's single TCP session the ring rides that connection, diff --git a/docs/instantel_protocol_reference.md b/docs/instantel_protocol_reference.md index a75393a..b236d5c 100644 --- a/docs/instantel_protocol_reference.md +++ b/docs/instantel_protocol_reference.md @@ -11,6 +11,7 @@ | Date | Section | Change | |---|---|---| +| 2026-10-17 | §7.6.1 | 🔶 **OPEN — the 6-byte "stable anchor" may be two settings at their defaults, not a constant.** Series IV's `0x1A` has the same field order as the S3 compliance block, and a keypad diff pass on a Micromate (UM20147) measured the bytes in the anchor's position: `[f32 BE pre-trigger, negative seconds][record stop mode, 00 00 = Fixed]`. `be 80 00 00` is exactly −0.25 s. If S3 matches — **inferred, not measured on S3** — then any S3 unit set to Record Stop Mode = Auto (a basic Blastware Compliance Setup option) or a non-default pre-trigger loses the anchor, and `client.py` silently decodes no recording mode / sample rate / interval / record time and skips them on write. No S3 capture has ever been taken in Auto stop mode (see the 2026-03-09 Auto Window rows), which would explain why the anchor never broke. To settle: one BW capture with Record Stop Mode = Auto. See `docs/micromate_protocol_reference.md` → *The `0x1A` field map from a keypad pass*. | | 2026-08-26 | S7.6.2, S15 | **MULTI-INTERVAL HISTOGRAM BLOCKS - sub-minute intervals pack several per block.** The device always writes one minute of data per block, so a shorter histogram interval means more intervals packed into a longer block: 1 min -> 1 (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612), with `stride = 12 + n * 20`. Each 20-byte record holds 8 x uint16 **little**-endian values (peak/half-period per channel) plus a 2-word tail whose first word is `0000` on every real interval. The standard block is big-endian - the variant is not. This recovers **415 files** (216 on BE18193 at 2 s, 199 on BE9440 at 15 s) that previously decoded to nothing, and before that were being accepted by the WAVEFORM codec and returning garbage up to 400x the device-reported PPV. | | 2026-08-25 (3) | S7.6.1, S15 | **THE WAVEFORM BODY IS A RECORD CHAIN, NOT A TAG STREAM — supersedes the segment-header model entirely.** Records are self-delimiting: `off+2` is a uint16 BE length and `next = off + 2 + len`; the chain ends on a record whose chan_id is `0x06`. `off+8` holds a 3-valued mode enum - `02 00` (14-byte header, anchors, cumulative deltas), `01 00` (10-byte, no anchors, ABSOLUTE values), `00 03` (10-byte, no tags at all, raw 12-bit absolute). **`40 NN` is an ordinary int16 BE data block of length 2*NN+2**, never a header; reading it as a 2*NN+16 header is what made walks drift, and the 'variable prefix' of 0/2/4/6/8 bytes reported earlier the same day was walker drift, exactly `4 - (old_stop - true_record_start)`. Verified: chain terminates on `06` in 1387/1388 files; all four channels equal length in **1388/1388** (was 156/1388); ASCII sample-count exact 72/75 -> **75/75**, fully exact 70/75 -> **73/75**; device PPV on a live decode **1306/1306** waveform (mean abs ratio error 0.00000) and **4458/4459** histogram. Also eliminated the walker-over-read class: 24 of those files were histograms the waveform codec was wrongly accepting. The superseded model is retained as `decode_waveform_legacy` because `micromate/idf_file.py` pins it for Thor IDFW body-offset search. | | 2026-08-25 (2) | S7.6.2, S15 | **HISTOGRAM BLOCK IS BIG-ENDIAN + terminal block tail.** The 32-byte histogram block's per-channel fields are uint16 **big-endian** (`T_peak` [5:7], `T_halfperiod` [7:9], `V_peak` [9:11], `V_halfperiod` [11:13], `L_peak` [13:15], `L_halfperiod` [15:17], `M_peak` [17:19], `M_halfperiod` [19:21]); only `block_ctr` [2:4] is little-endian. The marker is `block[4]` alone - the previous uint16 LE marker test at [4:6] forced `block[5] == 0` and thereby capped every geo peak at 255 counts (1.275 in/s), silently clipping larger peaks. The byte previously documented as a per-channel "annotation" is the high byte of the big-endian half-period, which is why it was non-zero exactly on sub-Hz intervals. Separately, the **final block of each stream carries tail `9c 06 00 42`** rather than `1e 0a 00 00` and holds arbitrary bytes at [21:23]; rejecting it dropped the last interval of nearly every histogram. Verified against 1211 production histograms paired with their Blastware ASCII exports: 1211/1211 decode exactly, plus 842,442 per-interval frequency comparisons with zero mismatches (previously 1 of 1196 files fully correct). | @@ -702,6 +703,14 @@ the anchor). > reconfigured (e.g. 15 min = `\x03\x84`). Only the 6-byte suffix is constant. > Code in `client.py` uses `buf.find(b'\xbe\x80\x00\x00\x00\x00', 0, 150)`. +> 🔶 **2026-10-17 — the 6-byte suffix may not be constant either (INFERRED from Series IV).** +> On a Micromate the same position holds `[pre-trigger f32 BE, negative seconds][record stop mode]`, +> measured setting by setting: `be 80 00 00` = −0.25 s, and `00 00` = Fixed (Auto reads `00 01`). +> Every S3 unit this anchor was confirmed on would have been at those defaults. If S3 shares the layout, +> a unit in **Record Stop Mode = Auto** returns `be 80 00 00 00 01`, `find()` returns −1, and the four +> anchor-relative fields silently go undecoded. **Not yet measured on S3** — one BW capture in Auto +> mode settles it. Until then, treat a missing anchor as this, not as DLE jitter. + > ✅ **2026-04-02 — CORRECTED:** Search range was `cfg[40:100]`. With the > compliance-config orphaned-send bug fixed (§7.6.2), the 44-byte accidental > header padding is gone and the anchor now appears at `cfg[11]`. Search range diff --git a/docs/micromate_protocol_reference.md b/docs/micromate_protocol_reference.md index 1513fdf..f6dda9f 100644 --- a/docs/micromate_protocol_reference.md +++ b/docs/micromate_protocol_reference.md @@ -1292,12 +1292,25 @@ residual is S3's rounded display value, not a real difference). - that `+46:48` is a per-channel enable or trigger-source flag. It is the only byte separating three otherwise identical blocks, which is suggestive and nothing more. + > ⚠ **2026-10-17: not trigger source, and not enable.** Trigger sources are a + > bitmask at `content[29]` and active sensors one at `content[25]`; neither + > change moved `+46:48`, nor did anything else in a 47-snapshot pass. Its + > purpose is unknown. **GUESSED — do not build on these:** - `+4` as a uint32 "channel type" (reads 1 / 1 / 1 / 2 / 2 / 9 across the six). Six observations from a single setup, correlating with channel kind. That is the entire basis. + > ✅ **2026-10-17: promoted, with one asymmetry.** Switching Mic Type to Sound + > Level rewrote block 4's code `2 → 9` and nothing else in the config moved, so + > the mic type has no byte of its own: this field *is* it. Geophone blocks + > read `0` while the geophones are deactivated. ⚠ Deactivating the mic did + > **not** zero block 4's code. See *The `0x1A` field map from a keypad pass*. +- ⚠ **2026-10-17: "six channels" is itself wrong.** Blocks 1–3 are the + geophones, **block 4 is the active mic**, and blocks 5 and 6 are the stored + settings of the linear and sound-level mic respectively. `LMic` and `SMic` + are not channels. - `+8:24` as eight uint16 BE values. Geo reads 74, 10, 40, 21, 1275, 525, 3, 0; mic reads 200, 50, 10, 10, 1500, 500, 5, 0. Field boundaries unverified — the uint16 split is an assumption, not a reading. @@ -1306,6 +1319,161 @@ residual is S3's rounded display value, not a real difference). see which of these offsets moves. A field whose purpose is guessed and which never moves when the matching setting changes is simply wrong. +### The `0x1A` field map from a keypad pass (UM20147, 2026-10-17) + +Method: `scratch/mm_config_diff.py watch` polling all six blocks every 2 s while +settings were changed on the unit's **own keypad**, one at a time. **47 +snapshots. Every byte that moved is accounted for by a named setting, and +nothing outside `0x1A` moved at all.** Snapshots: +`scratch/mm_config_snaps/UM20147/s1017-watch-*` and `watch-1017-0150-*`. + +⚠ **Grades.** "Measured" below means: the operator named the setting and its +before/after value, and the bytes moved accordingly. Two attributions made +*before* the operator confirmed what was pressed were wrong, and were retracted +in the session — the mode enum and the sensors mask both briefly carried the +wrong label. A diff tells you which bytes moved, never which setting moved them. + +Offsets are into **content** (`data[11:]`, 2,092 bytes). + +| offset | field | encoding | grade | +|---|---|---|---| +| `[0:2]` | length echo, `0x082a` = 2090 = content minus the CRC | u16 BE | inferred (arithmetic); Thor zeroes it on write | +| `[2:5]` | `64 00 00` | — | unknown, never moved | +| `[5]` | **record mode** | `01` Waveform · `02` Waveform Manual · `03` Histogram · `04` Histogram Combo | **measured**, all four, screen-confirmed | +| `[6:8]` | **sample rate**, sps | u16 BE | **measured** (1024 → 2048) | +| `[8:10]` | **histogram interval**, seconds | u16 BE | **measured** (2…11, 30, 300; `01 2c` settles the width) | +| `[10:12]` | `00 00` | — | unknown, never moved | +| `[12:16]` | **pre-trigger**, *negative* seconds | f32 BE | **measured**, all four: `be80`=−0.25 `bf00`=−0.5 `bf40`=−0.75 `bf80`=−1.0 | +| `[17]` | **record stop mode** | `00` Fixed · `01` Auto Record | **measured**; u8 vs u16 BE `[16:18]` unresolved | +| `[18:22]` | **record time**, seconds | f32 BE | **measured** (10 → 11) | +| `[23]` | **auto stop after**, seconds | u8 (or u16 BE `[22:24]`) | **measured** (3 → 1) | +| `[25]` | **active sensors** | bitmask: `0x07` geophones, `0x08` mic | **measured**, all three options | +| `[26:28]` | `05 3f` | — | unknown, never moved | +| `[29]` | **trigger sources** | same bits as `[25]` | **measured**, both directions; mic bit screen-confirmed | +| `[2090:2092]` | **CRC** | see below | **measured**, 47/47 + a second unit | + +Mode enum ⚠: the **menu** order is Histogram → Combo → Waveform → Manual +(`03 04 01 02`), so the screen order is not the encoding. The values match +Series III's (`01` Continuous, `03` Histogram, `04` Histogram+Continuous) — +**the byte sits one position later than the S3 analogy predicted**, the +encoding does not differ. There is no Single Shot (S3 `00`). + +A framing question, answered in passing: `0x03` is ETX, and it +appeared as a literal value twice (record mode `03`, interval 3 s). The block +stayed 2,103 bytes both times — **the Series-4 read path destuffs an escaped +ETX correctly**, which is exactly the case that shifted every later field by +one on Series III. + +#### The channel blocks are 3 geophones, 1 active mic, and 2 stored mic setups + +`content[1708] + 48n`. The 10-15 section above called these six channels; +**they are not**: + +| block | role | +|---|---| +| 1–3 | Tran, Vert, Long | +| **4** | **the active microphone** — a byte-for-byte copy of block 5 or 6 | +| 5 | the linear-mic settings, kept while not selected | +| 6 | the sound-level-mic settings, kept while not selected | + +**Measured:** Mic Type → Sound Level copied block 6 into block 4 byte-for-byte; +→ Linear copied block 5 back, **carrying a 140 dB trigger set while Linear was +active** — so block 5 is a store, not a template. Nothing else in the config +moved: **there is no separate mic-type byte**; block 4's `+4:8` code (`2` +linear, `9` sound level) *is* the type. + +⚠ **For a decoder: read the mic from block 4 only, and branch on its code.** +Blocks 5 and 6 are the settings of whichever mic is *not* fitted; decoding +either as a channel reports a sensor that is not there. + +| offset | field | grade | +|---|---|---| +| `+4:8` | sensor code: `1` geophone, `2` linear mic, `9` sound-level mic, `0` geophone deactivated | measured; ⚠ deactivating the mic left block 4 at `2` | +| `+30` | **trigger level**, f32 BE — geophones **in/s**; mic **psi**, whatever the display unit | **measured** (geo 0.5 → 0.6; mic 131 → 140 dB) | + +The keypad has **one** geophone trigger level and writes it to all three blocks; +the per-channel slots exist (Thor may set them separately — untested). A mic +trigger edit writes block 4 **and** its store (block 5). + +Mic trigger: `0.0102915 psi` → 70.957 Pa → **130.999 dB** re 20 µPa (screen: 131); +`0.0290064 psi` → **139.9997 dB** (screen: 140). **Reading is solved.** ⚠ +**Writing is not:** the textbook conversion of 140 dB is `0.0290075`, 617 ULPs +away, and the implied Pa/psi differs between the two values (6895.29 vs +6895.03), so the firmware's dB → psi rule is not a single constant. A writer +cannot byte-match it yet. + +#### Labels and unit strings are cosmetic — keypad saves re-render them + +- Block 5's label went `LMic` → `Mic` on a **geophone** trigger-level save. +- All three geophone unit strings went `in.` / `/s.` → `in` / `/s` when Active + Sensors changed. **One-way**: re-activating did not restore the dots. + +The same setup reads differently after Thor wrote it and after the keypad saved +it. **Key channels on block position and the `+4:8` code, never on a string.** +Why some saves re-render and others do not is unknown (inferred: the firmware +rebuilds whatever blocks the edited screen owns, in its own spelling). + +#### The CRC + +``` +CRC-16/AUG-CCITT poly 0x1021, init 0x1D0F, refin/refout false, xorout 0 +over content[0:2088] (content[2088:2090] = 00 00 is NOT covered) +stored big-endian at content[2090:2092] +``` + +Identified from a single sample-rate diff by testing all 65,536 polynomials +against `crc(a) ⊕ crc(b)` (linearity makes the range start irrelevant), then +confirmed on absolute values. `0x1021` was the only catalogued polynomial among +~30 chance hits. Equivalent forms — CCITT-FALSE (`init 0xFFFF`) over two zero +bytes plus the content — are the same algorithm; leading zeros only move the +effective init. **Verified: 47/47 snapshots on UM20147, every state predicted +before comparing, and UM12947's 9-24 read (`3cfd`), a different unit and setup.** +Revisiting a state reproduces its trailer exactly — no counter in the block. + +⚠ **A writer does not send it.** Thor's `0x71` data is `content[0:2090]` +(aligns at shift 0, 1902/2090 equal) — it stops before the CRC and zeroes the +length echo. The unit computes both. **Its use is read-side integrity:** every +`0x1A` read can now check itself, which on a codec repeatedly bitten by silently +short data is the cheap guard worth wiring in. + +#### `0x1A` reads the keypad's EDIT BUFFER, live + +**Measured, two independent tests:** a scrolled-to, unsaved record mode appeared +in `0x1A` immediately; backing out with *discard* restored it. A second discard +reverted **two fields at once** (mode and an interval changed 13 times) to a +block byte-identical to the last saved state. Pressing *save* moved no byte. + +When an edit reaches the buffer depends on the widget — **measured** per widget: + +| widget | reaches `0x1A` | seen on | +|---|---|---| +| list | on **every scroll step** | record mode, active sensors, mic type | +| spinner popup | on **Enter** | histogram interval | +| sub-window | only on back-out → **save to setup file** | Record Time window (pre-trigger, stop mode, auto stop) | + +A fast list scroll can pass a value inside one poll; the watcher then never sees +it (Histogram was skipped once). Pause on each value. + +⚠ **Consequence:** a `0x1A` read taken while someone is in the setup menu +returns values that may never be committed — and may differ from the `.MMB` file +of the same name. Rare in the field; worth one line wherever SFM reports a +unit's config. + +#### Negative results + +- **`0x2E` never moved** — not under trigger level, trigger enable, or anything + else. Whatever "trigger" config it holds, these settings are not it. +- `0x08`, `0x01`, `0x2C` never moved. The bit-stability also holds across days: + the 10-17 baseline was byte-identical to 10-15's. + +#### Not yet mapped + +Location / Client / Company / Notes (already mapped from Thor's 9-24 write — +not re-checked here), Job Number, Scaled Distance, GPS, Aux I/O, the sound-level +mic's own options (response, weighting, LN1/LN2 — SMic `+8:24` holds `10, 90`, +the manual's example LN1/LN2, **guessed**), the four unknown head runs above, +and `+46:48`. + ## The write path — observed end to end (2026-09-24) ⚠ **We have still never sent a write command to a unit.** Thor did every write