2 Commits
Author SHA1 Message Date
serversdownandClaude Opus 5.5 c790e20116 fix: bench follow-ups -- the setup-menu warning, observed call-home values, waveform read
From the 2026-11-04 bench:
- A MiniMate settings preview warns that a change is lost if someone is in
  the unit's setup menu: a write sent with the menu open was acknowledged
  and read back, then lost on Cancel or Save -- the menu writes its own
  copy of the whole block back (measured both ways on BE9441).
- The two bytes after the MiniMate settings block went out as 00 00 and
  the unit took them; the preview note says so instead of 'unmeasured'.
- A Micromate call-home plan no longer warns about 0x00 / 0x01: UM20147
  took both, each way, on 11-03 and 11-04, matching its menu.
- read_waveform_data_raw drops the escaped-checksum's stray 0x10, as the
  settings read does (it failed closed: the write's block check refused
  203 bytes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-04 16:15:28 -05:00
serversdownandClaude Opus 5.5 55c7b7b5ae feat(codec): the MiniMate alarm level is writable (benched 2026-11-04)
S3_ALARM_WRITE_MEASURED = True.  At the bench on BE9441, with Brian's go,
the alarm went 1.0 -> 1.5 -> 1.0 in/s: each write acknowledged, read back
as sent, and shown in the unit's own setup menu.  The write moved exactly
channel +39 of the three geophone blocks (the f32 at +38), where the
event files put it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-04 16:12:58 -05:00
8 changed files with 83 additions and 18 deletions

No files matched your search

+5 -4
View File
@@ -61,7 +61,7 @@ _CHANNELS, _CHANNEL_SIZE, _GEOPHONES = 1708, 48, (0, 1, 2)
_CH_RANGE = 29 # u8: 0 Normal (10 in/s), 1 Sensitive (1.25 in/s) -- Series 3, measured _CH_RANGE = 29 # u8: 0 Normal (10 in/s), 1 Sensitive (1.25 in/s) -- Series 3, measured
_CH_TRIGGER = 30 # f32 BE, in/s for a geophone _CH_TRIGGER = 30 # f32 BE, in/s for a geophone
_CH_UNIT = slice(34, 38) # "in." / "in" (the keypad re-renders it); NOT an identifier _CH_UNIT = slice(34, 38) # "in." / "in" (the keypad re-renders it); NOT an identifier
_CH_ALARM = 38 # f32 BE -- Series 3, read; a write waits for the bench _CH_ALARM = 38 # f32 BE -- Series 3; write measured at the bench 2026-11-04
_FULL_SCALE = {0: 10.0, 1: 1.25} _FULL_SCALE = {0: 10.0, 1: 1.25}
_RANGES = {"normal": 0, "sensitive": 1} _RANGES = {"normal": 0, "sensitive": 1}
@@ -70,9 +70,10 @@ _RANGES = {"normal": 0, "sensitive": 1}
# unknown -- SFM writes what Blastware writes. Series 3 only. # unknown -- SFM writes what Blastware writes. Series 3 only.
S3_BLASTWARE_FIXED = {26: b"\x00\x00"} S3_BLASTWARE_FIXED = {26: b"\x00\x00"}
# A Series-3 alarm-level write has never been seen; the bench measures one, with # Measured at the bench 2026-11-04 (BE9441, Brian's go): 1.0 -> 1.5 -> 1.0 in/s,
# Brian's go, before this turns on. # each acknowledged, read back, and shown in the unit's own setup menu; the write
S3_ALARM_WRITE_MEASURED = False # moved exactly channel +39 of the three geophones (the f32 at +38).
S3_ALARM_WRITE_MEASURED = True
MODES = { MODES = {
3: {"single_shot": 0x00, "continuous": 0x01, "histogram": 0x03, "histogram_continuous": 0x04}, 3: {"single_shot": 0x00, "continuous": 0x01, "histogram": 0x03, "histogram_continuous": 0x04},
+9 -6
View File
@@ -22,6 +22,7 @@ from .opcodes import CROSS_SERIES_COLLISIONS, WRITE_SUBS, OpcodeRefused
from .setup_block import crc_ok from .setup_block import crc_ok
_CONFIRM = 0xFFFF _CONFIRM = 0xFFFF
_CALL_HOME_OBSERVED = (0x00, 0x01, 0x04, 0x05) # content[5] values units have held
# block content sizes THOR's offsets were observed at (all on UM12947 / 11.0CB) # block content sizes THOR's offsets were observed at (all on UM12947 / 11.0CB)
_PREFS_LEN, _TRIGGER_LEN, _SETUP_LEN, _CALL_HOME_LEN = 90, 28, 2092, 126 _PREFS_LEN, _TRIGGER_LEN, _SETUP_LEN, _CALL_HOME_LEN = 90, 28, 2092, 126
@@ -113,9 +114,10 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
Bit 0 of `[5]` is the enable. 🔶 UM12947 (THOR's unit) read 0x05 enabled / Bit 0 of `[5]` is the enable. 🔶 UM12947 (THOR's unit) read 0x05 enabled /
0x04 disabled, bit 2 set in both; UM20147 reads 0x01 (measured, phase-2 dry 0x04 disabled, bit 2 set in both; UM20147 reads 0x01 (measured, phase-2 dry
run). So on UM20147 "off" writes 0x00, a value no capture shows being run). So on UM20147 "off" writes 0x00 -- measured at the bench 2026-11-03
written: the target value there is unobserved, and the plan's `warnings` (and again 11-04): 0x01 <-> 0x00 acknowledged, read back, and matched in the
say so. `[118:120]` is unit-maintained and THOR echoes it. unit's own menu. A value outside those four still carries a warning.
`[118:120]` is unit-maintained and THOR echoes it.
""" """
if len(call_home) != _CALL_HOME_LEN: if len(call_home) != _CALL_HOME_LEN:
raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B " raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B "
@@ -128,9 +130,10 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
what = "call-home " + ("enable" if enabled else "disable") what = "call-home " + ("enable" if enabled else "disable")
start = call_home[5] start = call_home[5]
warnings = [] warnings = []
if start not in (0x04, 0x05) or b5 not in (0x04, 0x05): if start not in _CALL_HOME_OBSERVED or b5 not in _CALL_HOME_OBSERVED:
warnings.append(f"content[5] 0x{start:02X} -> 0x{b5:02X}: THOR was only ever " warnings.append(f"content[5] 0x{start:02X} -> 0x{b5:02X}: no unit has been seen "
"seen writing 0x04/0x05 (UM12947); this value is unobserved") "holding this value (0x04/0x05 UM12947 by THOR, 0x00/0x01 UM20147 "
"by SFM); it is unobserved")
if b5 == start: if b5 == start:
warnings.append(f"the unit is already call-home {'enabled' if enabled else 'disabled'}" warnings.append(f"the unit is already call-home {'enabled' if enabled else 'disabled'}"
" -- this write changes nothing") " -- this write changes nothing")
+4
View File
@@ -633,6 +633,10 @@ class MiniMateProtocol:
data_rsp = self._recv_one(expected_sub=rsp_sub) data_rsp = self._recv_one(expected_sub=rsp_sub)
raw = unescape_reply(data_rsp.data)[11:] # unescaped, as read_event_index raw = unescape_reply(data_rsp.data)[11:] # unescaped, as read_event_index
# An escaped checksum byte leaves its 0x10 behind (bench 2026-11-04; see
# assemble_compliance_content): one stray byte beyond what was asked is dropped.
if len(raw) == length + 1 and raw[-1:] == b"\x10":
raw = raw[:-1]
log.debug("read_waveform_data_raw: got %d bytes", len(raw)) log.debug("read_waveform_data_raw: got %d bytes", len(raw))
return raw return raw
+7 -2
View File
@@ -69,7 +69,12 @@ _S3_SETTINGS_STEPS = ((0x68, "event index (as read)"), (0x73, "confirm B"),
(0x82, "trigger block (as read)"), (0x83, "trigger confirm"), (0x82, "trigger block (as read)"), (0x83, "trigger confirm"),
(0x69, "waveform data (as read)"), (0x74, "confirm C"), (0x72, "confirm A")) (0x69, "waveform data (as read)"), (0x74, "confirm C"), (0x72, "confirm A"))
_S3_TAIL_WARNING = ("the two bytes after the settings block go out as 00 00 (Blastware sends " _S3_TAIL_WARNING = ("the two bytes after the settings block go out as 00 00 (Blastware sends "
"its own constant; effect unmeasured)") "its own constant; the unit took it at the bench 2026-11-04)")
# Measured at the bench 2026-11-04 (BE9441): a write sent while the setup menu was open
# was acknowledged and read back, then lost when the operator pressed Cancel or Save --
# the menu writes its own copy of the whole block back.
_S3_MENU_WARNING = ("if someone is in this unit's setup menu, this change is lost when they "
"leave it (Cancel or Save writes the menu's copy back)")
S3_RUN_STATES = {0x00: "idle", 0x10: "monitoring", 0x0B: "monitoring"} S3_RUN_STATES = {0x00: "idle", 0x10: "monitoring", 0x0B: "monitoring"}
@@ -525,7 +530,7 @@ class Series3Adapter:
for sub, what in _S3_SETTINGS_STEPS] for sub, what in _S3_SETTINGS_STEPS]
return {"action": "settings write", "blocked": list(st["blocked"]), "steps": steps, return {"action": "settings write", "blocked": list(st["blocked"]), "steps": steps,
"fields": field_rows(st["setup"], st["image"], 3, st["changes"]), "fields": field_rows(st["setup"], st["image"], 3, st["changes"]),
"revision": st["revision"], "warnings": [_S3_TAIL_WARNING]} "revision": st["revision"], "warnings": [_S3_MENU_WARNING, _S3_TAIL_WARNING]}
def send() -> dict: def send() -> dict:
b = st["blocks"] b = st["blocks"]
+8
View File
@@ -231,3 +231,11 @@ def test_push_config_raw_writes_a_logical_block_with_a_literal_escape_byte_intac
c.push_config_raw(b["event_index"], block, b["trigger"], b["waveform"]) c.push_config_raw(b["event_index"], block, b["trigger"], b["waveform"])
sent = b"".join(_payload(f)[16:] for f in t.sent if _payload(f)[2] == 0x71) sent = b"".join(_payload(f)[16:] for f in t.sent if _payload(f)[2] == 0x71)
assert sent == block + b"\x00\x00" assert sent == block + b"\x00\x00"
# Bench 2026-11-04 (BE9441): a write sent while the unit's setup menu was open was
# acknowledged and read back -- and then lost when the operator pressed Cancel or
# Save: the menu writes its own copy of the WHOLE block back. The preview says so.
def test_the_preview_warns_that_an_open_setup_menu_loses_the_change():
r = change(FakeMiniMateClient(), {"geo_trigger_ips": 0.05}, dry_run=True)
assert any("setup menu" in w and "lost" in w for w in r.plan["warnings"])
+12 -2
View File
@@ -193,12 +193,22 @@ def test_steps_cannot_be_reassigned():
def test_call_home_off_from_an_unobserved_start_value_carries_a_warning(): def test_call_home_off_from_an_unobserved_start_value_carries_a_warning():
r = bytearray(_call_home_reads()[0]) r = bytearray(_call_home_reads()[0])
r[5] = 0x01 # UM20147 reads 0x01, not THOR's 0x04/0x05 r[5] = 0x03 # a value no unit has been seen holding
plan = plan_call_home_enabled(bytes(r), False) plan = plan_call_home_enabled(bytes(r), False)
assert any("unobserved" in w and "0x01 -> 0x00" in w for w in plan.warnings) assert any("unobserved" in w and "0x03 -> 0x02" in w for w in plan.warnings)
assert plan.describe()["warnings"] and plan.describe()["warnings"] == list(plan.warnings) assert plan.describe()["warnings"] and plan.describe()["warnings"] == list(plan.warnings)
@pytest.mark.parametrize("start,enabled", [(0x01, False), (0x00, True)])
def test_um20147s_values_are_observed_since_the_bench(start, enabled):
# Bench 2026-11-03 (UM20147): 0x01 -> 0x00 and 0x00 -> 0x01 both acknowledged, read
# back, and matched in the unit's own menu (and again 2026-11-04).
r = bytearray(_call_home_reads()[0])
r[5] = start
plan = plan_call_home_enabled(bytes(r), enabled)
assert not any("unobserved" in w for w in plan.warnings)
def test_call_home_on_when_already_on_says_it_changes_nothing(): def test_call_home_on_when_already_on_says_it_changes_nothing():
r = next(x for x in _call_home_reads() if x[5] == 0x05) r = next(x for x in _call_home_reads() if x[5] == 0x05)
plan = plan_call_home_enabled(r, True) plan = plan_call_home_enabled(r, True)
+28
View File
@@ -121,3 +121,31 @@ def test_a_leftover_that_is_not_the_stray_escape_is_not_trimmed():
sfm_read = READS[8] sfm_read = READS[8]
odd = [sfm_read[0] + b"\x55", sfm_read[1], sfm_read[2]] odd = [sfm_read[0] + b"\x55", sfm_read[1], sfm_read[2]]
assert not is_compliance_content(assemble_compliance_content(odd, lengths=(1024, 1024, 42))) assert not is_compliance_content(assemble_compliance_content(odd, lengths=(1024, 1024, 42)))
# The same artifact on the waveform-data read a settings write echoes back: it asks
# for 0xCA = 202 bytes; one extra trailing 0x10 is the escaped checksum's DLE.
# (Unfixed, it fails closed: the write's own block check refuses 203 bytes.)
class _Replies:
def __init__(self, data):
self._data = data
self.sent = []
def __call__(self, frame):
self.sent.append(frame)
def _waveform_proto(data_reply: bytes):
from types import SimpleNamespace
p = mp.MiniMateProtocol(object())
p._send = _Replies(None)
replies = [SimpleNamespace(data=bytes(11)), SimpleNamespace(data=bytes(11) + data_reply)]
p._recv_one = lambda expected_sub=None, **kw: replies.pop(0)
return p
def test_the_waveform_read_drops_an_escaped_checksums_stray_byte():
block = (200).to_bytes(2, "big") + bytes(range(198)) + b"\x17\x17" # N = 200, plus its 2 tail bytes
assert _waveform_proto(block).read_waveform_data_raw() == block
assert _waveform_proto(block + b"\x10").read_waveform_data_raw() == block
assert _waveform_proto(block + b"\x55").read_waveform_data_raw() == block + b"\x55" # anything else is kept
+10 -4
View File
@@ -196,11 +196,17 @@ def test_field_not_offered_for_the_series():
_refused(S4_BLOCK, 4, {"no_such_field": 1}) _refused(S4_BLOCK, 4, {"no_such_field": 1})
def test_alarm_is_read_only_until_measured(): def test_the_alarm_is_writable_since_the_bench():
assert sf.S3_ALARM_WRITE_MEASURED is False # Bench 2026-11-04, BE9441: 1.0 -> 1.5 -> 1.0, each acknowledged, read back and
_refused(S3_BLOCK, 3, {"geo_alarm_ips": 1.0}) # shown in the unit's own setup menu; the write moved exactly channel +39 of the
# three geophones (the f32 at +38).
assert sf.S3_ALARM_WRITE_MEASURED is True
assert check_changes(S3_BLOCK, 3, {"geo_alarm_ips": 1.5}) == {"geo_alarm_ips": 1.5}
alarm = next(d for d in editable_fields(S3_BLOCK, 3) if d["field"] == "geo_alarm_ips") alarm = next(d for d in editable_fields(S3_BLOCK, 3) if d["field"] == "geo_alarm_ips")
assert alarm["readonly"] is True assert alarm["readonly"] is False
out = encode_setup(S3_BLOCK, 3, {"geo_alarm_ips": 1.5})
assert [i for i in range(2090) if out[i] != S3_BLOCK[i] and i not in (26, 27)] == [1747, 1795, 1843]
_refused(S4_BLOCK, 4, {"geo_alarm_ips": 1.5}) # still Series 3 only
def _with_unit(block: bytes, unit: bytes) -> bytes: def _with_unit(block: bytes, unit: bytes) -> bytes: