40 $set_temperature_lo = "NA"; |
40 $set_temperature_lo = "NA"; |
41 $set_temperature_hi = "NA"; |
41 $set_temperature_hi = "NA"; |
42 $air_temperature = "NA"; |
42 $air_temperature = "NA"; |
43 $beer_temperature = "NA"; |
43 $beer_temperature = "NA"; |
44 $chiller_temperature = "NA"; |
44 $chiller_temperature = "NA"; |
45 $profile = ""; |
45 $profile_uuid = $profile_name = ""; |
46 $producr_code = ""; |
46 $producr_code = ""; |
47 $product_name = ""; |
47 $product_name = ""; |
48 $prof_state = "OFF"; |
48 $prof_state = "OFF"; |
49 $power_led = $alarm_led = $cooler_led = $heater_led = $fan_led = "off"; |
49 $power_led = $alarm_led = $cooler_led = $heater_led = $fan_led = "off"; |
50 $heater = $cooler = $fan = "no"; |
50 $heater = $cooler = $fan = "no"; |
51 $heater_state = $cooler_state = $fan_state = 0; |
51 $heater_state = $cooler_state = $fan_state = 0; |
52 |
52 |
53 foreach($arr as $l) { |
53 foreach($arr as $l) { |
|
54 // syslog(LOG_NOTICE, $l); |
54 $vals = explode(",", $l); |
55 $vals = explode(",", $l); |
55 if (strcmp($vals[0], "MODE") == 0) { |
56 if (strcmp($vals[0], "MODE") == 0) { |
56 $mode = $vals[1]; |
57 $mode = $vals[1]; |
57 if (strcmp($mode, "OFF")) |
58 if (strcmp($mode, "OFF")) |
58 $power_led = "on"; |
59 $power_led = "on"; |
97 $fan = "yes"; |
98 $fan = "yes"; |
98 } |
99 } |
99 if (strcmp($vals[0], "FAN_STATE") == 0) { |
100 if (strcmp($vals[0], "FAN_STATE") == 0) { |
100 $fan_state = $vals[1]; |
101 $fan_state = $vals[1]; |
101 } |
102 } |
102 if (strcmp($vals[0], "PROFILE") == 0) { |
103 if (strcmp($vals[0], "PROFILE_UUID") == 0) { |
103 $profile = $vals[1]; |
104 $profile_uuid = $vals[1]; |
|
105 } |
|
106 if (strcmp($vals[0], "PROFILE_NAME") == 0) { |
|
107 $profile_name = $vals[1]; |
104 } |
108 } |
105 if (strcmp($vals[0], "PROF_STATE") == 0) { |
109 if (strcmp($vals[0], "PROF_STATE") == 0) { |
106 $prof_state = $vals[1]; |
110 $prof_state = $vals[1]; |
107 } |
111 } |
108 if (($vals[0] == "BEER_SET") && ($mode == "BEER")) { |
112 if (($vals[0] == "BEER_SET") && ($mode == "BEER")) { |
273 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
277 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
274 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
278 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
275 $outstr .= ' </form>'.PHP_EOL; |
279 $outstr .= ' </form>'.PHP_EOL; |
276 } |
280 } |
277 if ($mode == "PROFILE") { |
281 if ($mode == "PROFILE") { |
278 /* |
282 $outstr .= ' <div style="color: blue; width: 148px; height: 23px; overflow: hidden;">Profile: '.$profile_name.'</div>'.PHP_EOL; |
279 * First, load a list with available profiles. |
|
280 */ |
|
281 $answer = send_cmd("PROFILE LIST"); |
|
282 $reply = explode("\r\n", $answer); |
|
283 |
|
284 /* |
|
285 * Show loaded profile. |
|
286 */ |
|
287 if ($profile == "(null)") { |
|
288 $prof_name = "None"; |
|
289 }else { |
|
290 if (startsWith($reply[0], "212")) { |
|
291 $i = 1; |
|
292 while (1) { |
|
293 if (strcmp($reply[$i], ".") == 0) |
|
294 break; |
|
295 $f = explode(",", $reply[$i]); |
|
296 if ($f[0] == $profile) { |
|
297 $prof_name = $f[1]; |
|
298 break; |
|
299 } |
|
300 $i++; |
|
301 } |
|
302 } |
|
303 } |
|
304 $outstr .= ' <div style="color: blue; width: 148px; height: 23px; overflow: hidden;">Profile: '.$prof_name.'</div>'.PHP_EOL; |
|
305 $outstr .= ' <div id="prof_state_'.$unr.'" style="color: blue; width: 148px; height: 23px; overflow: hidden;">State: '.$prof_state.'</div>'.PHP_EOL; |
283 $outstr .= ' <div id="prof_state_'.$unr.'" style="color: blue; width: 148px; height: 23px; overflow: hidden;">State: '.$prof_state.'</div>'.PHP_EOL; |
306 |
284 |
307 $outstr .= ' <form id="set_profile_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
285 $outstr .= ' <form id="set_profile_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
308 if ($prof_state == "OFF") { |
286 if ($prof_state == "OFF") { |
309 $outstr .= ' <select name="SetProfile" style="width: 130px;">'.PHP_EOL; |
287 if ($profile_name != "") |
310 $outstr .= ' <option value="">None</option>'.PHP_EOL; |
|
311 if (startsWith($reply[0], "212")) { |
|
312 $i = 1; |
|
313 while (1) { |
|
314 if (strcmp($reply[$i], ".") == 0) |
|
315 break; |
|
316 $f = explode(",", $reply[$i]); |
|
317 if ($f[2] > 0) { |
|
318 ($f[0] == $profile) ? $se = " selected" : $se = ""; |
|
319 $outstr .= ' <option value="'.$f[0].'"'.$se.'>'.$f[1].'</option>'.PHP_EOL; |
|
320 } |
|
321 $i++; |
|
322 } |
|
323 } |
|
324 $outstr .= ' </select>'.PHP_EOL; |
|
325 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
|
326 if ($profile != "(null)") |
|
327 $outstr .= ' <input type="submit" value="Start" name="key">'.PHP_EOL; |
288 $outstr .= ' <input type="submit" value="Start" name="key">'.PHP_EOL; |
328 |
289 |
329 } else if (startsWith($prof_state, "RUN")) { |
290 } else if (startsWith($prof_state, "RUN")) { |
330 $outstr .= ' <input type="hidden" value="'.$profile.'" name="SetProfile">'.PHP_EOL; |
|
331 $outstr .= ' <input type="submit" value="Pause" name="key">'.PHP_EOL; |
291 $outstr .= ' <input type="submit" value="Pause" name="key">'.PHP_EOL; |
332 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL; |
292 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL; |
333 } else if ($prof_state == "PAUSE") { |
293 } else if ($prof_state == "PAUSE") { |
334 $outstr .= ' <input type="hidden" value="'.$profile.'" name="SetProfile">'.PHP_EOL; |
|
335 $outstr .= ' <input type="submit" value="Resume" name="key">'.PHP_EOL; |
294 $outstr .= ' <input type="submit" value="Resume" name="key">'.PHP_EOL; |
336 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL; |
295 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL; |
337 } else if ($prof_state == "DONE") { |
296 } else if ($prof_state == "DONE") { |
338 $outstr .= ' <input type="hidden" value="'.$profile.'" name="SetProfile">'.PHP_EOL; |
|
339 $outstr .= ' <input type="submit" value="Off" name="key">'.PHP_EOL; |
297 $outstr .= ' <input type="submit" value="Off" name="key">'.PHP_EOL; |
340 } |
298 } |
|
299 $outstr .= ' <input type="hidden" value="'.$profile_uuid.'" name="SetProfile">'.PHP_EOL; // Only to select the right form. |
341 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
300 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
342 $outstr .= ' </form>'.PHP_EOL; |
301 $outstr .= ' </form>'.PHP_EOL; |
343 } |
302 } |
344 $outstr .= ' </div>'.PHP_EOL; |
303 $outstr .= ' </div>'.PHP_EOL; |
345 $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL; |
304 $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL; |