Mercurial > ~darius > hgwebdir.cgi > avr
diff tempctrl.c @ 62:e955aa7047ed
Don't update the temperature we make decisions if it is invalid.
author | darius@Inchoate |
---|---|
date | Thu, 30 Oct 2008 20:09:02 +1030 |
parents | 50fca9562310 |
children | 1ef17cd8af7a |
line wrap: on
line diff
--- a/tempctrl.c Thu Oct 30 20:05:36 2008 +1030 +++ b/tempctrl.c Thu Oct 30 20:09:02 2008 +1030 @@ -216,7 +216,7 @@ * now < settings.minheat/cool/on/offtime */ /* Temporary variables */ - int32_t t; + int32_t t, tempt; int16_t diff; char nextstate; int forced; @@ -236,13 +236,18 @@ } /* Update our temperatures */ - fermenter_temp = OWGetTemp(settings.fermenter_ROM); + tempt = OWGetTemp(settings.fermenter_ROM); fridge_temp = OWGetTemp(settings.fridge_ROM); ambient_temp = OWGetTemp(settings.ambient_ROM); - if (fermenter_temp > OW_TEMP_BADVAL) + /* We only care about this one, only update the value we decide on + * only if it is valid + */ + if (fermenter_temp > OW_TEMP_BADVAL) { + fermenter_temp = tempt; lastdata = t; - + } + /* Check for stale data */ if (lastdata + (settings.check_interval * settings.stale_factor) < t) stale = 1; @@ -342,7 +347,7 @@ ds1307_printtime(PSTR(""), PSTR(": ")); #endif printtemp(PSTR("Target"), settings.target_temp, PSTR(", ")); - printtemp(PSTR("Fermenter"), fermenter_temp, PSTR(", ")); + printtemp(PSTR("Fermenter"), tempt, PSTR(", ")); // Use actual value from sensor printtemp(PSTR("Fridge"), fridge_temp, PSTR(", ")); printtemp(PSTR("Ambient"), ambient_temp, PSTR(", ")); printf_P(PSTR("State: %S, Flags: %S%S\r\n"), state2long(currstate),