Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions modules/firmware_apps/settings_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def reset_wifi_settings():

PATTERNS = ["rainbow", "cylon", "flash", "off"]
BRIGHTNESSES = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
CHANNELS = ["latest", "preview"]


class SettingsApp(app.App):
Expand Down Expand Up @@ -140,6 +141,28 @@ async def _button_event_pattern_toggle(event):
)
self.layout.items.append(entry)

if id == "update_channel":

async def _button_event_channel_toggle(event):
if BUTTON_TYPES["CONFIRM"] in event.button:
channel = settings.get("update_channel")
if not channel:
channel = "latest"
idx = CHANNELS.index(channel) + 1
if idx >= len(CHANNELS):
idx = 0
print(f"{CHANNELS} {idx}")
settings.set("update_channel", CHANNELS[idx])
await self.update_values()
await render_update()
return True
return False

entry = layout.ButtonDisplay(
"Toggle", button_handler=_button_event_channel_toggle
)
self.layout.items.append(entry)

async def _button_event_w(event):
print(event)
if BUTTON_TYPES["CONFIRM"] in event.button:
Expand Down
Loading