46 lines
1.1 KiB
Bash
Executable File
46 lines
1.1 KiB
Bash
Executable File
#!/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:phase \
|
|
"tty:${TTY_PATH}" \
|
|
"$@"
|