poprawki WWW, obsługa OLED

poprawki WWW, obsługa OLED
pull/1/head
Tomasz Salwach 2018-03-28 02:39:30 +02:00
rodzic 7f1f810ddb
commit d2f7661d05
4 zmienionych plików z 59 dodań i 29 usunięć

Wyświetl plik

@ -3,11 +3,17 @@
if (array_key_exists("config",$_POST)){
file_put_contents("conf/dxl_config.sh",str_replace("\r\n","\n",$_POST["config"]));
}
if (array_key_exists("restart",$_POST)){
touch("/tmp/restart_dxl");
}
print("<form method='POST'>");
print("<textarea name='config' cols='80' rows='20'>");
print(file_get_contents("conf/dxl_config.sh"));
print("</textarea>");
print("<input type='submit' name='save_config' value='SAVE'>");
print("<input type='submit' name='restart' value='SAVE & RESTART'>");
print("</form>");
print("<pre>");
@print(file_get_contents("/tmp/restart_log"));
print("</pre>");
?>

Wyświetl plik

@ -0,0 +1,32 @@
<?php
print("<pre>\n");
$sondes=array();
$lines=@file("/tmp/sonde.csv");
if ($lines) {
foreach($lines as $line) $sondes[]=explode(";",$line);
//sort by altitude, descending
usort($sondes, function($a, $b) {
return $b[3] - $a[3];
});
//print actual low or lowest
foreach($sondes as $l) {
if ( ($l[8]+60 > time()) && (((int)$l[3]) < 3000) ){
break;
}
}
print($l[0]." ".$l[7]."\n");
print($l[1]." ".$l[2]."\n");
print($l[3]."m ".$l[5]."m/s\n");
}else {
print("---\n");
print("---\n");
print("---\n");
}
print("\n");
print("\n");
print("</pre>\n");
?>

Wyświetl plik

@ -17,7 +17,7 @@ print("<title>spdxl ".$realIP."</title>");
if($p=='s') echo "var page='sondy.php';";
if($p=='A') echo "var page='wf.php';";
if($p=='PS') echo "var page='processes.php';";
if($p=='D') echo "var page='display.php';";
?>
function getData(){
@ -70,6 +70,7 @@ function getData(){
<input style="width:100px" type="button" onClick="location.href='index.php?p=SDRTST2';" value="SDR #2 freq.">
<input style="width:100px" type="button" onClick="location.href='index.php?p=SDRTST3';" value="SDR #3 freq.">
<input style="width:100px" type="button" onClick="location.href='index.php?p=SDRTST4';" value="SDR #4 freq.">
<input style="width:100px" type="button" onClick="location.href='index.php?p=D';" value="OLED">
<br><br>
@ -79,7 +80,7 @@ function getData(){
if ($p=="C") require("conf.php");
if($p=='0' || $p=='' || $p=='s' ) echo "<p id=\"switch_txt\"></p>";
if($p=='0' || $p=='' || $p=='s' || $p=='D' ) echo "<p id=\"switch_txt\"></p>";
if( substr($p,0,6)=="SDRTST" ) include 'sdr.php';
if($p=='A') echo "<p id=\"switch_txt\"></p>";
if($p=='PS') echo "<p id=\"switch_txt\"></p>";

Wyświetl plik

@ -1,28 +1,19 @@
<div align="center">
<table class='procesy'>
<tbody class='procesy'>
<tr class='proces'><th> Name </th><th> PID </th></tr>
<?php
include 'config.php';
include 'funkcje.php';
echo "<tr class='proces'>";
procesRunningPrint("rtl_tcp");
echo "</tr>";
echo "<tr class='proces'>";
procesRunningPrint("sdrtst");
echo "</tr>";
echo "<tr class='proces'>";
procesRunningPrint("sondeudp");
echo "</tr>";
echo "<tr class='proces'>";
procesRunningPrint("sondemod");
echo "</tr>";
echo "<tr class='proces'>";
procesRunningPrint("udpgate4");
echo "</tr>";
print("<pre>");
print("RUNNING:\n");
$required=array("rtl_tcp","sdrtst","sondeudp","sondemod","udpgate4");
$procs=array();
exec("ps -C ".implode(",",$required)." -o cmd --noheaders",$procs);
foreach($procs as $proc){
$p=explode(" ",$proc,2);
$cmd=basename($p[0]);
print($cmd.":\n".$p[1]."\n");
$required=array_diff($required,array($cmd));
}
print("\nABSENT:\n");
foreach($required as $cmd){
print($cmd."\n");
}
print("</pre>");
?>
</tbody>
</table>
</div>
?>