Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric George committed Apr 10, 2016
1 parent 6505799 commit 67e0f77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion wsp_control/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def tick(self, data):
td = td.total_seconds()
flow = LITERS_PER_REV / td

logger.info('Flowmeter tick: {0:.2f}s'.format(flow))
logger.info('Flowmeter tick: {0:.2f}l/s'.format(flow))


class Pump:
Expand All @@ -71,6 +71,9 @@ def __init__(self):
def is_on(self):
return bool(GPIO.input(self.PIN))

def __repr__(self):
return ('OFF', 'ON')[self.is_on()]

def turn_on(self):
if self.is_on():
return False
Expand Down
3 changes: 2 additions & 1 deletion wsp_control/runwsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def minutely():
datalogger.tick(temp_in, temp_out, None, temp_air)

uplift = temp_out - temp_in
logger.info('Uplift: {0}'.format(uplift))
logger.info('Checking Uplift: {0} Pump is {1}'.format(uplift, p))
if uplift >= UPLIFT_THRESHOLD:
p.turn_on()
else:
Expand All @@ -62,6 +62,7 @@ def ten_minutely():
# Turn the pump on to flush water through the system.
# 10 seconds later, the ten_secondly function will decide
# whether the pump should stay on
logger.info('Flush')
p.turn_on()


Expand Down

0 comments on commit 67e0f77

Please sign in to comment.