hil: beacon soak harness, meter_anchored empty-capture guard; antenna swap + IPEX reseat: 74/74 TX with RF post-swap
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Long-running beacon soak: segmented captures, meter-anchored verdict per
|
||||||
|
# segment, dongle auto-recovery. Appends one JSON line per segment.
|
||||||
|
# Usage: beacon_soak.sh SEGMENTS [SEG_SECONDS]
|
||||||
|
set -u
|
||||||
|
SEGS=${1:-30}
|
||||||
|
DUR=${2:-120}
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
OUT="captures/$(date +%Y-%m-%dT%H-%M-%S)-beacon-soak"
|
||||||
|
mkdir -p "$OUT"
|
||||||
|
echo "soak dir: $OUT"
|
||||||
|
for i in $(seq 1 "$SEGS"); do
|
||||||
|
P=$(ls /dev/serial/by-id/usb-Espressif* 2>/dev/null | head -1)
|
||||||
|
if [ -z "$P" ]; then
|
||||||
|
echo "{\"seg\":$i,\"error\":\"dut_gone\",\"t\":$(date +%s)}" >> "$OUT/soak.jsonl"
|
||||||
|
sleep 30; continue
|
||||||
|
fi
|
||||||
|
D="$OUT/seg$i"
|
||||||
|
mkdir -p "$D"
|
||||||
|
( timeout $((DUR + 8)) rtl_sdr -f 868950000 -s 1600000 -g 42.1 \
|
||||||
|
-n $((DUR * 1600000)) "$D/iq.raw" 2>"$D/rtl_sdr.err" ) &
|
||||||
|
./result-py/bin/python3 hil/dut_cmd.py "$P" --listen $((DUR + 4)) \
|
||||||
|
> "$D/serial.log" 2>&1
|
||||||
|
wait
|
||||||
|
V=$(./result-py/bin/python3 hil/meter_anchored.py \
|
||||||
|
--iq "$D/iq.raw" --serial "$D/serial.log" --json 2>/dev/null)
|
||||||
|
RC=$?
|
||||||
|
if [ -n "$V" ]; then
|
||||||
|
echo "$V" | ./result-py/bin/python3 -c \
|
||||||
|
"import json,sys,time; d=json.load(sys.stdin); d['seg']=$i; d['rc']=$RC; d['t']=int(time.time()); print(json.dumps(d))" \
|
||||||
|
>> "$OUT/soak.jsonl"
|
||||||
|
else
|
||||||
|
echo "{\"seg\":$i,\"rc\":$RC,\"error\":\"no_verdict\",\"t\":$(date +%s)}" >> "$OUT/soak.jsonl"
|
||||||
|
fi
|
||||||
|
# keep disk bounded: drop IQ after verdict, keep serial
|
||||||
|
rm -f "$D/iq.raw"
|
||||||
|
if [ "$RC" = "3" ]; then
|
||||||
|
usbreset 0bda:2838 >/dev/null 2>&1
|
||||||
|
sleep 8
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "soak complete: $OUT/soak.jsonl"
|
||||||
@@ -86,6 +86,10 @@ def main():
|
|||||||
rx, tx = parse_serial(args.serial)
|
rx, tx = parse_serial(args.serial)
|
||||||
strong = [r for r in rx
|
strong = [r for r in rx
|
||||||
if r.get("rssi_dbm", -99) > args.rssi_min and r.get("timestamp_us")]
|
if r.get("rssi_dbm", -99) > args.rssi_min and r.get("timestamp_us")]
|
||||||
|
if len(bursts) < 5:
|
||||||
|
print(f"only {len(bursts)} bursts in IQ ({len(db)/1000.0:.0f}s) -- "
|
||||||
|
"capture empty or observer dead", file=sys.stderr)
|
||||||
|
sys.exit(3)
|
||||||
if len(strong) < 5:
|
if len(strong) < 5:
|
||||||
print(f"only {len(strong)} strong meter anchors -- cannot fit clock",
|
print(f"only {len(strong)} strong meter anchors -- cannot fit clock",
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
|||||||
Reference in New Issue
Block a user