hil: wmbusmeters link-layer cross-check; firmware duty-cycle accounting

This commit is contained in:
Lars Nolden
2026-09-01 11:31:26 +02:00
parent 697e10e8cf
commit 6633cd6f92
4 changed files with 67 additions and 2 deletions
+25
View File
@@ -103,6 +103,31 @@ if [ "$PROOF" = 1 ]; then
$PY hil/verify_tx.py --serial "$RUN_DIR/proof_serial.log" \
--sdr "$RUN_DIR/proof_sdr.log" --json > "$RUN_DIR/tx_proof.json" 2>&1 || true
cat "$RUN_DIR/tx_proof.txt"
# Second, independent decoder opinion on one of our transmitted frames:
# rtl-wmbus proves it demodulates, wmbusmeters proves the link layer is
# a structurally valid wM-Bus telegram.
FRAME=$(grep -o '"raw":"[0-9A-Fa-f]*"' "$RUN_DIR/proof_serial.log" \
| head -1 | sed 's/.*"raw":"//;s/"//')
if [ -n "${FRAME:-}" ]; then
COOKED=$($PY - "$FRAME" <<'PYCOOK'
import sys
sys.path.insert(0, "hil")
from correlate import cook_a
raw = bytes.fromhex(sys.argv[1])
c = cook_a(raw)
print(c.hex() if c else "")
PYCOOK
)
if [ -n "$COOKED" ]; then
if ./hil/verify_frame_semantics.sh "$COOKED" \
"$RUN_DIR/frame_semantics.txt"; then
echo "wmbusmeters link-layer cross-check: PASS"
else
echo "wmbusmeters link-layer cross-check: FAIL (see frame_semantics.txt)"
fi
fi
fi
fi
# --- phase B: real meter traffic, decodes + IQ from ONE stream -------------