firmware: runtime preamble-detector length; generalized single-variable A/B harness

This commit is contained in:
Lars Nolden
2026-09-01 11:30:00 +02:00
parent 6bdcb2acad
commit 697e10e8cf
6 changed files with 160 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Controlled A/B of one runtime RF parameter, receiver-only (no SDR).
#
# Changes exactly one variable between two equal-length arms on the same
# meter population, with retransmission disabled so the receiver is measured
# in isolation. Meter traffic varies, so only large differences mean
# anything -- the report says so explicitly.
#
# Usage: param_ab.sh KEY VALUE_A VALUE_B [SECONDS_PER_ARM]
# e.g. param_ab.sh preamble_bits 8 16 900
# param_ab.sh fem_rx_csd 1 0 600
set -euo pipefail
cd "$(dirname "$0")/.."
KEY=$1; VA=$2; VB=$3; DUR=${4:-900}
PY=./result-py/bin/python3
eval "$(./tools/discover_devices.sh)"
OUT="captures/$(date +%Y-%m-%dT%H-%M-%S)-ab-$KEY"
mkdir -p "$OUT"
echo "DUT: $DUT_PORT"
echo "variable: $KEY arms: $VA vs $VB ${DUR}s each"
for V in "$VA" "$VB"; do
label="${KEY}_${V}"
echo "--- arm: $label"
$PY hil/dut_cmd.py "$DUT_PORT" --listen 4 \
"set repeat_enabled 0" "set $KEY $V" "clear_stats" \
> "$OUT/$label.setup.log" 2>&1
sleep 4
$PY hil/dut_cmd.py "$DUT_PORT" --listen "$DUR" status > "$OUT/$label.log" 2>&1
$PY hil/dut_cmd.py "$DUT_PORT" --listen 5 stats >> "$OUT/$label.log" 2>&1
done
# restore
$PY hil/dut_cmd.py "$DUT_PORT" --listen 4 \
"set $KEY $VA" "set repeat_enabled 1" > "$OUT/restore.log" 2>&1
$PY hil/param_ab_report.py "$OUT" "$KEY" "$VA" "$VB" | tee "$OUT/report.txt"
echo "artifacts: $OUT"