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
@@ -126,6 +126,10 @@ class AlarmClock:
|
|||||||
"""Check and trigger any wakeup actions that are due"""
|
"""Check and trigger any wakeup actions that are due"""
|
||||||
if not self.wakeupActions:
|
if not self.wakeupActions:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# if not in normal mode, skip wakeup actions
|
||||||
|
if self.configMode != "normal":
|
||||||
|
return
|
||||||
|
|
||||||
now = datetime.now(ZoneInfo(city.timezone))
|
now = datetime.now(ZoneInfo(city.timezone))
|
||||||
today_alarm = now.replace(
|
today_alarm = now.replace(
|
||||||
@@ -232,6 +236,7 @@ class AlarmClock:
|
|||||||
# Increment minute
|
# Increment minute
|
||||||
self.alarmTime = self.alarmTime.replace(minute=(self.alarmTime.minute + 1) % 60)
|
self.alarmTime = self.alarmTime.replace(minute=(self.alarmTime.minute + 1) % 60)
|
||||||
self.setLcdText(f"Set Min: {self.alarmTime.minute:02d}")
|
self.setLcdText(f"Set Min: {self.alarmTime.minute:02d}")
|
||||||
|
self.resetWakeUpActions() # Reset wakeup actions to apply new alarm time immediately
|
||||||
|
|
||||||
def onLongPress(self):
|
def onLongPress(self):
|
||||||
"""Handle long button press - cycle through configuration modes"""
|
"""Handle long button press - cycle through configuration modes"""
|
||||||
|
|||||||
Reference in New Issue
Block a user