www-thermferm/units.php

changeset 349
1f89da6511a9
parent 312
7b0f819a3805
child 362
c92651a54969
--- a/www-thermferm/units.php	Wed Apr 01 15:56:04 2015 +0200
+++ b/www-thermferm/units.php	Wed Apr 01 17:28:26 2015 +0200
@@ -99,6 +99,7 @@
 	$cmd[] = "COOLER_ADDRESS,".$_POST['CoolerAddress'];
 	$cmd[] = "COOLER_DELAY,".$_POST['CoolerDelay'];
 	$cmd[] = "FAN_ADDRESS,".$_POST['FanAddress'];
+	$cmd[] = "FAN_DELAY,".$_POST['FanDelay'];
 	$cmd[] = "LIGHT_ADDRESS,".$_POST['LightAddress'];
 	$cmd[] = "LIGHT_DELAY,".$_POST['LightDelay'];
 	$cmd[] = "DOOR_ADDRESS,".$_POST['DoorAddress'];
@@ -128,6 +129,7 @@
     unset($_POST['LightAddress']);
     unset($_POST['LightDelay']);
     unset($_POST['FanAddress']);
+    unset($_POST['FanDelay']);
     unset($_POST['DoorAddress']);
     unset($_POST['PSUAddress']);
     unset($_POST['TempSetMin']);
@@ -162,6 +164,7 @@
  *         9 = IdleRangeL out of range
  *        10 = IdleRangeH out of range
  *        11 = LightDelay out of range
+ *	  12 = FanDelay out of range
  *        99 = Cancel key
  */
 function test_thedata() {
@@ -172,7 +175,7 @@
 	isset($_POST['BeerAddress']) && isset($_POST['HeaterAddress']) && isset($_POST['CoolerAddress']) && isset($_POST['LightAddress']) &&
 	isset($_POST['HeaterDelay']) && isset($_POST['CoolerDelay']) && isset($_POST['LightDelay']) && isset($_POST['PSUAddress']) &&
 	isset($_POST['FanAddress']) && isset($_POST['DoorAddress']) && isset($_POST['TempSetMin']) && isset($_POST['TempSetMax']) &&
-	isset($_POST['PID_Kp']) && isset($_POST['PID_Kd']) && isset($_POST['PID_Ki']) &&
+	isset($_POST['PID_Kp']) && isset($_POST['PID_Kd']) && isset($_POST['PID_Ki']) && isset($_POST['FanDelay']) &&
 	isset($_POST['IdleRangeL']) && isset($_POST['IdleRangeH']) && isset($_POST['key']) && isset($_POST['command'])) {
 
 	if ($_POST['key'] == 'Cancel')
@@ -218,6 +221,9 @@
 	if (($_POST['LightDelay'] < 0) || ($_POST['LightDelay'] > 720))
 	    return 11;
 
+	if (($_POST['FanDelay'] < 0) || ($_POST['FanDelay'] > 720))
+	    return 12;
+
     } else {
 	return 1;
     }
@@ -266,6 +272,8 @@
 		break;
 	case 11: $error = 'Light Delay must be bewteen 0 and 720 seconds';
 		break;
+	case 12: $error = 'Fan Delay must be bewteen 0 and 720 seconds';
+		break;
 	case 99:        
 		load('units.php');
 		break;
@@ -448,6 +456,12 @@
 		$outstr .= '        </select></td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "FAN_DELAY") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Fan Switch Delay</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="FanDelay" size="5" value="'.$f[1].'"> seconds (0..720)</td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "LIGHT_ADDRESS") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">Lights Address</td>'.PHP_EOL;

mercurial