def displayLED(currentTemp, nowTarget, nowDuration, nextTarget, nextDuration): # ============================================================================ global displayAttached, lockDisplay line1=str(currentTemp).zfill(4) if (nowTarget!=0): line1+='/'+str(nowTarget).zfill(4)+' ' else: line1+=' ' line1+=nowDuration if (nextTarget!=0): line2=str(nextTarget).zfill(4)+'@'+nextDuration else: line2='(OFF)' line2+=' '+datetime.datetime.now().strftime('%H:%M') if (_GLOBALS.displayAttached): # LED display code while (_GLOBALS.lockDisplay==True): logMessage('LOG','Display Lock') time.sleep(0.2) _GLOBALS.lockDisplay=True _GLOBALS.resetDisplay+=1 if (_GLOBALS.resetDisplay==6): _GLOBALS.resetDisplay=0 _LCD.lcd_init() _LCD.lcdDisplay(line1,line2) if (_GLOBALS.debugOn): logMessage('DISPLAY',line1) logMessage('DISPLAY',line2) _GLOBALS.lockDisplay=False else: if (_GLOBALS.debugOn): logMessage('DISPLAY',line1) logMessage('DISPLAY',line2) return;
import _FUNCTIONS, _GLOBALS, _LCD, _COMMS import RPi.GPIO as GPIO import time, os, sys _GLOBALS.init() _LCD.init() _FUNCTIONS.initialiseGPIO() _FUNCTIONS.turnHeatingOff() count=0 while True: _FUNCTIONS.cycle("SLOW") try: time.sleep(9) except (KeyboardInterrupt): print _LCD.lcdDisplay('SHUTTING DOWN !','') _FUNCTIONS.logMessage('LOG','Exiting...') GPIO.cleanup() sys.exit(0)