Mercurial > templog
changeset 331:5de3fc71ce48
- Make the python work on openwrt
- main.c: Stay awake for testing
print CRC as unsigned
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 06 Jun 2012 23:05:35 +0800 |
parents | 7ac6b8846eea |
children | 05c1249da994 |
files | main.c server/ts.py server/utils.py |
diffstat | 3 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Wed Jun 06 22:32:49 2012 +0800 +++ b/main.c Wed Jun 06 23:05:35 2012 +0800 @@ -36,7 +36,7 @@ // limited to uint16_t for now #define COMMS_WAKE 3600 -#define WAKE_SECS 30 +#define WAKE_SECS 250 // XXX testing #define BAUD 19200 #define UBRR ((F_CPU)/8/(BAUD)-1) @@ -249,7 +249,7 @@ fputc('\n', crc_stdout); } fprintf_P(crc_stdout, PSTR("END\n")); - fprintf_P(stdout, PSTR("CRC=%d\n"), crc_out); + fprintf_P(stdout, PSTR("CRC=%hu\n"), crc_out); } static void @@ -745,6 +745,8 @@ sei(); + need_comms = 1; + #if 0 for (;;) {
--- a/server/ts.py Wed Jun 06 22:32:49 2012 +0800 +++ b/server/ts.py Wed Jun 06 23:05:35 2012 +0800 @@ -11,7 +11,7 @@ TESTING = True import sys -import httplib +#import httplib import time import traceback @@ -34,8 +34,6 @@ s.setblocking(False) - time.sleep(30) - return s # from http://blog.stalkr.net/2011/04/pctf-2011-32-thats-no-bluetooth.html @@ -87,6 +85,7 @@ recv_crc = None try: k, v = l.rstrip('\n').split('=') + print k,v if k == 'CRC': recv_crc = int(v) if recv_crc < 0 or recv_crc > 0xffff: @@ -122,6 +121,7 @@ return int(next_wake) def do_comms(sock): + print "do_comms" d = None # serial could be unreliable, try a few times for i in range(FETCH_TRIES):
--- a/server/utils.py Wed Jun 06 22:32:49 2012 +0800 +++ b/server/utils.py Wed Jun 06 23:05:35 2012 +0800 @@ -1,6 +1,6 @@ import os import sys -import ctypes +#import ctypes import time import select @@ -16,7 +16,7 @@ __all__ = ('monotonic_time', 'retry') clock_gettime = None -no_clock_gettime = False +no_clock_gettime = True def monotonic_time(): global clock_gettime global no_clock_gettime @@ -77,7 +77,7 @@ if c == '\r': continue - buf.append(c) + buf += c if c == '\n': return buf