changeset 383:a032051475fe

ui tweaks
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 Jul 2012 22:36:52 +0800
parents f429169aa3cd
children abe8c530812e
files web/config.py web/log.py web/templog.py
diffstat 3 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/web/config.py	Tue Jul 03 23:12:06 2012 +0800
+++ b/web/config.py	Wed Jul 04 22:36:52 2012 +0800
@@ -7,16 +7,17 @@
 
 GRAPH_WIDTH = 800
 GRAPH_HEIGHT = 400
+ZOOM = 1.5
 
 LINE_WIDTH = 2
 
 SENSOR_NAMES = {'sensor_28 CE B2 1A 03 00 00 99': "Wort",
-    'sensor_28 CC C1 1A 03 00 00 D4': "Board",
+    'sensor_28 CC C1 1A 03 00 00 D4': "Lid",
     'sensor_voltage': 'Voltage',
     }
 
 SENSOR_COLOURS = {'Wort': 'e49222', 
-                'Board': '028b3d',
+                'Lid': '028b3d',
                 'Voltage': '7db5d3aa',
                 }
 
--- a/web/log.py	Tue Jul 03 23:12:06 2012 +0800
+++ b/web/log.py	Wed Jul 04 22:36:52 2012 +0800
@@ -12,6 +12,7 @@
 import traceback
 import datetime
 import struct
+import binascii
 from colorsys import hls_to_rgb
 
 import config
@@ -95,6 +96,7 @@
         '--y-grid', '0.1:1',
         '--dynamic-labels',
         '--grid-dash', '1:0',
+        '--zoom', str(config.ZOOM),
         '--color', 'GRID#00000000',
         '--color', 'MGRID#aaaaaa',
         '--color', 'BACK#ffffff',
@@ -166,7 +168,7 @@
         meas.append([])
 
     for n in xrange(num_measurements):
-        vals = [val_scale(int(x)) for x in entries["meas%d" % n].strip().split()]
+        vals = [convert_ds18b20_12bit(x) for x in entries["meas%d" % n].strip().split()]
         if len(vals) != num_sensors:
             raise Exception("Wrong number of sensors for measurement %d" % n)
         # we make an array of values for each sensor
--- a/web/templog.py	Tue Jul 03 23:12:06 2012 +0800
+++ b/web/templog.py	Wed Jul 04 22:36:52 2012 +0800
@@ -55,11 +55,11 @@
         orig_start = end - timedelta(minutes=minutes)
         orig_end = end
         xpos = int(request.query.x)
-        xpos -= config.GRAPH_LEFT_MARGIN
+        xpos -= config.GRAPH_LEFT_MARGIN * config.ZOOM
 
-        if xpos >= 0 and xpos < config.GRAPH_WIDTH:
+        if xpos >= 0 and xpos < config.GRAPH_WIDTH * config.ZOOM:
             click_time = orig_start \
-                + timedelta(minutes=(float(xpos) / config.GRAPH_WIDTH) * minutes)
+                + timedelta(minutes=(float(xpos) / (config.GRAPH_WIDTH * config.ZOOM)) * minutes)
             minutes = int(minutes / ZOOM_SCALE)
 
             end = click_time + timedelta(minutes=minutes/2)