From 55c7b7b5ae065356eb63669484accfa170eeea8e Mon Sep 17 00:00:00 2001 From: serversdown Date: Wed, 4 Nov 2026 16:12:58 -0500 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 --- micromate/setup_fields.py | 9 +++++---- tests/test_setup_fields.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/micromate/setup_fields.py b/micromate/setup_fields.py index d4008cc..c9e23d5 100644 --- a/micromate/setup_fields.py +++ b/micromate/setup_fields.py @@ -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_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_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} _RANGES = {"normal": 0, "sensitive": 1} @@ -70,9 +70,10 @@ _RANGES = {"normal": 0, "sensitive": 1} # unknown -- SFM writes what Blastware writes. Series 3 only. S3_BLASTWARE_FIXED = {26: b"\x00\x00"} -# A Series-3 alarm-level write has never been seen; the bench measures one, with -# Brian's go, before this turns on. -S3_ALARM_WRITE_MEASURED = False +# Measured at the bench 2026-11-04 (BE9441, Brian's go): 1.0 -> 1.5 -> 1.0 in/s, +# each acknowledged, read back, and shown in the unit's own setup menu; the write +# moved exactly channel +39 of the three geophones (the f32 at +38). +S3_ALARM_WRITE_MEASURED = True MODES = { 3: {"single_shot": 0x00, "continuous": 0x01, "histogram": 0x03, "histogram_continuous": 0x04}, diff --git a/tests/test_setup_fields.py b/tests/test_setup_fields.py index ea15a23..3313cf7 100644 --- a/tests/test_setup_fields.py +++ b/tests/test_setup_fields.py @@ -196,11 +196,17 @@ def test_field_not_offered_for_the_series(): _refused(S4_BLOCK, 4, {"no_such_field": 1}) -def test_alarm_is_read_only_until_measured(): - assert sf.S3_ALARM_WRITE_MEASURED is False - _refused(S3_BLOCK, 3, {"geo_alarm_ips": 1.0}) +def test_the_alarm_is_writable_since_the_bench(): + # Bench 2026-11-04, BE9441: 1.0 -> 1.5 -> 1.0, each acknowledged, read back and + # 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") - 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: