From 5552ccd86c1eea518e5ed6da489ecb2253bd0b62 Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Mon, 9 Sep 2024 11:33:37 +0300 Subject: [PATCH 1/3] =?UTF-8?q?Bump=20version:=203.0.0=20=E2=86=92=203.0.1?= =?UTF-8?q?-alpha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- Doxyfile | 2 +- VERSION | 2 +- library.json | 2 +- library.properties | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 406e3c2..a3a8cec 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.0.0 +current_version = 3.0.1-alpha commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+))? diff --git a/Doxyfile b/Doxyfile index ed036c5..f85e06b 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = ReactESP # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.0 +PROJECT_NUMBER = 3.0.1-alpha # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/VERSION b/VERSION index 4a36342..2f0813a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0 +3.0.1-alpha diff --git a/library.json b/library.json index f4d7f97..a7f78f8 100644 --- a/library.json +++ b/library.json @@ -23,7 +23,7 @@ } ], "dependencies": [], - "version": "3.0.0", + "version": "3.0.1-alpha", "frameworks": "arduino", "platforms": "*" } diff --git a/library.properties b/library.properties index f3d3597..e041784 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ReactESP -version=3.0.0 +version=3.0.1-alpha author=Matti Airas , Andrew Carter maintainer=Matti Airas sentence=Asynchronous programming library for the ESP32 and other microcontrollers compatible with the Arduino framework. From fec0f09486d7f9e9c6c9cc26df8f0ddeb92a5f25 Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Thu, 26 Sep 2024 10:57:19 +0300 Subject: [PATCH 2/3] Revert "Remove micros64" This reverts commit 42cafcf90ca23050280fb993549bf7321397ea5e. --- src/ReactESP.cpp | 12 +++++++++++- src/ReactESP.h | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ReactESP.cpp b/src/ReactESP.cpp index 53f818c..4141ecc 100644 --- a/src/ReactESP.cpp +++ b/src/ReactESP.cpp @@ -7,6 +7,17 @@ namespace reactesp { +/** + * @brief Return the current time since the device restart in microseconds + * + * Returns the time since the device restart. Even though the time + * is in microseconds, a 64-bit integer is all but guaranteed not to + * rewrap, ever. + */ +#ifdef ESP32 +uint64_t ICACHE_RAM_ATTR micros64() { return esp_timer_get_time(); } +#endif + // Event classes define the behaviour of each particular // Event @@ -105,7 +116,6 @@ void EventLoop::tickTimed() { if (timed_queue.empty()) { break; } - top = timed_queue.top(); if (!top->isEnabled()) { timed_queue.pop(); diff --git a/src/ReactESP.h b/src/ReactESP.h index 0ca52ee..b71a069 100644 --- a/src/ReactESP.h +++ b/src/ReactESP.h @@ -16,6 +16,11 @@ using isr_react_callback = void (*)(void*); class EventLoop; +// ESP32 doesn't have the micros64 function defined +#ifdef ESP32 +uint64_t ICACHE_RAM_ATTR micros64(); +#endif + /** * @brief EventInterface defines the interface for all events */ @@ -82,7 +87,7 @@ class TimedEvent : public Event { TimedEvent(uint64_t interval, react_callback callback) : Event(callback), interval(interval), - last_trigger_time(micros()), + last_trigger_time(micros64()), enabled(true) {} bool operator<(const TimedEvent& other) const; From 78da58be86dedabb20fb830d29874fc78a98b921 Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Thu, 26 Sep 2024 11:04:25 +0300 Subject: [PATCH 3/3] Replace remaining `micros` calls with `micros64()` --- src/ReactESP.cpp | 10 +++++----- src/ReactESP.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ReactESP.cpp b/src/ReactESP.cpp index 4141ecc..4e16c35 100644 --- a/src/ReactESP.cpp +++ b/src/ReactESP.cpp @@ -38,22 +38,22 @@ void TimedEvent::remove(EventLoop* event_loop) { DelayEvent::DelayEvent(uint32_t delay, react_callback callback) : TimedEvent(delay, callback) { - this->last_trigger_time = micros(); + this->last_trigger_time = micros64(); } DelayEvent::DelayEvent(uint64_t delay, react_callback callback) : TimedEvent(delay, callback) { - this->last_trigger_time = micros(); + this->last_trigger_time = micros64(); } void DelayEvent::tick(EventLoop* event_loop) { - this->last_trigger_time = micros(); + this->last_trigger_time = micros64(); this->callback(); delete this; } void RepeatEvent::tick(EventLoop* event_loop) { - auto now = micros(); + auto now = micros64(); this->last_trigger_time = this->last_trigger_time + this->interval; if (this->last_trigger_time + this->interval < now) { // we're lagging more than one full interval; reset the time @@ -109,7 +109,7 @@ void ISREvent::remove(EventLoop* event_loop) { } void EventLoop::tickTimed() { - const uint64_t now = micros(); + const uint64_t now = micros64(); TimedEvent* top = nullptr; while (true) { diff --git a/src/ReactESP.h b/src/ReactESP.h index b71a069..08eaa49 100644 --- a/src/ReactESP.h +++ b/src/ReactESP.h @@ -76,7 +76,7 @@ class TimedEvent : public Event { TimedEvent(uint32_t interval, react_callback callback) : Event(callback), interval((uint64_t)1000 * (uint64_t)interval), - last_trigger_time(micros()), + last_trigger_time(micros64()), enabled(true) {} /** * @brief Construct a new Timed Event object