diff --git a/init.py b/init.py index d0823b2..c26499b 100644 --- a/init.py +++ b/init.py @@ -51,6 +51,12 @@ class AlarmClock: def loop(self): currentButtonState = not self.buttonGpio.read() currentTime = time() + + if (self.configMode == "normal"): + currentMinute = int((currentTime / 60) % 60) + currentHour = int((currentTime / 3600) % 24) + + self.setLcdText(f"Time {currentHour:02d}:{currentMinute:02d} \nAlarm {self.alarmHour:02d}:{self.alarmMinute:02d}") # Only process button state change if debounce delay has passed if currentButtonState != self.lastKnownButtonState: @@ -66,16 +72,6 @@ class AlarmClock: self.onLongPress() self.buttonPressStartTime = 0.0 # Reset to prevent repeated triggers - def setLcdTime(self, hours: int, minutes: int): - self.lcd.clear() - # write the time on spanning both rows of the LCD - timeString = f"{hours:02}:{minutes:02}" - self.setLcdText(timeString) - - def generateDualLineTimeString(self, hours: int, minutes: int) -> str: - # generate custom characters to display time in dual line format - - def onButtonPress(self, button: str, state: bool): print(f"Button '{button}' pressed state: {state}") currentTime = time() @@ -97,7 +93,6 @@ class AlarmClock: if self.configMode == "normal": # Normal mode: toggle relay self.setRelayState(not self.relayGpio.read()) - self.setLcdText(f"Relay: {'ON' if self.relayGpio.read() else 'OFF'}") elif self.configMode == "set_hour": # Increment hour self.alarmHour = (self.alarmHour + 1) % 24