Merge pull request #197 from IZ7BOJ/patch-2

Update RSSI and BER for YSF
This commit is contained in:
Kim - DG9VH 2020-03-19 11:58:11 +01:00 committed by GitHub
commit 2110ce4e7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -365,13 +365,21 @@ function getHeardList($logLines, $onlyLast) {
} }
$ber = substr($loss, 5); $ber = substr($loss, 5);
$loss = ""; $loss = "";
} else {
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 { } else {
$loss = strtok($loss, " "); $loss = strtok($loss, " ");
if (array_key_exists(4,$lineTokens)) { if (array_key_exists(4,$lineTokens)) {
$ber = substr($lineTokens[4], 5); $ber = substr($lineTokens[4], 5);
} }
$rssiString = substr($lineTokens[5], 6);
if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") {
$rssiString = substr($lineTokens[5], 6); $rssiString = substr($lineTokens[5], 6);
}
}
if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $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") == "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 if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
@ -395,7 +403,6 @@ function getHeardList($logLines, $onlyLast) {
$rssi = $rssiVal; $rssi = $rssiVal;
} }
} }
}
if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) { if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) {
switch (substr($logLine, 27, strpos($logLine,",") - 27)) { switch (substr($logLine, 27, strpos($logLine,",") - 27)) {