Files

41 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# KCT8103L LNA (CSD) A/B experiment - Heltec only, no SDR required.
#
# Runs two equal-length RX-only windows on the same meter population, one
# with the FEM enabled in RX (CSD high, LNA path) and one with it disabled
# (CSD low), then reports frame counts, CRC success and RSSI distribution.
#
# Usage: lna_ab.sh [SECONDS_PER_ARM]
set -euo pipefail
cd "$(dirname "$0")/.."
DUR=${1:-600}
PY=./result-py/bin/python3
eval "$(./tools/discover_devices.sh)"
OUT="captures/$(date +%Y-%m-%dT%H-%M-%S)-lna-ab"
mkdir -p "$OUT"
echo "DUT: $DUT_PORT"
echo "arm duration: ${DUR}s each"
# Retransmission off: this measures the receiver only, and avoids radiating
# during a sensitivity comparison.
for arm in 1 0; do
label=$([ "$arm" = 1 ] && echo "csd_high_lna" || echo "csd_low_bypass")
echo "--- arm: $label"
$PY hil/dut_cmd.py "$DUT_PORT" --listen 3 \
"set repeat_enabled 0" "set fem_rx_csd $arm" "clear_stats" radio_reset \
> "$OUT/$label.setup.log" 2>&1
sleep 3
$PY hil/dut_cmd.py "$DUT_PORT" --listen "$DUR" status \
> "$OUT/$label.log" 2>&1
$PY hil/dut_cmd.py "$DUT_PORT" --listen 4 stats >> "$OUT/$label.log" 2>&1
done
# restore normal operation
$PY hil/dut_cmd.py "$DUT_PORT" --listen 3 \
"set fem_rx_csd 1" "set repeat_enabled 1" radio_reset \
> "$OUT/restore.log" 2>&1
$PY hil/lna_report.py "$OUT" | tee "$OUT/report.txt"
echo "artifacts: $OUT"