-
Notifications
You must be signed in to change notification settings - Fork 16
Add power management to launcher #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM (but not merging myself since I didn't test it)
selected = options.selected_text() | ||
options.destroy() | ||
appglue.start_app(selected) | ||
def run_it(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like handling the pushed
check outside of this function, much neater 👍
|
||
ugfx.input_attach(ugfx.JOY_UP, lambda pushed: ugfx.flush() if pushed else 0) | ||
ugfx.input_attach(ugfx.JOY_DOWN, lambda pushed: ugfx.flush() if pushed else 0) | ||
def input_a(pressed): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These generic input_x
seem like unnecessary/confusing indirection to me, I'd personally prefer a small lambda when attaching the input handler. Might be a matter of taste, so OK.
# Power management | ||
virtualtimers.activate(1000) # Start scheduler with 1 second ticks | ||
pm.set_timeout(5*60*1000) # Set timeout to 5 minutes | ||
pm.callback(pm_cb) # Go to splash instead of sleep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would also be more readable as a lambda imho: pm.callback(lambda: appglue.home())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(actually surprised your original approach pm.callback(appglue.home)
didn't work, weird)
No description provided.