Skip to content
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

Fix CallbackTimer::start not in IRAM #2676

Merged
merged 1 commit into from
Oct 21, 2023
Merged
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
26 changes: 12 additions & 14 deletions Sming/Core/CallbackTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,18 @@ template <typename TimerApi> class CallbackTimer : protected TimerApi
* @param repeating True to restart timer when it triggers, false for one-shot (Default: true)
* @retval bool True if timer started
*/
IRAM_ATTR bool start(bool repeating = true);
__forceinline bool IRAM_ATTR start(bool repeating = true)
{
stop();
if(!callbackSet || !intervalSet) {
return false;
}

TimerApi::arm(repeating);
started = true;
this->repeating = repeating;
return true;
}

/** @brief Start one-shot timer
* @retval bool True if timer started
Expand Down Expand Up @@ -410,17 +421,4 @@ template <typename TimerApi> class CallbackTimer : protected TimerApi
bool started = false; ///< Timer is active, or has fired
};

template <typename TimerApi> bool CallbackTimer<TimerApi>::start(bool repeating)
{
stop();
if(!callbackSet || !intervalSet) {
return false;
}

TimerApi::arm(repeating);
started = true;
this->repeating = repeating;
return true;
}

/** @} */
Loading