diff main.c @ 33:024f5571df8c

- Debug log file for server - Fix some variable sizes, turn off local echo for avr code - symlink config for wrt server
author Matt Johnston <matt@ucc.asn.au>
date Fri, 15 Jun 2012 23:34:24 +0800
parents e18d7e89c17d
children a670a67ba489
line wrap: on
line diff
--- a/main.c	Thu Jun 14 00:00:57 2012 +0800
+++ b/main.c	Fri Jun 15 23:34:24 2012 +0800
@@ -29,13 +29,15 @@
 
 // 1 second. we have 1024 prescaler, 32768 crystal.
 #define SLEEP_COMPARE 32
-#define MEASURE_WAKE 10
+// limited to uint16_t
+#define MEASURE_WAKE 300
 
 #define VALUE_NOSENSOR -9000
 #define VALUE_BROKEN -8000
 
-// limited to uint16_t for now
+// limited to uint16_t
 #define COMMS_WAKE 3600
+// limited to uint8_t
 #define WAKE_SECS 250 // XXX testing
 
 #define BAUD 19200
@@ -49,12 +51,16 @@
 #define DDR_SHDN DDRD
 #define PIN_SHDN PD7
 
+// limited to uint16_t
 #define NUM_MEASUREMENTS 100
+// limited to uint8_t
 #define MAX_SENSORS 5
 
 // fixed at 8, have a shorter name
 #define ID_LEN OW_ROMCODE_SIZE
 
+// #define HAVE_UART_ECHO
+
 int uart_putchar(char c, FILE *stream);
 static void long_delay(int ms);
 static void blink();
@@ -87,7 +93,7 @@
 static char readbuf[30];
 static uint8_t have_cmd;
 
-static uint8_t measure_count;
+static uint16_t measure_count;
 static uint16_t comms_count;
 
 static uint32_t clock_epoch;
@@ -277,7 +283,7 @@
 static void
 cmd_measure()
 {
-    printf_P(PSTR("Measuring\n"));
+    printf_P(PSTR("measuring\n"));
     need_measurement = 1;
 }
 
@@ -480,7 +486,9 @@
 ISR(USART_RX_vect)
 {
     char c = UDR0;
+#ifdef HAVE_UART_ECHO
     uart_putchar(c, NULL);
+#endif
     if (c == '\r' || c == '\n')
     {
         if (readpos > 0)