File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ static void recycle_fn_unsafe(scheduled_fn_t* fn)
51
51
}
52
52
53
53
IRAM_ATTR // called from ISR
54
- bool schedule_function_us (mFuncT fn, uint32_t repeat_us)
54
+ bool schedule_function_us (const mFuncT & fn, uint32_t repeat_us)
55
55
{
56
56
assert (repeat_us < decltype (scheduled_fn_t ::callNow)::neverExpires); // ~26800000us (26.8s)
57
57
@@ -75,9 +75,9 @@ bool schedule_function_us(mFuncT fn, uint32_t repeat_us)
75
75
}
76
76
77
77
IRAM_ATTR // called from ISR
78
- bool schedule_function (std::function<void (void )> fn)
78
+ bool schedule_function (const std::function<void (void )>& fn)
79
79
{
80
- return schedule_function_us ([& fn](){ fn (); return false ; }, 0 );
80
+ return schedule_function_us ([fn](){ fn (); return false ; }, 0 );
81
81
}
82
82
83
83
void run_scheduled_functions ()
Original file line number Diff line number Diff line change 17
17
// Note: there is no mechanism for cancelling scheduled functions.
18
18
// Keep that in mind when binding functions to objects which may have short lifetime.
19
19
// Returns false if the number of scheduled functions exceeds SCHEDULED_FN_MAX_COUNT.
20
- bool schedule_function (std::function<void (void )> fn);
20
+ bool schedule_function (const std::function<void (void )>& fn);
21
21
22
22
// Run given function periodically about every <repeat_us> microseconds until it returns false.
23
23
// Note that it may be more than <repeat_us> microseconds between calls if `yield` is not called
24
24
// frequently, and therefore should not be used for timing critical operations.
25
- bool schedule_function_us (std::function<bool (void )> fn, uint32_t repeat_us);
25
+ bool schedule_function_us (const std::function<bool (void )>& fn, uint32_t repeat_us);
26
26
27
27
// Run all scheduled functions.
28
28
// Use this function if your are not using `loop`, or `loop` does not return
You can’t perform that action at this time.
0 commit comments