Skip to content

Commit 5870f81

Browse files
committed
Adapt to ESP32/ESP8266 native ticker resolution.
1 parent 33d4d7f commit 5870f81

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cores/esp32/Schedule.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ namespace {
5656

5757
void ticker_scheduled(SchedulerTicker* ticker, const std::function<bool(void)>& fn, uint32_t repeat_us, schedule_e policy)
5858
{
59+
#ifdef ESP8266
60+
auto repeat_ms = (repeat_us + 500) / 1000;
61+
ticker->once_ms(repeat_ms, [ticker, fn, repeat_us, policy]()
62+
#else
5963
ticker->once_us(repeat_us, [ticker, fn, repeat_us, policy]()
64+
#endif
6065
{
6166
if (!schedule_function([ticker, fn, repeat_us, policy]()
6267
{

0 commit comments

Comments
 (0)