Merge pull request #71 from phl0/displaySmeter

Display S-meter
This commit is contained in:
Kim - DG9VH 2017-01-08 18:27:12 +01:00 committed by GitHub
commit e9bf785a5c
10 changed files with 82 additions and 4 deletions

46
css/tooltip.css Normal file
View file

@ -0,0 +1,46 @@
/* Tooltip container */
.tooltip2 {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip2 .tooltip2text {
visibility: hidden;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text */
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -60px;
/* Fade in tooltip */
opacity: 0;
transition: opacity 1s;
}
/* Tooltip arrow */
.tooltip2 .tooltip2text::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip2:hover .tooltip2text {
visibility: visible;
opacity: 1;
}

BIN
images/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

BIN
images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

BIN
images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

BIN
images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

View file

@ -256,7 +256,22 @@ function getHeardList($logLines, $onlyLast) {
// and RSSI in BER position // and RSSI in BER position
if (startsWith($loss,"BER")) { if (startsWith($loss,"BER")) {
if (substr($ber, 6) != "-0/-0/-0 dBm") { if (substr($ber, 6) != "-0/-0/-0 dBm") {
$rssi = substr($ber, 6); $rssiString = substr($ber, 6);
$rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
if ($rssiAvg > "-53") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+40dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-63") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+30dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-73") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+20dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-83") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+10dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-93") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-99") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S8 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-105") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S7 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-111") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S6 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-117") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S5 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-123") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S4 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-129") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S3 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-135") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S2 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-141") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S1 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S0 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
} }
$ber = substr($loss, 5); $ber = substr($loss, 5);
$loss = ""; $loss = "";
@ -266,7 +281,22 @@ function getHeardList($logLines, $onlyLast) {
$ber = substr($lineTokens[4], 5); $ber = substr($lineTokens[4], 5);
} }
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") {
$rssi = substr($lineTokens[5], 6); $rssiString = substr($lineTokens[5], 6);
$rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
if ($rssiAvg > "-53") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+40dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-63") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+30dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-73") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+20dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-83") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+10dB ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-93") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-99") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S8 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-105") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S7 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-111") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S6 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-117") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S5 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-123") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S4 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-129") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S3 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-135") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S2 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiAvg > "-141") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S1 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S0 ($rssiAvg dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
} }
} }

View file

@ -28,7 +28,7 @@ $localTXList = getHeardList($reverseLogLinesMMDVM, FALSE);
<th>Dur (s)</th> <th>Dur (s)</th>
<th>Loss</th> <th>Loss</th>
<th>BER</th> <th>BER</th>
<th>RSSI (min/max/avg)</th> <th>RSSI</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -25,7 +25,7 @@ $totalLH = count($lastHeard);
<th>Dur (s)</th> <th>Dur (s)</th>
<th>Loss</th> <th>Loss</th>
<th>BER</th> <th>BER</th>
<th>RSSI (min/max/avg)</th> <th>RSSI</th>
</tr> </tr>
</thead> </thead>
</table> </table>

View file

@ -21,6 +21,8 @@ include "version.php";
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.6,maximum-scale=1, user-scalable=yes"> <meta name="viewport" content="width=device-width, initial-scale=0.6,maximum-scale=1, user-scalable=yes">
<!-- CSS for tooltip display -->
<link rel="stylesheet" href="css/tooltip.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<!-- Das neueste kompilierte und minimierte CSS --> <!-- Das neueste kompilierte und minimierte CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">