Mercurial > templog
comparison web/log.py @ 40:9b5b202129c3
main.c:
- get rid of some debugging
- separate uart_enabled flag
ts.py:
- remember next wake time, not the interval
log.py:
- comments for sqlite
templog.py
- use cgi
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 23 Jun 2012 22:10:23 +0800 |
parents | 8da0fdadc8d7 |
children | ea99aae87884 96c336896201 |
comparison
equal
deleted
inserted
replaced
39:9a3b967a920c | 40:9b5b202129c3 |
---|---|
77 zip((first_real_time + time_step*t for t in xrange(len(measurements))), | 77 zip((first_real_time + time_step*t for t in xrange(len(measurements))), |
78 measurements)] | 78 measurements)] |
79 | 79 |
80 rrdfile = sensor_rrd_path(sensor_id) | 80 rrdfile = sensor_rrd_path(sensor_id) |
81 print>>sys.stderr, values | 81 print>>sys.stderr, values |
82 # XXX what to do here when it fails... | |
82 rrdtool.update(rrdfile, *values) | 83 rrdtool.update(rrdfile, *values) |
83 | 84 |
84 # be paranoid | 85 # be paranoid |
85 f = file(rrdfile) | 86 f = file(rrdfile) |
86 os.fsync(f.fileno()) | 87 os.fsync(f.fileno()) |
123 | 124 |
124 avr_now = float(entries['now']) | 125 avr_now = float(entries['now']) |
125 avr_first_time = float(entries['first_time']) | 126 avr_first_time = float(entries['first_time']) |
126 time_step = float(entries['time_step']) | 127 time_step = float(entries['time_step']) |
127 | 128 |
129 #sqlite | |
130 # - time | |
131 # - voltage | |
132 # - boot time | |
133 | |
128 first_real_time = time.time() - (avr_now - avr_first_time) | 134 first_real_time = time.time() - (avr_now - avr_first_time) |
129 | 135 |
130 for sensor_id, measurements in zip(sensors, meas): | 136 for sensor_id, measurements in zip(sensors, meas): |
137 # XXX sqlite add | |
131 sensor_update(sensor_id, measurements, first_real_time, time_step) | 138 sensor_update(sensor_id, measurements, first_real_time, time_step) |
132 | 139 |
133 debugf.write("Updated %d sensors\n" % len(sensors)) | 140 debugf.write("Updated %d sensors\n" % len(sensors)) |
134 debugf.flush() | 141 debugf.flush() |