def update(): # update the lcd for the chamber being displayed display.printState() display.printAllTemperatures() display.printMode() # display.updateBacklight(); LCD.update()
def loop(): '''Main loop.''' lastUpdate = -1 # initialise at -1 to update immediately lastBrewfatherPush = -1 # initialise at -1 to update immediately oldState = None spinner = '|/-\\' spinindex = 0 while keepRunning: #ui.ticks() if (time.time() - lastUpdate >= 1.0): # update settings every second # round to nearest 1 second boundary to keep in sync with real time lastUpdate = round(time.time()) tempControl.updateTemperatures() tempControl.detectPeaks() tempControl.updatePID() oldState = tempControl.getState() tempControl.updateState() if (oldState != tempControl.getState()): print("State changed from %s to %s" % (oldState, tempControl.getState())) piLink.printTemperatures( ) # add a data point at every state transition tempControl.updateOutputs() ui.update() # We have two lines free at the bottom of the display. # Show local time YYYY-MM-DD hh:mm (16 characters.) display.printStationaryText() display.printMode() display.printState() display.printAllTemperatures() # Last character is a spinner to show we haven't crashed #LCD.print("%s" % spinner[spinindex]) #spinindex = (spinindex + 1) % 4 # listen for incoming serial connections while waiting to update piLink.receive() if (time.time() - lastBrewfatherPush > 900): brewfather.push() lastBrewfatherPush = round(time.time()) time.sleep(0.05) # Don't hog the processor piLink.cleanup() LCD.printat(0, 5, "Shutting down. ") ui.update()
def showControllerPage(): return LCD.clear() display.printStationaryText() display.printState() LCD.update()
def showControllerPage(): LCD.clear() display.printStationaryText() display.printState() LCD.update()