Mercurial > ~darius > hgwebdir.cgi > stm32temp
changeset 43:b4440f9f6d47
Fix 'none' mode.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 01 Apr 2013 23:38:34 +1030 |
parents | 56b32b0c9a40 |
children | f1cc171b06b5 |
files | tempctrl.c |
diffstat | 1 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/tempctrl.c Mon Apr 01 21:12:57 2013 +1030 +++ b/tempctrl.c Mon Apr 01 23:38:34 2013 +1030 @@ -175,7 +175,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 @@ -208,7 +208,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) @@ -254,7 +254,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') @@ -279,18 +280,19 @@ currstate = nextstate; - localtime_r(&t, &tm); - assert(strftime(buf, sizeof(buf) - 1, "%Y/%m/%d %H:%M:%S: ", &tm) != 0); - fputs(buf, stdout); - printtemp("Tr", settings.target_temp, ", "); - printtemp("Fm", tempt, ", "); // Use actual value from sensor - printtemp("Fr", fridge_temp, ", "); - printtemp("Am", ambient_temp, ", "); - printf("St: %s, Fl: %s%s\r\n", state2long(currstate), - forced ? "F" : "", - stale ? "S" : ""); + if (settings.mode != TC_MODE_NOTHING) { + localtime_r(&t, &tm); + assert(strftime(buf, sizeof(buf) - 1, "%Y/%m/%d %H:%M:%S: ", &tm) != 0); + fputs(buf, stdout); + printtemp("Tr", settings.target_temp, ", "); + printtemp("Fm", tempt, ", "); // Use actual value from sensor + printtemp("Fr", fridge_temp, ", "); + printtemp("Am", ambient_temp, ", "); + printf("St: %s, Fl: %s%s\r\n", state2long(currstate), + forced ? "F" : "", + stale ? "S" : ""); + } - setstate: setstate(currstate); }