changeset 464:c3926e7cfb0c

LHS axis scaling easily changeable
author Matt Johnston <matt@ucc.asn.au>
date Mon, 21 Jan 2013 07:25:29 +0800
parents 94932e7051e5
children a40f30fad8f6
files web/config.py web/log.py
diffstat 2 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/web/config.py	Thu Jan 03 22:35:54 2013 +0800
+++ b/web/config.py	Mon Jan 21 07:25:29 2013 +0800
@@ -16,12 +16,16 @@
 
 LINE_WIDTH = 2
 
-SENSOR_NAMES = {'sensor_28 CE B2 1A 03 00 00 99': "Fridge",
-    'sensor_28 CC C1 1A 03 00 00 D4': "Ambient",
-    'sensor_28 49 BC 1A 03 00 00 54': "Wort",
+SENSOR_NAMES = {'sensor_28 CE B2 1A 03 00 00 99': "Old Fridge",
+    'sensor_28 CC C1 1A 03 00 00 D4': "Old Ambient",
+    'sensor_28 49 BC 1A 03 00 00 54': "Old Wort",
     'sensor_voltage': 'Voltage',
     'sensor_fridge_setpoint': 'Setpoint',
     'sensor_fridge_on': 'Cool',
+    'sensor_28-0000042cf4dd': "Wort",
+    'sensor_28-0000042cccc4': "Fridge",
+    'sensor_28-0000042c6dbb': "Ambient",
+    'sensor_internal': "Processor",
     }
 
 SENSOR_COLOURS = {'Wort': 'e49222', 
@@ -30,6 +34,7 @@
                 'Fridge': '4c40c8',
                 'Setpoint': '39c662',
                 'Cool': 'd7cedd',
+                'Processor': 'bf7a69',
                 }
 
 
--- a/web/log.py	Thu Jan 03 22:35:54 2013 +0800
+++ b/web/log.py	Mon Jan 21 07:25:29 2013 +0800
@@ -69,6 +69,15 @@
 
     graph_args = []
     have_volts = False
+
+    ## volts = temp * volts_div + volts_shift
+    #volts_div = 10
+    #volts_shift = 2
+    volts_div = 1
+    volts_shift = 0
+
+    volts_mult = 1.0/volts_div
+
     for n, (rrdfile, sensor) in enumerate(rrds):
         unit = None
         if 'avrtemp' in sensor:
@@ -86,7 +95,7 @@
             vname = 'temp%d' % n
             graph_args.append('DEF:raw%(vname)s=%(rrdfile)s:temp:AVERAGE' % locals())
             # limit max temp to 50
-            graph_args.append('CDEF:%(vname)s=raw%(vname)s,35,GT,UNKN,raw%(vname)s,0.1,*,2,+,IF' % locals())
+            graph_args.append('CDEF:%(vname)s=raw%(vname)s,38,GT,UNKN,raw%(vname)s,%(volts_mult)f,*,%(volts_shift)f,+,IF' % locals())
             unit = '<span face="Liberation Serif">ยบ</span>C'
 
         format_last_value = None
@@ -124,7 +133,7 @@
         '--slope-mode',
         '--border', '0',
 #        '--vertical-label', 'Voltage',
-        '--y-grid', '0.1:1',
+        '--y-grid', '%(volts_mult)f:1' % locals(),
         '--dynamic-labels',
         '--grid-dash', '1:0',
         '--zoom', str(config.ZOOM),
@@ -139,8 +148,9 @@
     args += ['--font', 'DEFAULT:12:%s' % config.GRAPH_FONT]
     args += ['--font', 'WATERMARK:10:%s' % config.GRAPH_FONT]
     if have_volts:
-        args += ['--right-axis', '10:-20', # matches the scalevolts CDEF above
-            '--right-axis-format', '%.0lf',
+        volts_shift_div = volts_div * volts_shift
+        args += ['--right-axis', '%(volts_div)f:-%(volts_shift_div)f' % locals(),
+#            '--right-axis-format', '%.0lf',
 #            '--right-axis-label', 'Temperature'
             ]