fix current Mode, renice printing of freq., TNX to Ron, VE1AIC
This commit is contained in:
parent
1afed787e4
commit
39dad5af40
3 changed files with 29 additions and 12 deletions
|
@ -211,15 +211,27 @@ function getLastHeard($logLines) {
|
||||||
return $lastHeard;
|
return $lastHeard;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActualMode($logLines) {
|
function getActualMode($logLines, $mmdvmconfigs) {
|
||||||
// returns mode of repeater actual working in
|
// returns mode of repeater actual working in
|
||||||
array_multisort($logLines,SORT_DESC);
|
$lastHeard = getLastHeard($logLines);
|
||||||
foreach ($logLines as $logLine) {
|
array_multisort($lastHeard,SORT_DESC);
|
||||||
if (strpos($logLine, "Mode set to")) {
|
$listElem = $lastHeard[0];
|
||||||
return substr($logLine, 39);
|
|
||||||
|
$timestamp = new DateTime($listElem[0]);
|
||||||
|
$mode = $listElem[1];
|
||||||
|
if (startsWith($mode, "DMR")) {
|
||||||
|
$mode = "DMR";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$now = new DateTime();
|
||||||
|
$hangtime = getConfigItem("General", "ModeHang", $mmdvmconfigs);
|
||||||
|
$timestamp->add(new DateInterval('PT' . $hangtime . 'S'));
|
||||||
|
|
||||||
|
if ($now->format('U') > $timestamp->format('U')) {
|
||||||
|
return idle;
|
||||||
|
} else {
|
||||||
|
return $mode;
|
||||||
}
|
}
|
||||||
return "Idle";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDSTARLinks() {
|
function getDSTARLinks() {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
echo"<tr>";
|
echo"<tr>";
|
||||||
echo"<td>".getActualMode($logLines)."</td>";
|
echo"<td>".getActualMode($logLines, $mmdvmconfigs)."</td>";
|
||||||
echo"<td>".getActualLink($logLines, "D-Star")."</td>";
|
echo"<td>".getActualLink($logLines, "D-Star")."</td>";
|
||||||
echo"<td>".getActualLink($logLines, "DMR Slot 1")."</td>";
|
echo"<td>".getActualLink($logLines, "DMR Slot 1")."</td>";
|
||||||
echo"<td>".getActualLink($logLines, "DMR Slot 2")."</td>";
|
echo"<td>".getActualLink($logLines, "DMR Slot 2")."</td>";
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>TX-Frq.</th>
|
<th>TX-Freq.</th>
|
||||||
<th>Rx-Frq.</th>
|
<th>Rx-Freq.</th>
|
||||||
<?php
|
<?php
|
||||||
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
|
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
|
||||||
?>
|
?>
|
||||||
|
@ -43,8 +43,8 @@
|
||||||
<?php
|
<?php
|
||||||
echo"<tr>";
|
echo"<tr>";
|
||||||
echo"<td>".getConfigItem("Info", "Location", $mmdvmconfigs)."</td>";
|
echo"<td>".getConfigItem("Info", "Location", $mmdvmconfigs)."</td>";
|
||||||
echo"<td>".getConfigItem("Info", "TXFrequency", $mmdvmconfigs)."</td>";
|
echo"<td>".getMHZ(getConfigItem("Info", "TXFrequency", $mmdvmconfigs))."</td>";
|
||||||
echo"<td>".getConfigItem("Info", "RXFrequency", $mmdvmconfigs)."</td>";
|
echo"<td>".getMHZ(getConfigItem("Info", "RXFrequency", $mmdvmconfigs))."</td>";
|
||||||
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
|
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
|
||||||
echo"<td>".getConfigItem("DMR", "ColorCode", $mmdvmconfigs)."</td>";
|
echo"<td>".getConfigItem("DMR", "ColorCode", $mmdvmconfigs)."</td>";
|
||||||
if (getEnabled("DMR Network", $mmdvmconfigs) == 1) {
|
if (getEnabled("DMR Network", $mmdvmconfigs) == 1) {
|
||||||
|
|
|
@ -28,4 +28,9 @@ function format_time($seconds) {
|
||||||
function startsWith($haystack, $needle) {
|
function startsWith($haystack, $needle) {
|
||||||
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
|
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMHZ($freq) {
|
||||||
|
return substr($freq,0,3) . "." . substr($freq,3,3) . "." . substr($freq,6) . " Mhz";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in a new issue