fix current Mode, renice printing of freq., TNX to Ron, VE1AIC

This commit is contained in:
dg9vh 2016-05-12 13:55:02 +00:00
parent 1afed787e4
commit 39dad5af40
3 changed files with 29 additions and 12 deletions

View file

@ -211,15 +211,27 @@ function getLastHeard($logLines) {
return $lastHeard;
}
function getActualMode($logLines) {
function getActualMode($logLines, $mmdvmconfigs) {
// returns mode of repeater actual working in
array_multisort($logLines,SORT_DESC);
foreach ($logLines as $logLine) {
if (strpos($logLine, "Mode set to")) {
return substr($logLine, 39);
$lastHeard = getLastHeard($logLines);
array_multisort($lastHeard,SORT_DESC);
$listElem = $lastHeard[0];
$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() {

View file

@ -12,7 +12,7 @@
</tr>
<?php
echo"<tr>";
echo"<td>".getActualMode($logLines)."</td>";
echo"<td>".getActualMode($logLines, $mmdvmconfigs)."</td>";
echo"<td>".getActualLink($logLines, "D-Star")."</td>";
echo"<td>".getActualLink($logLines, "DMR Slot 1")."</td>";
echo"<td>".getActualLink($logLines, "DMR Slot 2")."</td>";
@ -23,8 +23,8 @@
<table class="table">
<tr>
<th>Location</th>
<th>TX-Frq.</th>
<th>Rx-Frq.</th>
<th>TX-Freq.</th>
<th>Rx-Freq.</th>
<?php
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
?>
@ -43,8 +43,8 @@
<?php
echo"<tr>";
echo"<td>".getConfigItem("Info", "Location", $mmdvmconfigs)."</td>";
echo"<td>".getConfigItem("Info", "TXFrequency", $mmdvmconfigs)."</td>";
echo"<td>".getConfigItem("Info", "RXFrequency", $mmdvmconfigs)."</td>";
echo"<td>".getMHZ(getConfigItem("Info", "TXFrequency", $mmdvmconfigs))."</td>";
echo"<td>".getMHZ(getConfigItem("Info", "RXFrequency", $mmdvmconfigs))."</td>";
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
echo"<td>".getConfigItem("DMR", "ColorCode", $mmdvmconfigs)."</td>";
if (getEnabled("DMR Network", $mmdvmconfigs) == 1) {

View file

@ -28,4 +28,9 @@ function format_time($seconds) {
function startsWith($haystack, $needle) {
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}
function getMHZ($freq) {
return substr($freq,0,3) . "." . substr($freq,3,3) . "." . substr($freq,6) . " Mhz";
}
?>