-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ticker with Delegate #6918
Open
dok-net
wants to merge
55
commits into
esp8266:master
Choose a base branch
from
dok-net:ticker_w_delegate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ticker with Delegate #6918
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dok-net
force-pushed
the
ticker_w_delegate
branch
5 times, most recently
from
December 25, 2019 10:42
dab3bf2
to
55a2c31
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
3 times, most recently
from
January 22, 2020 08:26
4c9fddd
to
db2b2b7
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
2 times, most recently
from
February 5, 2020 07:15
c92d17f
to
1480a34
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
2 times, most recently
from
February 13, 2020 21:39
88dcb47
to
0323c75
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
7 times, most recently
from
March 1, 2020 16:56
dace28a
to
eabe668
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
from
March 10, 2020 18:09
eabe668
to
bcbca49
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
3 times, most recently
from
March 27, 2020 13:41
692c039
to
03754d2
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
4 times, most recently
from
April 10, 2020 08:36
09bdaa3
to
b9487d7
Compare
dok-net
force-pushed
the
ticker_w_delegate
branch
from
July 16, 2020 10:51
5945a1f
to
a7cab9d
Compare
…ATTR attribute. This affects the unnamed namespace or static non-member functions.
…uto-remove. Invoke returns result of last Delegate call. Caveat: breaks use of event multiplexer with auto-remove; WIP: add iterators.
WIP: remove() during iteration.
…ent operators, needing a lot of code duplication, this commit provides that.
This reverts commit 7c9c23e.
(cherry picked from commit 7c9c23e)
…son of Delegate<> vs. std::function<>
dok-net
force-pushed
the
ticker_w_delegate
branch
from
June 28, 2021 10:51
01ae8e3
to
7fea16a
Compare
…S context, they are scheduled, not called in ISR.
dok-net
force-pushed
the
ticker_w_delegate
branch
from
June 29, 2021 08:28
7fea16a
to
1878d6f
Compare
mcspr
added a commit
that referenced
this pull request
Nov 1, 2022
Adds max duration check. In case it is over SDK limit, enable 'repeat'ing timer with a duration proportional to the original one and count until it executes N times, only then run the callback. Code with durations less than that executes as usual. Original proposal was to not create anything or create some kind of error state... which seems counter-productive to not help out with this pretty solvable use-case. Additional updates, while refactoring the class - Stronger types for internal time management using `std::chrono::duration`. Works the same, `std::chrono::duration` handles seconds <-> milliseconds conversion, and we don't have to remember the time type in each method. (...and even allow `once()` and `attach` as overloads instead of the current `_ms`-suffix, in a future update) - `::detach()` when timer finishes. Fixes (unintentional?) side-effect that we remain `::active()`. Plus, this destroys any lambda-bound variables that will persist with the Ticker object. And, since we can't re-arm with the existing function (`Ticker::attach_ms(uint32_t just_the_time)` and etc.) - `std::variant` aka union for internal callback storage (kind-of similar to #6918). Instead of having two separate code paths, **always** attach our static function and dispatch using type info. Also helps with the issue described above, since it will call `std::function` dtor when ptr + arg is attached instead of doing nothing. - smarter copy and move, detaching existing timer on assignment and detaching the moved-in timer object in both ctor and assignment. Copying or moving a running timer no longer blindly copies `_timer` pointer, allowing to disarm the original one. Since we are a simple wrapper around `os_timer_t`, just do the simpler thing (and not re-schedule the callback, try to store original times, etc. polledTimeout already does it and is copyable)
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's the Ticker (library) ported to Delegate, to complement the IRQ handling, Schedule etc.