Mercurial > ~darius > hgwebdir.cgi > tempctrl
comparison tempctrl.c @ 80:c8cd6dd74ca1
Don't call wdt_reset() in the IRQ routine - it makes the WDT useless.
Instead only call it as needed when talking to ROMs (which can take a while
if you had several).
This makes the WDT bite when a problem occurs with the RTC (still not sure
what the actual problem is though)
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Wed, 06 May 2009 08:30:45 +0930 |
parents | a1edf53d904e |
children | 781071a115be |
comparison
equal
deleted
inserted
replaced
79:a1edf53d904e | 80:c8cd6dd74ca1 |
---|---|
160 * | 160 * |
161 * Update time counter | 161 * Update time counter |
162 */ | 162 */ |
163 | 163 |
164 ISR(TIMER2_COMP_vect) { | 164 ISR(TIMER2_COMP_vect) { |
165 wdt_reset(); | |
166 | |
167 now.usec += 8000; /* 1000000 * 1 / F_CPU / 1024 / 125 */ | 165 now.usec += 8000; /* 1000000 * 1 / F_CPU / 1024 / 125 */ |
168 while (now.usec > 1000000) { | 166 while (now.usec > 1000000) { |
169 now.usec -= 1000000; | 167 now.usec -= 1000000; |
170 now.sec++; | 168 now.sec++; |
171 } | 169 } |
225 if (settings.mode == TC_MODE_NOTHING) { | 223 if (settings.mode == TC_MODE_NOTHING) { |
226 nextstate = 'i'; | 224 nextstate = 'i'; |
227 goto setstate; | 225 goto setstate; |
228 } | 226 } |
229 | 227 |
230 /* Update our temperatures */ | 228 /* Update our temperatures |
229 * Can take a while (800ms each!) so reset the WDT | |
230 */ | |
231 wdt_reset(); | |
231 tempt = OWGetTemp(settings.fermenter_ROM); | 232 tempt = OWGetTemp(settings.fermenter_ROM); |
233 wdt_reset(); | |
232 fridge_temp = OWGetTemp(settings.fridge_ROM); | 234 fridge_temp = OWGetTemp(settings.fridge_ROM); |
235 wdt_reset(); | |
233 ambient_temp = OWGetTemp(settings.ambient_ROM); | 236 ambient_temp = OWGetTemp(settings.ambient_ROM); |
237 wdt_reset(); | |
234 | 238 |
235 /* We only care about this one, only update the value we decide on | 239 /* We only care about this one, only update the value we decide on |
236 * only if it is valid | 240 * only if it is valid |
237 */ | 241 */ |
238 if (tempt > OW_TEMP_BADVAL) { | 242 if (tempt > OW_TEMP_BADVAL) { |