www-thermferm/liveview.php

changeset 554
ab9f22ab57b5
parent 529
00b45f2aaac3
child 570
1e0192b295b9
equal deleted inserted replaced
553:4091d4fe217f 554:ab9f22ab57b5
1 <?php 1 <?php
2 /***************************************************************************** 2 /*****************************************************************************
3 * Copyright (C) 2014-2017 3 * Copyright (C) 2014-2018
4 * 4 *
5 * Michiel Broek <mbroek at mbse dot eu> 5 * Michiel Broek <mbroek at mbse dot eu>
6 * 6 *
7 * This file is part of ThermFerm 7 * This file is part of ThermFerm
8 * 8 *
24 24
25 require_once('utilities.php'); 25 require_once('utilities.php');
26 26
27 27
28 28
29 function showunit($unit, $unr, $name) 29 function showunit($unit, $unr, $alias)
30 { 30 {
31 global $my_style; 31 global $my_style;
32 32
33 $outstr = ' <!-- showunit(' . $unit . ', ' . $unr . ', ' . $name . ') -->' . PHP_EOL; 33 $outstr = ' <!-- showunit(' . $unit . ', ' . $unr . ', ' . $alias . ') -->' . PHP_EOL;
34 $air_state = $beer_state = $chiller_state = 1; 34 $air_state = $beer_state = $chiller_state = 1;
35 $answer = send_cmd("UNIT GET ".$unit); 35 $answer = send_cmd("UNIT GET ".$unit);
36 $arr = explode("\r\n", $answer); 36 $arr = explode("\r\n", $answer);
37 37
38 if (startsWith($arr[0], "213")) { 38 if (startsWith($arr[0], "213")) {
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 = "";
46 $producr_code = "";
47 $product_name = "";
46 $prof_state = "OFF"; 48 $prof_state = "OFF";
47 $power_led = $alarm_led = $cooler_led = $heater_led = $fan_led = "off"; 49 $power_led = $alarm_led = $cooler_led = $heater_led = $fan_led = "off";
48 $heater = $cooler = $fan = "no"; 50 $heater = $cooler = $fan = "no";
49 $heater_state = $cooler_state = $fan_state = 0; 51 $heater_state = $cooler_state = $fan_state = 0;
50 52
53 if (strcmp($vals[0], "MODE") == 0) { 55 if (strcmp($vals[0], "MODE") == 0) {
54 $mode = $vals[1]; 56 $mode = $vals[1];
55 if (strcmp($mode, "OFF")) 57 if (strcmp($mode, "OFF"))
56 $power_led = "on"; 58 $power_led = "on";
57 } 59 }
60 if (strcmp($vals[0], "PRODUCT_CODE") == 0) {
61 $product_code = $vals[1];
62 }
63 if (strcmp($vals[0], "PRODUCT_NAME") == 0) {
64 $product_name = $vals[1];
65 }
58 if (strcmp($vals[0], "AIR_STATE") == 0) { 66 if (strcmp($vals[0], "AIR_STATE") == 0) {
59 $air_state = $vals[1]; 67 $air_state = $vals[1];
60 } 68 }
61 if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && ($air_state == 0)) { 69 if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && ($air_state == 0)) {
62 $air_temperature = $vals[1]; 70 $air_temperature = $vals[1];
109 if (($vals[0] == "PROF_TARGET_HI") && ($mode == "PROFILE")) { 117 if (($vals[0] == "PROF_TARGET_HI") && ($mode == "PROFILE")) {
110 $set_temperature_hi = $vals[1]; 118 $set_temperature_hi = $vals[1];
111 } 119 }
112 } 120 }
113 121
122 $logname = $product_code . " " . $product_name;
114 $outstr .= ' <script type="text/javascript">'.PHP_EOL; 123 $outstr .= ' <script type="text/javascript">'.PHP_EOL;
115 $outstr .= ' $(document).ready(function () {'.PHP_EOL; 124 $outstr .= ' $(document).ready(function () {'.PHP_EOL;
116 125
117 if ("$air_state" == "OK") { 126 if ("$air_state" == "OK") {
118 $outstr .= ' $("#gaugeContainer_air'.$unr.'").jqxGauge({'.PHP_EOL; 127 $outstr .= ' $("#gaugeContainer_air'.$unr.'").jqxGauge({'.PHP_EOL;
409 $outstr .= ' <div style="margin-top: 2px; margin-left: 5px;">'.PHP_EOL; 418 $outstr .= ' <div style="margin-top: 2px; margin-left: 5px;">'.PHP_EOL;
410 $outstr .= ' <form action="archives.php">'.PHP_EOL; 419 $outstr .= ' <form action="archives.php">'.PHP_EOL;
411 $outstr .= ' <input type="submit" id="maintenance" value="Graph" />'.PHP_EOL; 420 $outstr .= ' <input type="submit" id="maintenance" value="Graph" />'.PHP_EOL;
412 $outstr .= ' <input type="hidden" name="action" value="view">'.PHP_EOL; 421 $outstr .= ' <input type="hidden" name="action" value="view">'.PHP_EOL;
413 $outstr .= ' <input type="hidden" name="return" value="index">'.PHP_EOL; 422 $outstr .= ' <input type="hidden" name="return" value="index">'.PHP_EOL;
414 $outstr .= ' <input type="hidden" name="name" value="'.urlencode($name).'">'.PHP_EOL; 423 $outstr .= ' <input type="hidden" name="name" value="'.urlencode($logname).'">'.PHP_EOL;
415 $outstr .= ' </form>'.PHP_EOL; 424 $outstr .= ' </form>'.PHP_EOL;
416 $outstr .= ' </div>'.PHP_EOL; 425 $outstr .= ' </div>'.PHP_EOL;
417 $outstr .= ' </div> <!-- fermentor_panel_buttons -->'.PHP_EOL; 426 $outstr .= ' </div> <!-- fermentor_panel_buttons -->'.PHP_EOL;
418 427
419 $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL; 428 $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL;

mercurial