From d5af1916fd7e05d354f0b4982d7d76a5c8be4b9a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Jun 2015 23:04:13 +0200 Subject: [PATCH] part gpio temp to bootstrap --- index.php | 5 +- modules/gpio/html/gpio_day.php | 28 +-- modules/gpio/html/gpio_day_forms.php | 45 ++++ modules/gpio/html/gpio_name.php | 16 +- modules/gpio/html/gpio_settings.php | 3 +- modules/gpio/html/gpio_temp.php | 340 +++----------------------- modules/gpio/html/gpio_temp_forms.php | 122 +++++++++ modules/gpio/html/gpio_week.php | 80 +----- modules/gpio/html/gpio_week_forms.php | 68 ++++++ modules/lcd/lcd4 | 5 +- 10 files changed, 290 insertions(+), 422 deletions(-) create mode 100755 modules/gpio/html/gpio_day_forms.php create mode 100755 modules/gpio/html/gpio_temp_forms.php create mode 100755 modules/gpio/html/gpio_week_forms.php diff --git a/index.php b/index.php index f23307fec..ec0f5d0cf 100755 --- a/index.php +++ b/index.php @@ -160,8 +160,9 @@ + - diff --git a/modules/gpio/html/gpio_day.php b/modules/gpio/html/gpio_day.php index 40d3969be..201109cd9 100755 --- a/modules/gpio/html/gpio_day.php +++ b/modules/gpio/html/gpio_day.php @@ -8,13 +8,6 @@ } -$day_zone1s = isset($_POST['day_zone1s']) ? $_POST['day_zone1s'] : ''; -$day_zone1e = isset($_POST['day_zone1e']) ? $_POST['day_zone1e'] : ''; -$day_zone2s = isset($_POST['day_zone2s']) ? $_POST['day_zone2s'] : ''; -$day_zone2e = isset($_POST['day_zone2e']) ? $_POST['day_zone2e'] : ''; -$day_zone3s = isset($_POST['day_zone3s']) ? $_POST['day_zone3s'] : ''; -$day_zone3e = isset($_POST['day_zone3e']) ? $_POST['day_zone3e'] : ''; - $dayrun = isset($_POST['dayrun']) ? $_POST['dayrun'] : ''; if ($dayrun == "on") { include('gpio_on.php'); @@ -24,15 +17,6 @@ exit(); } -$dayset = isset($_POST['dayset']) ? $_POST['dayset'] : ''; -if ($dayset == "on") { - $db->exec("UPDATE gpio SET day_zone1s='$day_zone1s',day_zone1e='$day_zone1e',day_zone2s='$day_zone2s',day_zone2e='$day_zone2e',day_zone3s='$day_zone3s',day_zone3e='$day_zone3e' WHERE gpio='$gpio_post'") or die("exec error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } - - if ($dayrun == "off") { include('gpio_off.php'); $db->exec("UPDATE gpio SET day_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error"); @@ -64,18 +48,8 @@ } else { +include('gpio_day_forms.php'); ?> - - -
- Set hour range: - Zone 1 - - Zone 2 - - Zone 3 - - - - -
diff --git a/modules/gpio/html/gpio_day_forms.php b/modules/gpio/html/gpio_day_forms.php new file mode 100755 index 000000000..d10a9b074 --- /dev/null +++ b/modules/gpio/html/gpio_day_forms.php @@ -0,0 +1,45 @@ +exec("UPDATE gpio SET day_zone1s='$day_zone1s',day_zone1e='$day_zone1e',day_zone2s='$day_zone2s',day_zone2e='$day_zone2e',day_zone3s='$day_zone3s',day_zone3e='$day_zone3e' WHERE gpio='$gpio_post'") or die("exec error"); + $db = null; + header("location: " . $_SERVER['REQUEST_URI']); + exit(); + } +?> + +
+ +Day plan + +
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ + + +
+
+ +
\ No newline at end of file diff --git a/modules/gpio/html/gpio_name.php b/modules/gpio/html/gpio_name.php index 11926d357..b0734f8e7 100755 --- a/modules/gpio/html/gpio_name.php +++ b/modules/gpio/html/gpio_name.php @@ -12,12 +12,18 @@ } -if (!empty($mode)) { ?> - - + + + + +
diff --git a/modules/gpio/html/gpio_settings.php b/modules/gpio/html/gpio_settings.php index acb146ba7..8c26b3f3a 100755 --- a/modules/gpio/html/gpio_settings.php +++ b/modules/gpio/html/gpio_settings.php @@ -32,10 +32,11 @@ foreach ( $result as $a) { $gpio=$a['gpio']; $mode=$a['mode']; +$name=$a['name']; ?>
-

GPIO

+

GPIO -

diff --git a/modules/gpio/html/gpio_temp.php b/modules/gpio/html/gpio_temp.php index 795617b46..698e42770 100755 --- a/modules/gpio/html/gpio_temp.php +++ b/modules/gpio/html/gpio_temp.php @@ -1,21 +1,4 @@ - prepare("SELECT tempnum FROM settings WHERE id='1'"); - $sth34->execute(); - $result34 = $sth34->fetchAll(); - foreach ($result34 as $a34) { - $tempnum=$a34['tempnum']; - } - $tempexit = isset($_POST['tempexit']) ? $_POST['tempexit'] : ''; if ($tempexit == "tempexit"){ $db->exec("UPDATE gpio SET mode='', day_run='', week_run='' where gpio='$gpio_post' ") or die("simple off db error"); @@ -24,21 +7,6 @@ function showtemp(n) { exit(); } -// temp -foreach (range(1, $tempnum) as $ta) { -$temp_temp='temp_temp' . $ta; -$temp_sensor='temp_sensor' . $ta; -$temp_sensor_diff='temp_sensor_diff' . $ta; -$temp_onoff='temp_onoff' . $ta; -$temp_op='temp_op' . $ta; - -$$temp_sensor= isset($_POST["temp_sensor".$ta]) ? $_POST["temp_sensor".$ta] : ''; -$$temp_sensor_diff= isset($_POST["temp_sensor_diff".$ta]) ? $_POST["temp_sensor_diff".$ta] : ''; -$$temp_onoff= isset($_POST["temp_onoff".$ta]) ? $_POST["temp_onoff".$ta] : ''; -$$temp_op= isset($_POST["temp_op".$ta]) ? $_POST["temp_op".$ta] : ''; -$$temp_temp=isset($_POST["temp_temp".$ta]) ? $_POST["temp_temp".$ta] : ''; -} - $tempon = isset($_POST['tempon']) ? $_POST['tempon'] : ''; if ($tempon == "on") { $db->exec("UPDATE gpio SET temp_run='on', status='wait' WHERE gpio='$gpio_post'") or die("exec 1"); @@ -47,23 +15,6 @@ function showtemp(n) { exit(); } -$tempset = isset($_POST['tempset']) ? $_POST['tempset'] : ''; -if ($tempset == "on") { -foreach (range(1, $tempnum) as $up) { - - $temp_temp=${'temp_temp' . $up}; - $temp_onoff=${'temp_onoff' . $up}; - $temp_sensor=${'temp_sensor' . $up}; - $temp_sensor_diff=${'temp_sensor_diff' . $up}; - $temp_op=${'temp_op' . $up}; - $db->exec("UPDATE gpio SET temp_op$up='$temp_op',temp_sensor$up='$temp_sensor',temp_sensor_diff$up='$temp_sensor_diff',temp_onoff$up='$temp_onoff',temp_temp$up='$temp_temp' WHERE gpio='$gpio_post'") or die("exec 1"); - } - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } - - if ($tempon == "off") { include('gpio_off.php'); $db->exec("UPDATE gpio SET temp_run='off' WHERE gpio='$gpio_post'") or die("exec error"); @@ -72,7 +23,6 @@ function showtemp(n) { exit(); } - $dayrunon = isset($_POST['dayrunon']) ? $_POST['dayrunon'] : ''; $dayrun = isset($_POST['dayrun']) ? $_POST['dayrun'] : ''; if ($dayrunon == "on") { @@ -81,6 +31,7 @@ function showtemp(n) { header("location: " . $_SERVER['REQUEST_URI']); exit(); } + $weekrunon = isset($_POST['weekrunon']) ? $_POST['weekrunon'] : ''; $weekrun = isset($_POST['weekrun']) ? $_POST['weekrun'] : ''; if ($weekrunon == "on") { @@ -90,292 +41,67 @@ function showtemp(n) { exit(); } -$day_zone1s = isset($_POST['day_zone1s']) ? $_POST['day_zone1s'] : ''; -$day_zone1e = isset($_POST['day_zone1e']) ? $_POST['day_zone1e'] : ''; -$day_zone2s = isset($_POST['day_zone2s']) ? $_POST['day_zone2s'] : ''; -$day_zone2e = isset($_POST['day_zone2e']) ? $_POST['day_zone2e'] : ''; -$day_zone3s = isset($_POST['day_zone3s']) ? $_POST['day_zone3s'] : ''; -$day_zone3e = isset($_POST['day_zone3e']) ? $_POST['day_zone3e'] : ''; - -$dayset = isset($_POST['dayset']) ? $_POST['dayset'] : ''; -if ($dayset == "on") { - $db->exec("UPDATE gpio SET day_zone1s='$day_zone1s',day_zone1e='$day_zone1e',day_zone2s='$day_zone2s',day_zone2e='$day_zone2e',day_zone3s='$day_zone3s',day_zone3e='$day_zone3e' WHERE gpio='$gpio_post'") or die("exec error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } - -$Mon = isset($_POST['Mon']) ? $_POST['Mon'] : ''; -$MonMon = isset($_POST['MonMon']) ? $_POST['MonMon'] : ''; - if ( $Mon == "Mon" ) { - $db->exec("UPDATE gpio SET week_Mon='$MonMon' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Tue = isset($_POST['Tue']) ? $_POST['Tue'] : ''; -$TueTue = isset($_POST['TueTue']) ? $_POST['TueTue'] : ''; - if ( $Tue == "Tue" ) { - $db->exec("UPDATE gpio SET week_Tue='$TueTue' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Wed = isset($_POST['Wed']) ? $_POST['Wed'] : ''; -$WedWed = isset($_POST['WedWed']) ? $_POST['WedWed'] : ''; - if ( $Wed == "Wed" ) { - $db->exec("UPDATE gpio SET week_Wed='$WedWed' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Thu = isset($_POST['Thu']) ? $_POST['Thu'] : ''; -$ThuThu = isset($_POST['ThuThu']) ? $_POST['ThuThu'] : ''; - if ( $Thu == "Thu" ) { - $db->exec("UPDATE gpio SET week_Thu='$ThuThu' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Fri = isset($_POST['Fri']) ? $_POST['Fri'] : ''; -$FriFri = isset($_POST['FriFri']) ? $_POST['FriFri'] : ''; - if ( $Fri == "Fri" ) { - $db->exec("UPDATE gpio SET week_Fri='$FriFri' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Sun = isset($_POST['Sun']) ? $_POST['Sun'] : ''; -$SunSun = isset($_POST['SunSun']) ? $_POST['SunSun'] : ''; - if ( $Sun == "Sun" ) { - $db->exec("UPDATE gpio SET week_Sun='$SunSun' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Sat = isset($_POST['Sat']) ? $_POST['Sat'] : ''; -$SatSat = isset($_POST['SatSat']) ? $_POST['SatSat'] : ''; - if ( $Sat == "Sat" ) { - $db->exec("UPDATE gpio SET week_Sat='$SatSat' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } - - - - - // MAIN - if ( $a['temp_run'] == "on") { ?> - - -prepare("SELECT * FROM sensors"); $sth->execute(); $result = $sth->fetchAll(); foreach ($result as $select) { - -if (($a['temp_sensor'.$v] == $select['id']) && (!empty($a['temp_temp'.$v]))) { -?> - - - - - - - -°C°C -
°C°C
-Status: +Status: - - - - + + + + +
- - - -
-
- - onclick="this.form.submit()" /> + + onclick="this.form.submit()" />
- - onclick="this.form.submit()" /> + + onclick="this.form.submit()" />
- - - - - - - - - - - -
- - - - - -
- - - - - - - -
Set hour range:
Zone 1 -
Zone 2 -
Zone 3 -
Note: example: 07:00 - 15:00
-
- - - - - -
-
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - then - -
-
- - - - - -
-
- - - - - - -
-
- - - - -
- - onclick="this.form.submit()" /> - - - - - -
-
- - - - - - - - +
+ + + +
+
+ + +
diff --git a/modules/gpio/html/gpio_temp_forms.php b/modules/gpio/html/gpio_temp_forms.php new file mode 100755 index 000000000..823dc5e07 --- /dev/null +++ b/modules/gpio/html/gpio_temp_forms.php @@ -0,0 +1,122 @@ + +prepare("SELECT tempnum FROM settings WHERE id='1'"); + $sth34->execute(); + $result34 = $sth34->fetchAll(); + foreach ($result34 as $a34) { + $tempnum=$a34['tempnum']; + } + + +// zmienne isset +foreach (range(1, $tempnum) as $ta) { +$temp_temp='temp_temp' . $ta; +$temp_sensor='temp_sensor' . $ta; +$temp_sensor_diff='temp_sensor_diff' . $ta; +$temp_onoff='temp_onoff' . $ta; +$temp_op='temp_op' . $ta; + +$$temp_sensor= isset($_POST["temp_sensor".$ta]) ? $_POST["temp_sensor".$ta] : ''; +$$temp_sensor_diff= isset($_POST["temp_sensor_diff".$ta]) ? $_POST["temp_sensor_diff".$ta] : ''; +$$temp_onoff= isset($_POST["temp_onoff".$ta]) ? $_POST["temp_onoff".$ta] : ''; +$$temp_op= isset($_POST["temp_op".$ta]) ? $_POST["temp_op".$ta] : ''; +$$temp_temp=isset($_POST["temp_temp".$ta]) ? $_POST["temp_temp".$ta] : ''; +} + +$tempset = isset($_POST['tempset']) ? $_POST['tempset'] : ''; + +if ($tempset == "on") { +foreach (range(1, $tempnum) as $up) { + $temp_temp=${'temp_temp' . $up}; + $temp_onoff=${'temp_onoff' . $up}; + $temp_sensor=${'temp_sensor' . $up}; + $temp_sensor_diff=${'temp_sensor_diff' . $up}; + $temp_op=${'temp_op' . $up}; + $db->exec("UPDATE gpio SET temp_op$up='$temp_op',temp_sensor$up='$temp_sensor',temp_sensor_diff$up='$temp_sensor_diff',temp_onoff$up='$temp_onoff',temp_temp$up='$temp_temp' WHERE gpio='$gpio_post'") or die("exec 1"); + } + $db = null; + header("location: " . $_SERVER['REQUEST_URI']); + exit(); +} +?> + + +
+
+ + +Temperature + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + + + + +
+
+ + + diff --git a/modules/gpio/html/gpio_week.php b/modules/gpio/html/gpio_week.php index 4419f889c..99d127a70 100755 --- a/modules/gpio/html/gpio_week.php +++ b/modules/gpio/html/gpio_week.php @@ -7,67 +7,6 @@ exit(); } -$Mon = isset($_POST['Mon']) ? $_POST['Mon'] : ''; -$MonMon = isset($_POST['MonMon']) ? $_POST['MonMon'] : ''; - if ( $Mon == "Mon" ) { - $db->exec("UPDATE gpio SET week_Mon='$MonMon' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Tue = isset($_POST['Tue']) ? $_POST['Tue'] : ''; -$TueTue = isset($_POST['TueTue']) ? $_POST['TueTue'] : ''; - if ( $Tue == "Tue" ) { - $db->exec("UPDATE gpio SET week_Tue='$TueTue' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Wed = isset($_POST['Wed']) ? $_POST['Wed'] : ''; -$WedWed = isset($_POST['WedWed']) ? $_POST['WedWed'] : ''; - if ( $Wed == "Wed" ) { - $db->exec("UPDATE gpio SET week_Wed='$WedWed' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Thu = isset($_POST['Thu']) ? $_POST['Thu'] : ''; -$ThuThu = isset($_POST['ThuThu']) ? $_POST['ThuThu'] : ''; - if ( $Thu == "Thu" ) { - $db->exec("UPDATE gpio SET week_Thu='$ThuThu' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Fri = isset($_POST['Fri']) ? $_POST['Fri'] : ''; -$FriFri = isset($_POST['FriFri']) ? $_POST['FriFri'] : ''; - if ( $Fri == "Fri" ) { - $db->exec("UPDATE gpio SET week_Fri='$FriFri' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Sun = isset($_POST['Sun']) ? $_POST['Sun'] : ''; -$SunSun = isset($_POST['SunSun']) ? $_POST['SunSun'] : ''; - if ( $Sun == "Sun" ) { - $db->exec("UPDATE gpio SET week_Sun='$SunSun' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } -$Sat = isset($_POST['Sat']) ? $_POST['Sat'] : ''; -$SatSat = isset($_POST['SatSat']) ? $_POST['SatSat'] : ''; - if ( $Sat == "Sat" ) { - $db->exec("UPDATE gpio SET week_Sat='$SatSat' where gpio='$gpio_post' ") or die("simple off db error"); - $db = null; - header("location: " . $_SERVER['REQUEST_URI']); - exit(); - } - - - - - $day_zone1s = isset($_POST['day_zone1s']) ? $_POST['day_zone1s'] : ''; $day_zone1e = isset($_POST['day_zone1e']) ? $_POST['day_zone1e'] : ''; $day_zone2s = isset($_POST['day_zone2s']) ? $_POST['day_zone2s'] : ''; @@ -129,25 +68,10 @@ -Day of the week: - - -
- - - onclick="this.form.submit()" /> - - - -
- +include('modules/gpio/html/gpio_week_forms.php'); +?> diff --git a/modules/gpio/html/gpio_week_forms.php b/modules/gpio/html/gpio_week_forms.php new file mode 100755 index 000000000..ac2297dd8 --- /dev/null +++ b/modules/gpio/html/gpio_week_forms.php @@ -0,0 +1,68 @@ +exec("UPDATE gpio SET week_Sat='$Sat', week_Sun='$Sun', week_Fri='$Fri', week_Thu='$Thu', week_Wed='$Wed', week_Tue='$Tue', week_Mon='$Mon' where gpio='$gpio_post' ") or die("simple off db error"); + $db = null; + header("location: " . $_SERVER['REQUEST_URI']); + exit(); + } + +?> +
+
+ + +Week plan + + +
+ +
+ + + + + + + + + +
+
+ +
+
+ + + + diff --git a/modules/lcd/lcd4 b/modules/lcd/lcd4 index 78d986473..02ca377fd 100755 --- a/modules/lcd/lcd4 +++ b/modules/lcd/lcd4 @@ -7,7 +7,7 @@ onoff=$(sqlite3 $dir/dbf/nettemp.db "SELECT lcd FROM settings WHERE id='1'") if [ "$onoff" == "on" ] then -$dir/modules/lcd/lcdi2c -i -l -b 1 -r 3 -c 16 "$(printf "%-15s %-15s" "$(echo nettemp.pl| cut -c 1-15)" "$(echo lcd mod| cut -c 1-15)")" +$dir/modules/lcd/lcdi2c -i -l -b 1 -r 4 -c 20 "$(printf "%-19s %-19s" "$(echo nettemp.pl| cut -c 1-19)" "$(echo lcd mod| cut -c 1-19)")" sleep 2 while : do @@ -19,7 +19,8 @@ while : t="2" l="3" while [ "$l" -le "$max" ] ; do - $dir/modules/lcd/lcdi2c -l -b 1 -r 3 -c 16 "$(printf "%-15s %-15s %-15s %-15s" "$(echo ${lines[$f]}| cut -c 1-15)" "$(echo ${lines[$s]}| cut -c 1-15)" "$(echo ${lines[$t]}| cut -c 1-15)" "$(echo ${lines[$l]}| cut -c 1-15)")" + #$dir/modules/lcd/lcdi2c -l -b 1 -r 4 -c 20 "$(printf "%-19s %-19s %-19s %-19s" "$(echo ${lines[$f]}| cut -c 1-19)" "$(echo ${lines[$s]}| cut -c 1-19)" "$(echo ${lines[$t]}| cut -c 1-19)" "$(echo ${lines[$l]}| cut -c 1-19)")" + echo $(printf "%-19s %-19s %-19s %-19s" "$(echo ${lines[$f]}| cut -c 1-19)" "$(echo ${lines[$s]}| cut -c 1-19)" "$(echo ${lines[$t]}| cut -c 1-19)" "$(echo ${lines[$l]}| cut -c 1-19)") sleep 2 f=$(expr $f + 1) s=$(expr $s + 1)