-
Notifications
You must be signed in to change notification settings - Fork 187
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
Allow setting skip_unhandled_events on esp timer #526
Allow setting skip_unhandled_events on esp timer #526
Conversation
It is desirable to keep backwards compatibility in With that said, I don't think it is ideal to have the newly introduced flag on the global |
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.
As per my other comment.
@ivmarkov Ok I tried this out but it just seems a bit messy to me. There then needs to be multiple new methods all doing the same thing sans flag. See 8af264d for WIP implementation of the above. Is this what you had in mind? |
Yes, that's what I had in mind. If that happens, then you have to decide - for your whole app - if you want ALL timers to skip events or not skip events. Hence why I think it is better to have it on a per-timer level, which mostly follows the ESP IDF API/approach anyway. If you could lower a bit the copy-pasted methods in your 8af264d (perhaps, by introducing an extra |
0fb6761
to
5b71693
Compare
Thanks for the explanation that all makes perfect sense. I've made the requested changes, including deduplicating the |
Currently the esp timer service hardcodes the `skip_unhandled_events` flag to `false` which means there is no way to construct a timer that doesn't wake the device from light sleep. This commit introduces new `*_nowake` methods for each of the existing `timer_*` methods which allow constructing timers with `skip_unhandled_events` set to `true`.
5b71693
to
31863d6
Compare
Thanks! |
Currently the esp timer service hardcodes the
skip_unhandled_events
flag tofalse
which means there is no way to construct a timer that doesn't wake the device from light sleep.This change introduces a
skip_unhandled_events
fn on theEspTimerService
which allows changing the value of this timer flag.I added this as a mutating fn on the timer service - but I wonder if it's a better design to make the
new
constructor accept this flag. I didn't want to change it's signature though to avoid introducing a breaking change.