From 373ef905f714436c705be2480b7982dd2e39c9ac Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Fri, 20 Sep 2024 22:47:00 +0200 Subject: [PATCH 1/3] Revert "non telegraf version also needs python" This reverts commit 7f820d0f554395b544e0e674b2981d982486ca00. red herring, the stats.py script is no longer used for autogain script --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bd0c029..cd76b28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ RUN set -x && \ TEMP_PACKAGES+=(curl) && \ # Required for nicer logging. KEPT_PACKAGES+=(gawk) && \ - KEPT_PACKAGES+=(python3) && \ + ##telegraf##KEPT_PACKAGES+=(python3) && \ # uat2esnt dependencies (+ telegraf) KEPT_PACKAGES+=(socat) && \ # healthcheck dependencies From def6803892bba6dfb375f4c70b8c36ded7106240 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Sun, 22 Sep 2024 15:53:33 +0200 Subject: [PATCH 2/3] fix autogain for dump978 RSSI value output > 0 autogain script is ignoring rssi values > 0, fix that this was making autogain very slow to adjust if all received signals were very strong and only a couple were < 0 --- rootfs/etc/s6-overlay/scripts/autogain | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rootfs/etc/s6-overlay/scripts/autogain b/rootfs/etc/s6-overlay/scripts/autogain index 1df1b3e..0ac97be 100755 --- a/rootfs/etc/s6-overlay/scripts/autogain +++ b/rootfs/etc/s6-overlay/scripts/autogain @@ -35,7 +35,7 @@ function collect_gain_values() { local rssi local endtime local cutoff="${2:--3.5}" - cutoff="$(bc -l <<< "scale=0; ${cutoff/#-} * 10 / 1")" + cutoff="$(bc -l <<< "scale=0; ${cutoff} * 10 / 1")" unset GAIN_COLLECTION if [[ -z "$1" ]]; then @@ -57,7 +57,7 @@ function collect_gain_values() { # create a FD with a data stream of rssi values if chk_enabled "$READSB_AUTOGAIN_USE_RAW"; then # parse all messages that have an ";rssi=-xx.xx" element, regardless of any error indicators - while ! exec 3< <(stdbuf -oL sed -n 's|^.*;rssi=-\([0-9]\+\)\.\([0-9]*\);.*$|\1\2|p' /dev/null) 2>/dev/null; do + while ! exec 3< <(stdbuf -oL sed -n 's|^.*;rssi=\([0-9-]\+\)\.\([0-9]*\);.*$|\1\2|p' /dev/null) 2>/dev/null; do sleep 5 exec 3>&- done @@ -65,7 +65,7 @@ function collect_gain_values() { # ignore messages that have anything between the raw message string and ";rssi=" # These messages have an error code ";ts=x" between the raw msg and the rssi element # In that case, we're only considering "accepted" messages - while ! exec 3< <(stdbuf -oL sed -n 's|^-[0-9a-f]*;rssi=-\([0-9]\+\)\.\([0-9]*\);.*$|\1\2|p' /dev/null) 2>/dev/null; do + while ! exec 3< <(stdbuf -oL sed -n 's|^-[0-9a-f]*;rssi=\([0-9-]\+\)\.\([0-9]*\);.*$|\1\2|p' /dev/null) 2>/dev/null; do sleep 5 exec 3>&- done @@ -76,8 +76,8 @@ function collect_gain_values() { starttime="$(date +%s)" while IFS= read -r rssi <&3; do (( total_msg++ )) || true - (( ${rssi##0} < cutoff )) && (( strong_msg++ )) || true - # read messages until we have least READSB_AUTOGAIN_MIN_SAMPLES, and the max time is exhausted + (( ${rssi##0} > cutoff )) && (( strong_msg++ )) || true +s6wrap --quiet --timestamps --prepend autogain echo "sample count: $total_msg" # in other words - even if the max time expires, continue collecting messages until at least the minimum has been reached if (( total_msg >= READSB_AUTOGAIN_MIN_SAMPLES )) && (( $(date +%s) > starttime + $1 )); then break From f24096bf8995331e0e2ff6c9df91d71a5b0455a4 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Sun, 22 Sep 2024 15:58:21 +0200 Subject: [PATCH 3/3] make it a bit easier to see which autogain script is used --- rootfs/scripts/autogain.sh | 2 ++ rootfs/usr/local/bin/autogain978 | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rootfs/scripts/autogain.sh b/rootfs/scripts/autogain.sh index 641c1a6..5fa057e 100755 --- a/rootfs/scripts/autogain.sh +++ b/rootfs/scripts/autogain.sh @@ -1,6 +1,8 @@ #!/command/with-contenv bash # shellcheck shell=bash +# !!! DEPRECATED !!! + # If troubleshooting: if [[ -n "$DEBUG_LOGGING" ]]; then set -x diff --git a/rootfs/usr/local/bin/autogain978 b/rootfs/usr/local/bin/autogain978 index a5902f5..36f828a 100755 --- a/rootfs/usr/local/bin/autogain978 +++ b/rootfs/usr/local/bin/autogain978 @@ -3,6 +3,9 @@ # This script is only for dump978 autogain +# called by /etc/s6-overlay/scripts/autogain +# or called manually by the user to reset autogain + source /scripts/common READSB_AUTOGAIN_LOW_PCT="${DUMP978_AUTOGAIN_LOW_PCT:-${READSB_AUTOGAIN_LOW_PCT:-5.0}}" @@ -148,4 +151,4 @@ s6-svc -r /run/service/stats 2>/dev/null || true #reset numbers echo 0 > $autogain_dir/strong -echo 0 > $autogain_dir/total \ No newline at end of file +echo 0 > $autogain_dir/total