Fri, 01 Aug 2014 14:42:44 +0200
Temperature auto refresh and some layout improvements.
--- a/www-thermferm/css/style.css Fri Aug 01 11:45:35 2014 +0200 +++ b/www-thermferm/css/style.css Fri Aug 01 14:42:44 2014 +0200 @@ -168,7 +168,7 @@ #fermentor_panel_top { width: 236px; - height: 143px; + height: 156px; float: right; background-color: #bbb; border: 2px solid; @@ -183,6 +183,11 @@ float: left; } +input.select { + margin-left: 10px; + margin-top: 10px; +} + #fermentor_powerled { width: 78px; height: 56px;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/getdata.php Fri Aug 01 14:42:44 2014 +0200 @@ -0,0 +1,50 @@ +<?php +/***************************************************************************** + * Copyright (C) 2014 + * + * Michiel Broek <mbroek at mbse dot eu> + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +require_once('utilities.php'); + +$what = $_GET['what']; +$uuid = $_GET["uuid"]; + +$sock = open_socket(); +if ($sock == false) { + echo ""; + return; +} + +socket_write($sock, 'GET '.$what.' '.$uuid, 4096); +$answer = ""; +while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + $answer .= $line; +} +socket_close($sock); + +$arr = explode(",", $answer); + + +echo $arr[1]; + +?>
--- a/www-thermferm/index.php Fri Aug 01 11:45:35 2014 +0200 +++ b/www-thermferm/index.php Fri Aug 01 14:42:44 2014 +0200 @@ -37,6 +37,8 @@ if (isset($_POST['mode']) && isset($_POST['UUID'])) { send_cmd('UNIT '.$_POST['UUID']); send_cmd('MODE '.$_POST['mode']); + unset($_POST['UUID']); + unset($_POST['mode']); }
--- a/www-thermferm/liveview.php Fri Aug 01 11:45:35 2014 +0200 +++ b/www-thermferm/liveview.php Fri Aug 01 14:42:44 2014 +0200 @@ -160,6 +160,18 @@ $outstr .= ' }]'.PHP_EOL; $outstr .= ' };'.PHP_EOL; $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart(settings'.$unr.');'.PHP_EOL; + $outstr .= ' var target_refresh_'.$unr.' = setInterval('.PHP_EOL; + $outstr .= ' function () {'.PHP_EOL; + $outstr .= ' $("#load_target_'.$unr.'").load("getdata.php?uuid='.$unit.'&what=TARGET").fadeIn("slow");'.PHP_EOL; + $outstr .= ' }, 65000);'.PHP_EOL; + $outstr .= ' var air_refresh_'.$unr.' = setInterval('.PHP_EOL; + $outstr .= ' function () {'.PHP_EOL; + $outstr .= ' $("#load_air_'.$unr.'").load("getdata.php?uuid='.$unit.'&what=AIR").fadeIn("slow");'.PHP_EOL; + $outstr .= ' }, 10001);'.PHP_EOL; + $outstr .= ' var beer_refresh_'.$unr.' = setInterval('.PHP_EOL; + $outstr .= ' function () {'.PHP_EOL; + $outstr .= ' $("#load_beer_'.$unr.'").load("getdata.php?uuid='.$unit.'&what=BEER").fadeIn("slow");'.PHP_EOL; + $outstr .= ' }, 10100);'.PHP_EOL; $outstr .= ' });'.PHP_EOL; $outstr .= ' </script>'.PHP_EOL; $outstr .= ' <div id="fermentor">'.PHP_EOL; @@ -169,16 +181,16 @@ $outstr .= ' <div id="fermentor_selector">'.PHP_EOL; $outstr .= ' <form id="select_'.$unr.'" action="index.php" method="post">'.PHP_EOL; strcmp($mode, "OFF") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" value="OFF"'.$se.'>Off<br>'.PHP_EOL; + $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="OFF"'.$se.'>Off<br>'.PHP_EOL; strcmp($mode, "NONE") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" value="NONE"'.$se.'>None<br>'.PHP_EOL; + $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="NONE"'.$se.'>None<br>'.PHP_EOL; (strcmp($heater, "no") || strcmp($cooler, "no")) ? $dis = "" : $dis = " disabled"; strcmp($mode, "FRIDGE") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" value="FRIDGE"'.$se.$dis.'>Fridge<br>'.PHP_EOL; + $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="FRIDGE"'.$se.$dis.'>Fridge<br>'.PHP_EOL; strcmp($mode, "BEER") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" value="BEER"'.$se.$dis.'>Beer<br>'.PHP_EOL; + $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="BEER"'.$se.$dis.'>Beer<br>'.PHP_EOL; strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; + $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; $outstr .= ' </form>'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; @@ -189,13 +201,13 @@ $outstr .= ' <div id="fermentor_panel_display">'.PHP_EOL; $outstr .= ' <div id="fermentor_display1">'.PHP_EOL; - $outstr .= ' '.$set_temperature.'<br>Set'.PHP_EOL; + $outstr .= ' <div id="load_target_'.$unr.'">'.$set_temperature.'</div>Set'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; $outstr .= ' <div id="fermentor_display2">'.PHP_EOL; - $outstr .= ' '.$air_temperature.'<br>Air'.PHP_EOL; + $outstr .= ' <div id="load_air_'.$unr.'">'.$air_temperature.'</div>Air'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; $outstr .= ' <div id="fermentor_display3">'.PHP_EOL; - $outstr .= ' '.$beer_temperature.'<br>Beer'.PHP_EOL; + $outstr .= ' <div id="load_beer_'.$unr.'">'.$beer_temperature.'</div>Beer'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; $outstr .= ' </div> <!-- fermentor_panel_display -->'.PHP_EOL;