store max people on non volatile disk to survive reboots

add projector input seleciton
master
Level2 Pidor 2016-02-20 21:57:07 +01:00
parent 6495f1fbbc
commit f9228f07b4
4 changed files with 38 additions and 5 deletions

View File

@ -17,8 +17,28 @@ function beameron() {
echo "Switching beamer on"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3101fe0660 #projector on
}
function dvi() {
echo "Switching to dvi"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3109f6070566 #switch to DVI
}
function hdmi1() {
echo "Switching to hdmi1"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3109f6071475 #switch to hdmi1
}
function hdmi2() {
echo "Switching to hdmi2"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3109f6071576 #switch to hdmi2
}
function vga1() {
echo "Switching to vga1"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3109f6070162 #switch to vga1
}
function vga2() {
echo "Switching to vga2"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3109f6070263 #switch to vga2
}
function usage() {
echo "Usage: $0 (beamer|screen) (on|off|down|up)"
echo "Usage: $0 (beamer|screen) (on|dvi|hdmi1|hdmi2|vga|off|down|up)"
exit
}
projip="$(cat $(dirname "$0")"/beamerip.txt")"
@ -29,6 +49,14 @@ case $1 in
;;
off) beameroff
;;
dvi) beameron; dvi
;;
hdmi1) beameron; hdmi1
;;
hdmi2) beameron; hdmi2
;;
vga1) beameron; vga1
;;
*) usage
esac
;;

View File

@ -1,7 +1,8 @@
#!/bin/bash
if [ "$1" = "" ]
then
echo "usage: $0 {main|chill|status|labsocket|alarm|screen|projector} {on|off}"
echo "usage: $0 {main|chill|status|labsocket|alarm|screen} {on|off}"
echo "usage: $0 {projector} {on|hdmi1|hdmi2|dvi|vga1|off}"
exit 1
fi
function dolight() {

View File

@ -11,7 +11,7 @@ fi
STATSFILE="/run/peoplecounter$DEV"
SAMPLES=20 # how many records to keep in file
INTERVAL=10 # how long to wait between polls
MAXFILE="/run/peoplecountermax$DEV"
MAXFILE="/root/var/peoplecountermax$DEV"
PRESENCY="/run/presency$DEV" # value shown on website
# /run/peoplecounter lists all recent reads, newest at end
# let's have some management functions instead of a database
@ -68,9 +68,9 @@ do
logger $(basename $0) changed from $oldp to $p people
curmax=$(getmaxpeople)
oldmax=$(cat "$MAXFILE")
if [ "$curmax" -gt "$oldmax" ]
if [ "$curmax" -gt "${oldmax:-0}" ]
then
logger $(basename $0) setting max to $curmax because bigger than $oldmax
logger $(basename $0) setting max to $curmax because bigger than ${oldmax:-}
echo "$curmax" > "$MAXFILE"
fi
fi

View File

@ -71,6 +71,10 @@
<div class=" well">
<h1>Projector</h1>
<p><a class="btn btn-success btn-lg btn-block" data-area="projector" data-status="on" >On</a></p>
<p><a class="btn btn-success btn-lg btn-block" data-area="projector" data-status="dvi" >Slideshow</a></p>
<p><a class="btn btn-success btn-lg btn-block" data-area="projector" data-status="hdmi2" >Chromecast</a></p>
<p><a class="btn btn-success btn-lg btn-block" data-area="projector" data-status="hdmi1" >HDMI</a></p>
<p><a class="btn btn-success btn-lg btn-block" data-area="projector" data-status="vga1" >VGA</a></p>
<p><a class="btn btn-danger btn-lg btn-block" data-area="projector" data-status="off" >Off</a></p>
</div>
</div>