changeset 178:77c2a9caca3d

a few fixes
author Matt Johnston <matt@ucc.asn.au>
date Thu, 30 Jan 2014 22:55:27 +0800
parents a0ea542256ba
children 15ebb9de5049
files py/fridge.py py/sensor_ds18b20.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/py/fridge.py	Thu Jul 25 08:05:40 2013 +0800
+++ b/py/fridge.py	Thu Jan 30 22:55:27 2014 +0800
@@ -104,9 +104,8 @@
                     / self.OVERSHOOT_MAX_DIV
             D("on_time %(on_time)f, overshoot %(overshoot)f" % locals())
 
-            if not params.nowort \
-                and wort is not None \
-                and (wort - overshoot) < params.fridge_setpoint:
+            if not params.nowort and wort is not None:
+                if wort - overshoot < params.fridge_setpoint:
                     L("wort has cooled enough, %(wort)f" % locals() )
                     turn_off = True
             elif fridge is not None and fridge < fridge_min:
--- a/py/sensor_ds18b20.py	Thu Jul 25 08:05:40 2013 +0800
+++ b/py/sensor_ds18b20.py	Thu Jan 30 22:55:27 2014 +0800
@@ -77,7 +77,11 @@
     def sensor_names(self):
         """ Returns a sequence of sensorname """
         slaves_path = os.path.join(self.master_dir, "w1_master_slaves")
-        names = open(slaves_path, 'r').read().split()
+        contents = open(slaves_path, 'r').read()
+        if 'not found' in contents:
+            E("No W1 sensors found")
+            return []
+        names = contents.split()
         return names
 
     def wort_name(self):