diff 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
line wrap: on
line diff
--- a/tempctrl.c	Wed Jan 21 22:52:40 2009 +1030
+++ b/tempctrl.c	Wed May 06 08:30:45 2009 +0930
@@ -162,8 +162,6 @@
  */
 
 ISR(TIMER2_COMP_vect) {
-    wdt_reset();
-
     now.usec += 8000; /* 1000000 * 1 / F_CPU / 1024 / 125 */
     while (now.usec > 1000000) {
 	now.usec -= 1000000;
@@ -227,10 +225,16 @@
 	goto setstate;
     }
     
-    /* Update our temperatures */
+    /* Update our temperatures
+     * Can take a while (800ms each!) so reset the WDT
+     */
+    wdt_reset();
     tempt = OWGetTemp(settings.fermenter_ROM);
+    wdt_reset();
     fridge_temp = OWGetTemp(settings.fridge_ROM);
+    wdt_reset();
     ambient_temp = OWGetTemp(settings.ambient_ROM);
+    wdt_reset();
     
     /* We only care about this one, only update the value we decide on
      * only if it is valid