From 163b358db350d584749d6e95de836974b014781c Mon Sep 17 00:00:00 2001 From: "Florian (DF2ET)" Date: Thu, 19 Jan 2017 00:03:37 +0100 Subject: [PATCH] Make displayed RSSI value selectable (#90) --- include/functions.php | 62 ++++++++++++++++++++++------------------ include/localtx_ajax.php | 7 ++++- setup.php | 9 ++++++ 3 files changed, 49 insertions(+), 29 deletions(-) diff --git a/include/functions.php b/include/functions.php index fa57025..a0ee98e 100644 --- a/include/functions.php +++ b/include/functions.php @@ -269,20 +269,23 @@ function getHeardList($logLines, $onlyLast) { if (startsWith($loss,"BER")) { if (substr($ber, 6) != "-0/-0/-0 dBm") { $rssiString = substr($ber, 6); - $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); - if ($rssiAvg > "-53") $rssi = "
S9+40dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-63") $rssi = "
S9+30dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-73") $rssi = "
S9+20dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-83") $rssi = "
S9+10dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-93") $rssi = "
S9 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-99") $rssi = "
S8 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-105") $rssi = "
S7 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-111") $rssi = "
S6 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-117") $rssi = "
S5 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-123") $rssi = "
S4 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-129") $rssi = "
S3 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-135") $rssi = "
S2 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-141") $rssi = "
S1 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "max") $rssiVal = preg_replace('/-\d+\/(-\d+)\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + else $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + if ($rssiVal > "-53") $rssi = "
S9+40dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-63") $rssi = "
S9+30dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-73") $rssi = "
S9+20dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-83") $rssi = "
S9+10dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-93") $rssi = "
S9 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-99") $rssi = "
S8 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-105") $rssi = "
S7 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-111") $rssi = "
S6 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-117") $rssi = "
S5 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-123") $rssi = "
S4 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-129") $rssi = "
S3 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-135") $rssi = "
S2 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-141") $rssi = "
S1 ($rssiVal dBm)(min/max/avg)
$rssiString
"; } $ber = substr($loss, 5); $loss = ""; @@ -293,20 +296,23 @@ function getHeardList($logLines, $onlyLast) { } if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { $rssiString = substr($lineTokens[5], 6); - $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); - if ($rssiAvg > "-53") $rssi = "
S9+40dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-63") $rssi = "
S9+30dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-73") $rssi = "
S9+20dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-83") $rssi = "
S9+10dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-93") $rssi = "
S9 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-99") $rssi = "
S8 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-105") $rssi = "
S7 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-111") $rssi = "
S6 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-117") $rssi = "
S5 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-123") $rssi = "
S4 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-129") $rssi = "
S3 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-135") $rssi = "
S2 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-141") $rssi = "
S1 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "max") $rssiVal = preg_replace('/-\d+\/(-\d+)\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + else $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + if ($rssiVal > "-53") $rssi = "
S9+40dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-63") $rssi = "
S9+30dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-73") $rssi = "
S9+20dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-83") $rssi = "
S9+10dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-93") $rssi = "
S9 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-99") $rssi = "
S8 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-105") $rssi = "
S7 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-111") $rssi = "
S6 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-117") $rssi = "
S5 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-123") $rssi = "
S4 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-129") $rssi = "
S3 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-135") $rssi = "
S2 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-141") $rssi = "
S1 ($rssiVal dBm)(min/max/avg)
$rssiString
"; } } diff --git a/include/localtx_ajax.php b/include/localtx_ajax.php index 1ef5e27..a7acfa8 100644 --- a/include/localtx_ajax.php +++ b/include/localtx_ajax.php @@ -25,7 +25,12 @@ $totalLH = count($lastHeard); Dur (s) Loss BER - RSSI + RSSI (min)"; + else if (constant("RSSI") == "max") echo "RSSI (max)"; + else if (constant("RSSI") == "avg") echo "RSSI (avg)"; + else echo "RSSI (avg)"; + ?> diff --git a/setup.php b/setup.php index c5912f9..cb575de 100644 --- a/setup.php +++ b/setup.php @@ -286,6 +286,15 @@ get_tz_options(constant("TIMEZONE"), "Timezone", ''); Show link to QRZ.com on Callsigns
>
+
+ RSSI value +
+
+