diff --git a/include/functions.php b/include/functions.php index 9f7baae..e95a7f7 100644 --- a/include/functions.php +++ b/include/functions.php @@ -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() { diff --git a/include/repeaterinfo.php b/include/repeaterinfo.php index 82192f6..5000acc 100644 --- a/include/repeaterinfo.php +++ b/include/repeaterinfo.php @@ -12,7 +12,7 @@ "; - echo"
Location | -TX-Frq. | -Rx-Frq. | +TX-Freq. | +Rx-Freq. | @@ -43,8 +43,8 @@ "; echo"".getConfigItem("Info", "Location", $mmdvmconfigs)." | "; - echo"".getConfigItem("Info", "TXFrequency", $mmdvmconfigs)." | "; - echo"".getConfigItem("Info", "RXFrequency", $mmdvmconfigs)." | "; + echo"".getMHZ(getConfigItem("Info", "TXFrequency", $mmdvmconfigs))." | "; + echo"".getMHZ(getConfigItem("Info", "RXFrequency", $mmdvmconfigs))." | "; if (getEnabled("DMR", $mmdvmconfigs) == 1) { echo"".getConfigItem("DMR", "ColorCode", $mmdvmconfigs)." | "; if (getEnabled("DMR Network", $mmdvmconfigs) == 1) { diff --git a/include/tools.php b/include/tools.php index ccfa6fd..994476d 100644 --- a/include/tools.php +++ b/include/tools.php @@ -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"; +} + ?> \ No newline at end of file
---|