Mercurial > templog
comparison py/fridge.py @ 145:6517ddee3187
few more bits
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 29 Nov 2012 23:50:40 +0800 |
parents | 482d7852b511 |
children | b32e5a11a4cb |
comparison
equal
deleted
inserted
replaced
144:482d7852b511 | 145:6517ddee3187 |
---|---|
17 self.fridge_on_clock = 0 | 17 self.fridge_on_clock = 0 |
18 self.fridge_off_clock = 0 | 18 self.fridge_off_clock = 0 |
19 | 19 |
20 def setup_gpio(self): | 20 def setup_gpio(self): |
21 dir_fn = '%s/direction' % config.FRIDGE_GPIO | 21 dir_fn = '%s/direction' % config.FRIDGE_GPIO |
22 with f = open(dir_fn, 'w'): | 22 with open(dir_fn, 'w') as f: |
23 f.write('low') | 23 f.write('low') |
24 val_fn = '%s/value' % config.FRIDGE_GPIO | 24 val_fn = '%s/value' % config.FRIDGE_GPIO |
25 self.value_file = f.open(val_fn, 'r+') | 25 self.value_file = f.open(val_fn, 'r+') |
26 | 26 |
27 def turn(self, value): | 27 def turn(self, value): |
52 def _run(self): | 52 def _run(self): |
53 while True: | 53 while True: |
54 self.do() | 54 self.do() |
55 gevent.sleep(config.FRIDGE_SLEEP) | 55 gevent.sleep(config.FRIDGE_SLEEP) |
56 | 56 |
57 def do(self) | 57 def do(self): |
58 """ this is the main fridge control logic """ | 58 """ this is the main fridge control logic """ |
59 wort, fridge = self.server.current_temps() | 59 wort, fridge = self.server.current_temps() |
60 | |
61 params = self.server.params | |
60 | 62 |
61 fridge_min = params.fridge_setpoint - self.FRIDGE_AIR_MIN_RANGE | 63 fridge_min = params.fridge_setpoint - self.FRIDGE_AIR_MIN_RANGE |
62 fridge_max = params.fridge_setpoint + self.FRIDGE_AIR_MAX_RANGE | 64 fridge_max = params.fridge_setpoint + self.FRIDGE_AIR_MAX_RANGE |
63 | 65 |
64 wort_max = params.fridge_setpoint + params.fridge_difference | 66 wort_max = params.fridge_setpoint + params.fridge_difference |