capture: dedicate IQ segment (tee throttled writes to 1.5%), bound IQ window
This commit is contained in:
+13
-6
@@ -17,6 +17,7 @@ cd "$(dirname "$0")/.."
|
||||
DUR=$1; OUT=$2; IQ=$3; GAIN=${4:-42.1}; IQ_SEGMENTS=${5:-1}
|
||||
|
||||
SEG=${SEG_SECONDS:-140} # below the observed tuner death point
|
||||
IQ_SEG=${IQ_SEG_SECONDS:-90} # bounded IQ window (~290 MB)
|
||||
RATE=1600000
|
||||
|
||||
: > "$OUT"
|
||||
@@ -52,12 +53,18 @@ while :; do
|
||||
echo "--- segment $segments: ${this}s (gain $GAIN)" >> "$ERR"
|
||||
t0=$(date +%s)
|
||||
if [ "$segments" -le "$IQ_SEGMENTS" ]; then
|
||||
# keep IQ for the first segments only; bounded so disk use is known
|
||||
timeout $((this + 20)) rtl_sdr -f 868950000 -s "$RATE" -g "$GAIN" \
|
||||
-n $((this * RATE)) - 2>>"$ERR" \
|
||||
| tee -a "$IQ" \
|
||||
| rtl_wmbus -f >> "$OUT" 2>/dev/null || true
|
||||
iq_seconds=$((iq_seconds + this))
|
||||
# IQ segment: write samples straight to disk with no decoder in the
|
||||
# pipeline. Feeding rtl_wmbus through tee throttled the writer and
|
||||
# only 1.5 % of the samples reached the file. The IQ proof needs
|
||||
# firmware TX timestamps, not decodes, so the two do not have to be
|
||||
# simultaneous -- and the IQ still contains both our transmissions
|
||||
# and meter bursts, so relative levels remain measurable.
|
||||
iqlen=$(( this < IQ_SEG ? this : IQ_SEG ))
|
||||
timeout $((iqlen + 20)) rtl_sdr -f 868950000 -s "$RATE" -g "$GAIN" \
|
||||
-n $((iqlen * RATE)) "$IQ.seg" 2>>"$ERR" || true
|
||||
cat "$IQ.seg" >> "$IQ" 2>/dev/null || true
|
||||
rm -f "$IQ.seg"
|
||||
iq_seconds=$((iq_seconds + iqlen))
|
||||
else
|
||||
timeout $((this + 20)) rtl_sdr -f 868950000 -s "$RATE" -g "$GAIN" \
|
||||
-n $((this * RATE)) - 2>>"$ERR" \
|
||||
|
||||
Reference in New Issue
Block a user