def showOutsideWeather(self): smogString = "SMOG:" + smogSource.getSmog() + "%" humidityString = "H:" + weatherSource.getHumidity() + "%" temperatureString = "T:" + weatherSource.getTemperature() + "*C" pressureString = "P:" + weatherSource.getPressure() lcd.displayTwoElementsJustified(smogString, humidityString, 1, LCD_CHARINLINE) lcd.displayTwoElementsJustified(temperatureString, pressureString, 2, LCD_CHARINLINE) return self.waitForChange(1, 4)
def updateClock(self, timeState, triggerState): startTime = time() currentTime = clock.getTimeString() while time() - startTime < LCD_DURATION: if (currentTime is not clock.getTimeString()): currentTime = clock.getTimeString() lcd.displayString(currentTime, 1) # lcd.displayString(str(currentDistance.get()).zfill(3), 2) humidityString = "H:" + thSource.getHumidity() + "%" temperatureString = "T:" + thSource.getTemperature() + "*C" lcd.displayTwoElementsJustified(temperatureString, humidityString, 2, LCD_CHARINLINE) if self.changeState(triggerState, startTime): return True lcd.clear() self.state = timeState return True
def showClockAndTH(self): currentTime = clock.getTimeString() date = clock.getDateString() lcd.displayTwoElementsJustified(currentTime, date, 1, LCD_CHARINLINE) currentTime = clock.getTimeString() return self.updateClock(1, 3)