diff main.c @ 349:e7f070855a22

mostly works for testing
author Matt Johnston <matt@ucc.asn.au>
date Sat, 23 Jun 2012 23:37:29 +0800
parents 56f22e29582a
children 9ccd965d938a
line wrap: on
line diff
--- a/main.c	Sat Jun 23 23:36:00 2012 +0800
+++ b/main.c	Sat Jun 23 23:37:29 2012 +0800
@@ -24,15 +24,15 @@
 // 1 second. we have 1024 prescaler, 32768 crystal.
 #define SLEEP_COMPARE 32
 // limited to uint16_t
-#define MEASURE_WAKE 20
+#define MEASURE_WAKE 5 // testing 
 
 #define VALUE_NOSENSOR -9000
 #define VALUE_BROKEN -8000
 
 // limited to uint16_t
-#define COMMS_WAKE 3600
+#define COMMS_WAKE 40 // XXX testing
 // limited to uint8_t
-#define WAKE_SECS 250 // XXX testing
+#define WAKE_SECS 30 // XXX testing
 
 #define BAUD 19200
 #define UBRR ((F_CPU)/8/(BAUD)-1)
@@ -141,7 +141,7 @@
     }
     else
     {
-        //PORT_SHDN |= _BV(PIN_SHDN);
+        PORT_SHDN |= _BV(PIN_SHDN);
     }
 }
 
@@ -468,17 +468,6 @@
     blink();
     _delay_ms(100);
     blink();
-    _delay_ms(100);
-    blink();
-    _delay_ms(100);
-    blink();
-    _delay_ms(100);
-    blink();
-    _delay_ms(100);
-    blink();
-    _delay_ms(100);
-    blink();
-    _delay_ms(100);
 }
 
 
@@ -518,8 +507,7 @@
 
     if (comms_timeout != 0)
     {
-        // XXX testing
-        //comms_timeout--;
+        comms_timeout--;
     }
 
     if (measure_count >= MEASURE_WAKE)
@@ -681,12 +669,14 @@
         {
             need_measurement = 0;
             do_measurement();
+            continue;
         }
 
         if (have_cmd)
         {
             have_cmd = 0;
             read_handler();
+            continue;
         }
 
         // wait for commands from the master