Mercurial > templog
comparison py/fridge.py @ 462:a91adc95543d
less verbose logging
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 12 Jan 2013 21:54:55 +0800 |
parents | 1eb68df9f8ab |
children | 5d5424acfed0 |
comparison
equal
deleted
inserted
replaced
461:1eb68df9f8ab | 462:a91adc95543d |
---|---|
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 from utils import L,W,E,EX | 2 from utils import L,W,E,EX,D |
3 import config | 3 import config |
4 import gevent | 4 import gevent |
5 | 5 |
6 class Fridge(gevent.Greenlet): | 6 class Fridge(gevent.Greenlet): |
7 | 7 |
99 overshoot = 0 | 99 overshoot = 0 |
100 if on_time > params.overshoot_delay: | 100 if on_time > params.overshoot_delay: |
101 overshoot = params.overshoot_factor \ | 101 overshoot = params.overshoot_factor \ |
102 * min(self.OVERSHOOT_MAX_DIV, on_time) \ | 102 * min(self.OVERSHOOT_MAX_DIV, on_time) \ |
103 / self.OVERSHOOT_MAX_DIV | 103 / self.OVERSHOOT_MAX_DIV |
104 L("on_time %(on_time)f, overshoot %(overshoot)f" % locals()) | 104 D("on_time %(on_time)f, overshoot %(overshoot)f" % locals()) |
105 | 105 |
106 if wort is not None: | 106 if wort is not None: |
107 if (wort - overshoot) < params.fridge_setpoint: | 107 if (wort - overshoot) < params.fridge_setpoint: |
108 L("wort has cooled enough") | 108 L("wort has cooled enough") |
109 turn_off = True | 109 turn_off = True |
121 else: | 121 else: |
122 # fridge is off | 122 # fridge is off |
123 turn_on = False | 123 turn_on = False |
124 if wort is not None: | 124 if wort is not None: |
125 if wort >= wort_max: | 125 if wort >= wort_max: |
126 L("Wort is too hot") | 126 L("Wort is too hot %f, max %f" % (wort, wort_max)) |
127 turn_on = True | 127 turn_on = True |
128 else: | 128 else: |
129 # wort sensor is broken | 129 # wort sensor is broken |
130 if fridge is not None and fridge >= fridge_max: | 130 if fridge is not None and fridge >= fridge_max: |
131 W("frdge on fallback") | 131 W("frdge on fallback") |