Enhance AlarmClock to skip wakeup actions in non-normal modes and reset actions on alarm time change
This commit is contained in:
5
init.py
5
init.py
@@ -127,6 +127,10 @@ class AlarmClock:
|
||||
if not self.wakeupActions:
|
||||
return
|
||||
|
||||
# if not in normal mode, skip wakeup actions
|
||||
if self.configMode != "normal":
|
||||
return
|
||||
|
||||
now = datetime.now(ZoneInfo(city.timezone))
|
||||
today_alarm = now.replace(
|
||||
hour=self.alarmTime.hour,
|
||||
@@ -232,6 +236,7 @@ class AlarmClock:
|
||||
# Increment minute
|
||||
self.alarmTime = self.alarmTime.replace(minute=(self.alarmTime.minute + 1) % 60)
|
||||
self.setLcdText(f"Set Min: {self.alarmTime.minute:02d}")
|
||||
self.resetWakeUpActions() # Reset wakeup actions to apply new alarm time immediately
|
||||
|
||||
def onLongPress(self):
|
||||
"""Handle long button press - cycle through configuration modes"""
|
||||
|
||||
Reference in New Issue
Block a user