Add Pico dashboard core state and alarm logic

This commit is contained in:
root
2026-06-03 02:33:32 -06:00
parent 503af6cd8c
commit 0d239361fd
5 changed files with 174 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
class ScreenManager:
VALID_SCREENS = ("dashboard", "battery", "temps", "power", "system")
def __init__(self):
self.current_screen = "dashboard"
def go_to(self, screen_name):
if screen_name not in self.VALID_SCREENS:
raise ValueError(f"Invalid screen: {screen_name}")
self.current_screen = screen_name
def next_screen(self):
current_index = self.VALID_SCREENS.index(self.current_screen)
next_index = (current_index + 1) % len(self.VALID_SCREENS)
self.current_screen = self.VALID_SCREENS[next_index]
def previous_screen(self):
current_index = self.VALID_SCREENS.index(self.current_screen)
previous_index = (current_index - 1) % len(self.VALID_SCREENS)
self.current_screen = self.VALID_SCREENS[previous_index]