From 9848126256b2ef12bafe5ae305885eb274421429 Mon Sep 17 00:00:00 2001 From: dg9vh Date: Sat, 20 Aug 2016 20:38:29 +0000 Subject: [PATCH] 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. --- include/sysinfo.php | 17 ++++++++++++++++- setup.php | 12 ++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/sysinfo.php b/include/sysinfo.php index c09724a..8006cc0 100644 --- a/include/sysinfo.php +++ b/include/sysinfo.php @@ -94,7 +94,8 @@ $output = shell_exec('cat /proc/uptime'); $uptime = format_time(substr($output,0,strpos($output," "))); $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); - + $pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18 + //returns 0 = low; 1 = high ?>
@@ -104,6 +105,13 @@ + + + @@ -124,6 +132,13 @@ + + + diff --git a/setup.php b/setup.php index 91f81dc..66e7a8b 100644 --- a/setup.php +++ b/setup.php @@ -149,6 +149,18 @@ include "include/tools.php"; Halt system command:" name="HALTSYS" class="form-control" placeholder="sudo halt" aria-describedby="HALTSYS"> +
+ Show Powerstate (online or battery, wiringpi needed) +
>
+
+
+ GPIO pin to monitor: + " name="POWERONLINEPIN" class="form-control" placeholder="18" aria-describedby="POWERONLINEPIN"> +
+
+ State that signalizes online-state: + " name="POWERONLINESTATE" class="form-control" placeholder="1" aria-describedby="POWERONLINESTATE"> +
Power Idle