www-thermferm/units.php

changeset 349
1f89da6511a9
parent 312
7b0f819a3805
child 362
c92651a54969
equal deleted inserted replaced
348:ffc4b8aa824f 349:1f89da6511a9
97 $cmd[] = "HEATER_ADDRESS,".$_POST['HeaterAddress']; 97 $cmd[] = "HEATER_ADDRESS,".$_POST['HeaterAddress'];
98 $cmd[] = "HEATER_DELAY,".$_POST['HeaterDelay']; 98 $cmd[] = "HEATER_DELAY,".$_POST['HeaterDelay'];
99 $cmd[] = "COOLER_ADDRESS,".$_POST['CoolerAddress']; 99 $cmd[] = "COOLER_ADDRESS,".$_POST['CoolerAddress'];
100 $cmd[] = "COOLER_DELAY,".$_POST['CoolerDelay']; 100 $cmd[] = "COOLER_DELAY,".$_POST['CoolerDelay'];
101 $cmd[] = "FAN_ADDRESS,".$_POST['FanAddress']; 101 $cmd[] = "FAN_ADDRESS,".$_POST['FanAddress'];
102 $cmd[] = "FAN_DELAY,".$_POST['FanDelay'];
102 $cmd[] = "LIGHT_ADDRESS,".$_POST['LightAddress']; 103 $cmd[] = "LIGHT_ADDRESS,".$_POST['LightAddress'];
103 $cmd[] = "LIGHT_DELAY,".$_POST['LightDelay']; 104 $cmd[] = "LIGHT_DELAY,".$_POST['LightDelay'];
104 $cmd[] = "DOOR_ADDRESS,".$_POST['DoorAddress']; 105 $cmd[] = "DOOR_ADDRESS,".$_POST['DoorAddress'];
105 $cmd[] = "PSU_ADDRESS,".$_POST['PSUAddress']; 106 $cmd[] = "PSU_ADDRESS,".$_POST['PSUAddress'];
106 $cmd[] = "TEMP_SET_MIN,".$_POST['TempSetMin']; 107 $cmd[] = "TEMP_SET_MIN,".$_POST['TempSetMin'];
126 unset($_POST['CoolerAddress']); 127 unset($_POST['CoolerAddress']);
127 unset($_POST['CoolerDelay']); 128 unset($_POST['CoolerDelay']);
128 unset($_POST['LightAddress']); 129 unset($_POST['LightAddress']);
129 unset($_POST['LightDelay']); 130 unset($_POST['LightDelay']);
130 unset($_POST['FanAddress']); 131 unset($_POST['FanAddress']);
132 unset($_POST['FanDelay']);
131 unset($_POST['DoorAddress']); 133 unset($_POST['DoorAddress']);
132 unset($_POST['PSUAddress']); 134 unset($_POST['PSUAddress']);
133 unset($_POST['TempSetMin']); 135 unset($_POST['TempSetMin']);
134 unset($_POST['TempSetMax']); 136 unset($_POST['TempSetMax']);
135 unset($_POST['IdleRangeL']); 137 unset($_POST['IdleRangeL']);
160 * 7 = HeaterDelay out of range 162 * 7 = HeaterDelay out of range
161 * 8 = CoolerDelay out of range 163 * 8 = CoolerDelay out of range
162 * 9 = IdleRangeL out of range 164 * 9 = IdleRangeL out of range
163 * 10 = IdleRangeH out of range 165 * 10 = IdleRangeH out of range
164 * 11 = LightDelay out of range 166 * 11 = LightDelay out of range
167 * 12 = FanDelay out of range
165 * 99 = Cancel key 168 * 99 = Cancel key
166 */ 169 */
167 function test_thedata() { 170 function test_thedata() {
168 171
169 global $arr; 172 global $arr;
170 173
171 if (isset($_POST['UUID']) && isset($_POST['Name']) && isset($_POST['Volume']) && isset($_POST['AirAddress']) && 174 if (isset($_POST['UUID']) && isset($_POST['Name']) && isset($_POST['Volume']) && isset($_POST['AirAddress']) &&
172 isset($_POST['BeerAddress']) && isset($_POST['HeaterAddress']) && isset($_POST['CoolerAddress']) && isset($_POST['LightAddress']) && 175 isset($_POST['BeerAddress']) && isset($_POST['HeaterAddress']) && isset($_POST['CoolerAddress']) && isset($_POST['LightAddress']) &&
173 isset($_POST['HeaterDelay']) && isset($_POST['CoolerDelay']) && isset($_POST['LightDelay']) && isset($_POST['PSUAddress']) && 176 isset($_POST['HeaterDelay']) && isset($_POST['CoolerDelay']) && isset($_POST['LightDelay']) && isset($_POST['PSUAddress']) &&
174 isset($_POST['FanAddress']) && isset($_POST['DoorAddress']) && isset($_POST['TempSetMin']) && isset($_POST['TempSetMax']) && 177 isset($_POST['FanAddress']) && isset($_POST['DoorAddress']) && isset($_POST['TempSetMin']) && isset($_POST['TempSetMax']) &&
175 isset($_POST['PID_Kp']) && isset($_POST['PID_Kd']) && isset($_POST['PID_Ki']) && 178 isset($_POST['PID_Kp']) && isset($_POST['PID_Kd']) && isset($_POST['PID_Ki']) && isset($_POST['FanDelay']) &&
176 isset($_POST['IdleRangeL']) && isset($_POST['IdleRangeH']) && isset($_POST['key']) && isset($_POST['command'])) { 179 isset($_POST['IdleRangeL']) && isset($_POST['IdleRangeH']) && isset($_POST['key']) && isset($_POST['command'])) {
177 180
178 if ($_POST['key'] == 'Cancel') 181 if ($_POST['key'] == 'Cancel')
179 return 99; 182 return 99;
180 183
216 return 10; 219 return 10;
217 220
218 if (($_POST['LightDelay'] < 0) || ($_POST['LightDelay'] > 720)) 221 if (($_POST['LightDelay'] < 0) || ($_POST['LightDelay'] > 720))
219 return 11; 222 return 11;
220 223
224 if (($_POST['FanDelay'] < 0) || ($_POST['FanDelay'] > 720))
225 return 12;
226
221 } else { 227 } else {
222 return 1; 228 return 1;
223 } 229 }
224 230
225 return 0; 231 return 0;
263 case 9: $error = 'Idle Range Low must be between -5 en 0'; 269 case 9: $error = 'Idle Range Low must be between -5 en 0';
264 break; 270 break;
265 case 10: $error = 'Idle Range High must be between 0 and 5'; 271 case 10: $error = 'Idle Range High must be between 0 and 5';
266 break; 272 break;
267 case 11: $error = 'Light Delay must be bewteen 0 and 720 seconds'; 273 case 11: $error = 'Light Delay must be bewteen 0 and 720 seconds';
274 break;
275 case 12: $error = 'Fan Delay must be bewteen 0 and 720 seconds';
268 break; 276 break;
269 case 99: 277 case 99:
270 load('units.php'); 278 load('units.php');
271 break; 279 break;
272 } 280 }
444 } 452 }
445 $j++; 453 $j++;
446 } 454 }
447 } 455 }
448 $outstr .= ' </select></td>'.PHP_EOL; 456 $outstr .= ' </select></td>'.PHP_EOL;
457 $outstr .= ' </tr>'.PHP_EOL;
458 }
459 if ($f[0] == "FAN_DELAY") {
460 $outstr .= ' <tr class="editor">'.PHP_EOL;
461 $outstr .= ' <td class="editname">Fan Switch Delay</td>'.PHP_EOL;
462 $outstr .= ' <td class="editfield"><input type="text" name="FanDelay" size="5" value="'.$f[1].'"> seconds (0..720)</td>'.PHP_EOL;
449 $outstr .= ' </tr>'.PHP_EOL; 463 $outstr .= ' </tr>'.PHP_EOL;
450 } 464 }
451 if ($f[0] == "LIGHT_ADDRESS") { 465 if ($f[0] == "LIGHT_ADDRESS") {
452 $outstr .= ' <tr class="editor">'.PHP_EOL; 466 $outstr .= ' <tr class="editor">'.PHP_EOL;
453 $outstr .= ' <td class="editname">Lights Address</td>'.PHP_EOL; 467 $outstr .= ' <td class="editname">Lights Address</td>'.PHP_EOL;

mercurial