noise sub mode

This commit is contained in:
awe
2026-04-24 14:10:47 +03:00
parent bee128dec7
commit 4a0740539b
2 changed files with 294 additions and 28 deletions

45
run_do1_noise_subtract.sh Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
BIN="${BIN:-./main.exe}"
TTY_PATH="${TTY_PATH:-/tmp/ttyADC_data}"
LIB_DIR="${LIB_DIR:-$HOME/.local/lib}"
NOISE_AVG_STEPS="${NOISE_AVG_STEPS:-}"
if [[ ! -x "$BIN" ]]; then
echo "Binary '$BIN' not found or not executable. Run ./build_main.sh first." >&2
exit 1
fi
if [[ -z "$NOISE_AVG_STEPS" ]]; then
echo "Set NOISE_AVG_STEPS to a positive integer, for example: NOISE_AVG_STEPS=16" >&2
exit 1
fi
if ! [[ "$NOISE_AVG_STEPS" =~ ^[0-9]+$ ]] || [[ "$NOISE_AVG_STEPS" -eq 0 ]]; then
echo "NOISE_AVG_STEPS must be a positive integer, got '$NOISE_AVG_STEPS'" >&2
exit 1
fi
if [[ -d "$LIB_DIR" ]]; then
export LD_LIBRARY_PATH="${LIB_DIR}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
fi
exec "$BIN" \
clock:internal \
internal_ref_hz:2000000 \
start:di_syn2_rise \
stop:di_syn2_fall \
sample_clock_hz:max \
range:5 \
duration_ms:100 \
packet_limit:0 \
do1_toggle_per_frame \
do1_noise_subtract \
"noise_avg_steps:${NOISE_AVG_STEPS}" \
profile:amplitude \
"tty:${TTY_PATH}" \
"$@"