66 |
66 |
67 /* |
67 /* |
68 * $steps contains all steps of a profile |
68 * $steps contains all steps of a profile |
69 */ |
69 */ |
70 $steps = array ( |
70 $steps = array ( |
71 1 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
71 1 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
72 2 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
72 2 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
73 3 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
73 3 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
74 4 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
74 4 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
75 5 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
75 5 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
76 6 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
76 6 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
77 7 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
77 7 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
78 8 => array("steptime" => 0, "resttime" => 1, "target" => 20.0 ), |
78 8 => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ), |
79 ); |
79 ); |
80 |
80 |
81 $answer = send_cmd("PROFILE GETS ".$UUID); |
81 $answer = send_cmd("PROFILE GETS ".$UUID); |
82 $psteps = explode("\r\n", $answer); |
82 $psteps = explode("\r\n", $answer); |
83 |
83 |
134 $outstr .= ' </table>'.PHP_EOL; |
134 $outstr .= ' </table>'.PHP_EOL; |
135 $outstr .= ' </form>'.PHP_EOL; |
135 $outstr .= ' </form>'.PHP_EOL; |
136 $outstr .= ' </div> <!-- etable -->'.PHP_EOL; |
136 $outstr .= ' </div> <!-- etable -->'.PHP_EOL; |
137 $outstr .= ' <div id="atable" style="margin-left: 100px; width:780px;">'.PHP_EOL; |
137 $outstr .= ' <div id="atable" style="margin-left: 100px; width:780px;">'.PHP_EOL; |
138 $outstr .= ' The steptime is the time to go from the previous to the target temperature.'.PHP_EOL; |
138 $outstr .= ' The steptime is the time to go from the previous to the target temperature.'.PHP_EOL; |
139 $outstr .= ' The resttime is the total time in this step including the steptime.'.PHP_EOL; |
139 $outstr .= ' The resttime is the time in this step holding the target temperature.'.PHP_EOL; |
140 $outstr .= ' Steps are valid if the steptime is greater then zero.'.PHP_EOL; |
140 $outstr .= ' The duration of the step is steptime + resttime.'.PHP_EOL; |
|
141 $outstr .= ' Steps are valid if the steptime or resttime is greater then zero.'.PHP_EOL; |
141 $outstr .= ' Order is important.'.PHP_EOL; |
142 $outstr .= ' Order is important.'.PHP_EOL; |
142 $outstr .= ' Lines with a steptime of zero are ignored.'.PHP_EOL; |
143 $outstr .= ' Lines with a zero steptime and zero resttime are ignored.'.PHP_EOL; |
143 $outstr .= ' The step- and resttimes are in hours.'.PHP_EOL; |
144 $outstr .= ' The step- and resttimes are in hours.'.PHP_EOL; |
144 $outstr .= ' </div> <!-- atable -->'.PHP_EOL; |
145 $outstr .= ' </div> <!-- atable -->'.PHP_EOL; |
145 $outstr .= build_footer(); |
146 $outstr .= build_footer(); |
146 echo $outstr; |
147 echo $outstr; |
147 } |
148 } |
212 * @param float $_POST['target'n] Profile target temperature |
213 * @param float $_POST['target'n] Profile target temperature |
213 * @param string $_POST['key'] Key choice, Save or Cancel |
214 * @param string $_POST['key'] Key choice, Save or Cancel |
214 * |
215 * |
215 * Return: 0 = Ok |
216 * Return: 0 = Ok |
216 * 1 = Missing data |
217 * 1 = Missing data |
217 * 2 = A resttime < steptime |
|
218 * 3 = A target temperature out of range |
218 * 3 = A target temperature out of range |
219 * 99 = Cancel key |
219 * 99 = Cancel key |
220 */ |
220 */ |
221 function test_thesteps() { |
221 function test_thesteps() { |
222 |
222 |
267 * Use small delays so the remote really sees single lines. |
265 * Use small delays so the remote really sees single lines. |
268 * This is a real bug between client/server programming, |
266 * This is a real bug between client/server programming, |
269 * the PHP side is line oriented, the server is reading blocks. |
267 * the PHP side is line oriented, the server is reading blocks. |
270 * So we just send the data slowly and the server just sees lines. |
268 * So we just send the data slowly and the server just sees lines. |
271 */ |
269 */ |
272 if ($_POST['steptime'.$i] > 0) { |
270 if (($_POST['steptime'.$i] > 0) || ($_POST['resttime'.$i] > 0)) { |
273 usleep(20000); |
271 usleep(20000); |
274 socket_write($sock, $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target'.$i], 4096); |
272 socket_write($sock, $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target'.$i], 4096); |
275 } |
273 } |
276 unset($_POST['steptime'.$i]); |
274 unset($_POST['steptime'.$i]); |
277 unset($_POST['resttime'.$i]); |
275 unset($_POST['resttime'.$i]); |