comparison web/log.py @ 77:959e88c0bdfa

ui tweaks
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 Jul 2012 22:36:52 +0800
parents ca08442635ca
children c7b6da1adb47
comparison
equal deleted inserted replaced
76:6e47a61edc47 77:959e88c0bdfa
10 import syslog 10 import syslog
11 import sqlite3 11 import sqlite3
12 import traceback 12 import traceback
13 import datetime 13 import datetime
14 import struct 14 import struct
15 import binascii
15 from colorsys import hls_to_rgb 16 from colorsys import hls_to_rgb
16 17
17 import config 18 import config
18 19
19 def sensor_rrd_path(s): 20 def sensor_rrd_path(s):
93 '--border', '0', 94 '--border', '0',
94 # '--vertical-label', 'Voltage', 95 # '--vertical-label', 'Voltage',
95 '--y-grid', '0.1:1', 96 '--y-grid', '0.1:1',
96 '--dynamic-labels', 97 '--dynamic-labels',
97 '--grid-dash', '1:0', 98 '--grid-dash', '1:0',
99 '--zoom', str(config.ZOOM),
98 '--color', 'GRID#00000000', 100 '--color', 'GRID#00000000',
99 '--color', 'MGRID#aaaaaa', 101 '--color', 'MGRID#aaaaaa',
100 '--color', 'BACK#ffffff', 102 '--color', 'BACK#ffffff',
101 '--disable-rrdtool-tag', 103 '--disable-rrdtool-tag',
102 '--watermark', watermark, 104 '--watermark', watermark,
164 meas = [] 166 meas = []
165 for s in sensors: 167 for s in sensors:
166 meas.append([]) 168 meas.append([])
167 169
168 for n in xrange(num_measurements): 170 for n in xrange(num_measurements):
169 vals = [val_scale(int(x)) for x in entries["meas%d" % n].strip().split()] 171 vals = [convert_ds18b20_12bit(x) for x in entries["meas%d" % n].strip().split()]
170 if len(vals) != num_sensors: 172 if len(vals) != num_sensors:
171 raise Exception("Wrong number of sensors for measurement %d" % n) 173 raise Exception("Wrong number of sensors for measurement %d" % n)
172 # we make an array of values for each sensor 174 # we make an array of values for each sensor
173 for s in xrange(num_sensors): 175 for s in xrange(num_sensors):
174 meas[s].append(vals[s]) 176 meas[s].append(vals[s])