enabled showing power-state via gpio-pin \(inspired by https://github.com/dg9vh/MMDVMHost-Dashboard/issues/34#issuecomment-241219739\). You have to install wiringpi on the raspberry pi and connect a controlling-hardware that switches the dedicated pin on the gpio on high or low on given state.
This commit is contained in:
parent
976e5a9ced
commit
9848126256
2 changed files with 28 additions and 1 deletions
|
@ -94,7 +94,8 @@
|
||||||
$output = shell_exec('cat /proc/uptime');
|
$output = shell_exec('cat /proc/uptime');
|
||||||
$uptime = format_time(substr($output,0,strpos($output," ")));
|
$uptime = format_time(substr($output,0,strpos($output," ")));
|
||||||
$idletime = format_time((substr($output,strpos($output," ")))/$cpucores);
|
$idletime = format_time((substr($output,strpos($output," ")))/$cpucores);
|
||||||
|
$pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18
|
||||||
|
//returns 0 = low; 1 = high
|
||||||
?>
|
?>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<!-- Standard-Panel-Inhalt -->
|
<!-- Standard-Panel-Inhalt -->
|
||||||
|
@ -104,6 +105,13 @@
|
||||||
<table id="sysinfo" class="table table-condensed">
|
<table id="sysinfo" class="table table-condensed">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php
|
||||||
|
if (constant("SHOWPOWERSTATE")) {
|
||||||
|
?>
|
||||||
|
<th>Power</th>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
<?php
|
<?php
|
||||||
if ($cputemp !== NULL) {
|
if ($cputemp !== NULL) {
|
||||||
?>
|
?>
|
||||||
|
@ -124,6 +132,13 @@
|
||||||
<th>Idle</th>
|
<th>Idle</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="gatewayinfo">
|
<tr class="gatewayinfo">
|
||||||
|
<?php
|
||||||
|
if (constant("SHOWPOWERSTATE")) {
|
||||||
|
?>
|
||||||
|
<td><?php if ($pinStatus == POWERONLINESTATE ) {echo "online";} else {echo "on battery";} ?></td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
<?php
|
<?php
|
||||||
if ($cputemp !== NULL) {
|
if ($cputemp !== NULL) {
|
||||||
?>
|
?>
|
||||||
|
|
12
setup.php
12
setup.php
|
@ -149,6 +149,18 @@ include "include/tools.php";
|
||||||
<span class="input-group-addon" id="HALTSYS" style="width: 300px">Halt system command:</span>
|
<span class="input-group-addon" id="HALTSYS" style="width: 300px">Halt system command:</span>
|
||||||
<input type="text" value="<?php echo constant("HALTSYS") ?>" name="HALTSYS" class="form-control" placeholder="sudo halt" aria-describedby="HALTSYS">
|
<input type="text" value="<?php echo constant("HALTSYS") ?>" name="HALTSYS" class="form-control" placeholder="sudo halt" aria-describedby="HALTSYS">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon" id="SHOWPOWERSTATE" style="width: 300px">Show Powerstate (online or battery, wiringpi needed)</span>
|
||||||
|
<div class="panel-body"><input type="checkbox" name="SHOWPOWERSTATE" <?php if (constant("SHOWPOWERSTATE")) echo "checked" ?>></div>
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon" id="POWERONLINEPIN" style="width: 300px">GPIO pin to monitor:</span>
|
||||||
|
<input type="text" value="<?php echo constant("POWERONLINEPIN") ?>" name="POWERONLINEPIN" class="form-control" placeholder="18" aria-describedby="POWERONLINEPIN">
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon" id="POWERONLINESTATE" style="width: 300px">State that signalizes online-state:</span>
|
||||||
|
<input type="text" value="<?php echo constant("POWERONLINESTATE") ?>" name="POWERONLINESTATE" class="form-control" placeholder="1" aria-describedby="POWERONLINESTATE">
|
||||||
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default" type="submit" form="config">Save configuration</button>
|
<button class="btn btn-default" type="submit" form="config">Save configuration</button>
|
||||||
|
|
Loading…
Reference in a new issue