changeset 82:93388163e037 default tip

Fix 'none' mode.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 01 Apr 2013 23:39:25 +1030
parents 781071a115be
children
files tempctrl.c
diffstat 1 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/tempctrl.c	Mon May 11 09:55:51 2009 +0930
+++ b/tempctrl.c	Mon Apr 01 23:39:25 2013 +1030
@@ -222,7 +222,7 @@
     /* Don't do any logging, just force idle and leave */
     if (settings.mode == TC_MODE_NOTHING) {
 	nextstate = 'i';
-	goto setstate;
+	goto skip;
     }
     
     /* Update our temperatures
@@ -259,7 +259,7 @@
     switch (currstate) {
 	case 'i':
 	    /* If we're idle then only heat or cool if the temperate difference is out of the
-	     * hysteresis band
+	     * hysteresis band and the heater/cooler have been off long enough
 	     */
 	    if (abs(diff) > settings.hysteresis) {
 		if (diff < 0 && settings.minheatofftime + lastheatoff < t)
@@ -311,7 +311,8 @@
     else if (settings.mode == TC_MODE_COOL)
 	nextstate = 'c';
 
-    // Keep track of when we last turned things on or off
+    /* Keep track of when we last turned things on or off */
+  skip:
     switch  (nextstate) {
 	case 'c':
 	    if (currstate == 'h')
@@ -334,21 +335,21 @@
     
     if (nextstate != '-')
 	currstate = nextstate;
-
+    if (settings.mode != TC_MODE_NOTHING) {
 #if 0
-    printf_P(PSTR("T: %10ld, "), t);
+	printf_P(PSTR("T: %10ld, "), t);
 #else
-    ds1307_printtime(PSTR(""), PSTR(": "));
+	ds1307_printtime(PSTR(""), PSTR(": "));
 #endif
-    printtemp(PSTR("Tr"), settings.target_temp, PSTR(", "));
-    printtemp(PSTR("Fm"), tempt, PSTR(", ")); // Use actual value from sensor
-    printtemp(PSTR("Fr"), fridge_temp, PSTR(", "));
-    printtemp(PSTR("Am"), ambient_temp, PSTR(", "));
-    printf_P(PSTR("St: %S, Fl: %S%S\r\n"), state2long(currstate), 
-	     forced ? PSTR("F") : PSTR(""), 
-	     stale ? PSTR("S") : PSTR(""));
+	printtemp(PSTR("Tr"), settings.target_temp, PSTR(", "));
+	printtemp(PSTR("Fm"), tempt, PSTR(", ")); // Use actual value from sensor
+	printtemp(PSTR("Fr"), fridge_temp, PSTR(", "));
+	printtemp(PSTR("Am"), ambient_temp, PSTR(", "));
+	printf_P(PSTR("St: %S, Fl: %S%S\r\n"), state2long(currstate), 
+		 forced ? PSTR("F") : PSTR(""), 
+		 stale ? PSTR("S") : PSTR(""));
+    }
 
-  setstate:
     setstate(currstate);
 }