From 2dcf553ca2c709fc3cb8d8866c67a7ddd00d0089 Mon Sep 17 00:00:00 2001 From: IZ7BOJ <38103662+IZ7BOJ@users.noreply.github.com> Date: Thu, 19 Mar 2020 10:52:54 +0100 Subject: [PATCH] Update RSSI and BER for YSF for very short RF packets (typically 0.4sec) and for "X" button requests, BER sometimes is not present in the log line. RSSI is in BER position. --- include/functions.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/functions.php b/include/functions.php index 62188c7..68e1d8e 100644 --- a/include/functions.php +++ b/include/functions.php @@ -366,12 +366,20 @@ function getHeardList($logLines, $onlyLast) { $ber = substr($loss, 5); $loss = ""; } else { - $loss = strtok($loss, " "); - if (array_key_exists(4,$lineTokens)) { - $ber = substr($lineTokens[4], 5); - } - if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { - $rssiString = substr($lineTokens[5], 6); + if (startsWith($loss,"RSSI:")) { //for short RF packets and "X" button requests, BER sometimes in not showed. RSSI is in BER position + $loss=""; + $ber = ""; + $rssiString = substr($lineTokens[3], 6); + } else { + $loss = strtok($loss, " "); + if (array_key_exists(4,$lineTokens)) { + $ber = substr($lineTokens[4], 5); + } + $rssiString = substr($lineTokens[5], 6); + if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { + $rssiString = substr($lineTokens[5], 6); + } + } 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); @@ -394,7 +402,6 @@ function getHeardList($logLines, $onlyLast) { } else { $rssi = $rssiVal; } - } } if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) {