changeset 44:96c336896201

mostly works for testing
author Matt Johnston <matt@ucc.asn.au>
date Sat, 23 Jun 2012 23:37:29 +0800
parents 26c8ab2ba3f1
children 425af63d584d
files main.c server/ts.py web/log.py
diffstat 3 files changed, 9 insertions(+), 18 deletions(-) [+]
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
--- a/server/ts.py	Sat Jun 23 23:36:00 2012 +0800
+++ b/server/ts.py	Sat Jun 23 23:37:29 2012 +0800
@@ -1,7 +1,7 @@
 #!/usr/bin/env python2.7
 
 BTADDR = "00:12:03:27:70:88"
-SLEEP_TIME = 2
+SLEEP_TIME = 5
 # time that the bluetooth takes to get going?
 EXTRA_WAKEUP = 0
 
--- a/web/log.py	Sat Jun 23 23:36:00 2012 +0800
+++ b/web/log.py	Sat Jun 23 23:37:29 2012 +0800
@@ -8,6 +8,7 @@
 import tempfile
 import time
 import syslog
+import sqlite3
 from colorsys import hls_to_rgb
 
 import config