--- a/www-thermferm/liveview.php Wed Jul 30 15:27:37 2014 +0200 +++ b/www-thermferm/liveview.php Wed Jul 30 19:05:11 2014 +0200 @@ -66,6 +66,42 @@ if (startsWith($arr[0], "213")) { + $set_temperature = "N/A"; + $air_temperature = "N/A"; + $beer_temperature = "N/A"; + $power_led = $cooler_led = $heater_led = $fan_led = "off"; + $heater = $cooler = $fan = "no"; + + foreach($arr as $l) { + $vals = explode(",", $l); + if (strcmp($vals[0], "MODE") == 0) { + $mode = $vals[1]; + if (strcmp($mode, "OFF")) + $power_led = "on"; + } + if (strcmp($vals[0], "AIR_STATE") == 0) { + $air_state = $vals[1]; + } + if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && ($air_state == 0)) { + $air_temperature = $vals[1]; + } + if (strcmp($vals[0], "BEER_STATE") == 0) { + $beer_state = $vals[1]; + } + if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) { + $beer_temperature = $vals[1]; + } + if ((strcmp($vals[0], "HEATER") == 0) && (strcmp($vals[1], "YES"))) { + $heater = "yes"; + } + if ((strcmp($vals[0], "COOLER") == 0) && (strcmp($vals[1], "YES"))) { + $cooler = "yes"; + } + if ((strcmp($vals[0], "FAN") == 0) && (strcmp($vals[1], "YES"))) { + $fan = "yes"; + } + } + $outstr .= ' <script type="text/javascript">'.PHP_EOL; $outstr .= ' $(document).ready(function () {'.PHP_EOL; @@ -124,51 +160,29 @@ $outstr .= ' }]'.PHP_EOL; $outstr .= ' };'.PHP_EOL; $outstr .= ' $("#fermentor_chart_'.$unr.'").jqxChart(settings'.$unr.');'.PHP_EOL; + strcmp($mode, "OFF") ? $se = "" : $se = ", checked: true"; + $outstr .= ' $("#selButton1_'.$unit.'").jqxRadioButton({ groupName: "'.$unit.'", width: 150, height: 18'.$se.'});'.PHP_EOL; + strcmp($mode, "NONE") ? $se = "" : $se = ", checked: true"; + $outstr .= ' $("#selButton2_'.$unit.'").jqxRadioButton({ groupName: "'.$unit.'", width: 150, height: 18'.$se.'});'.PHP_EOL; + strcmp($mode, "FRIDGE") ? $se = "" : $se = ", checked: true"; + $outstr .= ' $("#selButton3_'.$unit.'").jqxRadioButton({ groupName: "'.$unit.'", width: 150, height: 18'.$se.', disabled: true});'.PHP_EOL; + strcmp($mode, "BEER") ? $se = "" : $se = ", checked: true"; + $outstr .= ' $("#selButton4_'.$unit.'").jqxRadioButton({ groupName: "'.$unit.'", width: 150, height: 18'.$se.', disabled: true});'.PHP_EOL; + strcmp($mode, "PROFILE") ? $se = "" : $se = ", checked: true"; + $outstr .= ' $("#selButton5_'.$unit.'").jqxRadioButton({ groupName: "'.$unit.'", width: 150, height: 18'.$se.', disabled: true});'.PHP_EOL; + $outstr .= ' });'.PHP_EOL; $outstr .= ' </script>'.PHP_EOL; $outstr .= ' <div id="fermentor">'.PHP_EOL; $outstr .= ' <div id="fermentor_chart_'.$unr.'" style="width:720px; height:377px; float:left"></div>'.PHP_EOL; - $set_temperature = "N/A"; - $air_temperature = "N/A"; - $beer_temperature = "N/A"; - $power_led = $cooler_led = $heater_led = $fan_led = "off"; - - foreach($arr as $l) { - $vals = explode(",", $l); - if (strcmp($vals[0], "MODE") == 0) { - $mode = $vals[1]; - if (strcmp($mode, "OFF")) - $power_led = "on"; - } - if (strcmp($vals[0], "AIR_STATE") == 0) { - $air_state = $vals[1]; - } - if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && ($air_state == 0)) { - $air_temperature = $vals[1]; - } - if (strcmp($vals[0], "BEER_STATE") == 0) { - $beer_state = $vals[1]; - } - if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) { - $beer_temperature = $vals[1]; - } - } $outstr .= ' <div id="fermentor_panel_top">'.PHP_EOL; $outstr .= ' <div id="fermentor_selector">'.PHP_EOL; - $outstr .= ' Mode '.$mode.PHP_EOL; - $outstr .= ' <form>'.PHP_EOL; - strcmp($mode, "OFF") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode'.$unr.'" value="OFF"'.$se.'>Off<br>'.PHP_EOL; - strcmp($mode, "NONE") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode'.$unr.'" value="NONE"'.$se.'>None<br>'.PHP_EOL; - strcmp($mode, "FRIDGE") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode'.$unr.'" value="FRIDGE"'.$se.' disabled>Fridge<br>'.PHP_EOL; - strcmp($mode, "BEER") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode'.$unr.'" value="BEER"'.$se.' disabled>Beer<br>'.PHP_EOL; - strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; - $outstr .= ' <input type="radio" name="mode'.$unr.'" value="PROFILE"'.$se.' disabled>Profile'.PHP_EOL; - $outstr .= ' </form>'.PHP_EOL; + $outstr .= ' <div style="margin-top: 10px;" id="selButton1_'.$unit.'">Off</div>'.PHP_EOL; + $outstr .= ' <div style="margin-top: 10px;" id="selButton2_'.$unit.'">None</div>'.PHP_EOL; + $outstr .= ' <div style="margin-top: 10px;" id="selButton3_'.$unit.'">Fridge</div>'.PHP_EOL; + $outstr .= ' <div style="margin-top: 10px;" id="selButton4_'.$unit.'">Beer</div>'.PHP_EOL; + $outstr .= ' <div style="margin-top: 10px;" id="selButton5_'.$unit.'">Profile</div>'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; $outstr .= ' <div id="fermentor_powerled">'.PHP_EOL; $outstr .= ' <img src="images/led_green_'.$power_led.'.png"><br>Pwr'.PHP_EOL;