@@ -120,10 +120,10 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn,
120120 item->alarm = alarm;
121121
122122 // prevent new item overwriting an already expired rTarget.
123- const int32_t rRemaining = rTarget - millis ();
123+ const int32_t rRemaining = rTarget - micros ();
124124 if (!rFirst || (rRemaining > 0 && static_cast <uint32_t >(rRemaining) > item->callNow .remaining ()))
125125 {
126- rTarget = millis () + item->callNow .remaining ();
126+ rTarget = micros () + item->callNow .remaining ();
127127 }
128128
129129 esp8266::InterruptLock lockAllInterruptsInThisScope;
@@ -141,11 +141,11 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn,
141141 return true ;
142142}
143143
144- uint32_t get_scheduled_recurrent_delay ()
144+ uint32_t get_scheduled_recurrent_delay_us ()
145145{
146146 if (!rFirst) return ~static_cast <uint32_t >(0 );
147147 // handle already expired rTarget.
148- const int32_t rRemaining = rTarget - millis ();
148+ const int32_t rRemaining = rTarget - micros ();
149149 return (rRemaining > 0 ) ? static_cast <uint32_t >(rRemaining) : 0 ;
150150}
151151
@@ -209,7 +209,7 @@ void run_scheduled_recurrent_functions()
209209 fence = true ;
210210 }
211211
212- rTarget = millis () + current->callNow .remaining ();
212+ rTarget = micros () + current->callNow .remaining ();
213213 recurrent_fn_t * prev = nullptr ;
214214 // prevent scheduling of new functions during this run
215215 auto stop = rLast;
@@ -249,10 +249,10 @@ void run_scheduled_recurrent_functions()
249249 prev = current;
250250 current = current->mNext ;
251251 // prevent current item overwriting an already expired rTarget.
252- const int32_t rRemaining = rTarget - millis ();
252+ const int32_t rRemaining = rTarget - micros ();
253253 if (rRemaining > 0 && static_cast <uint32_t >(rRemaining) > current->callNow .remaining ())
254254 {
255- rTarget = millis () + current->callNow .remaining ();
255+ rTarget = micros () + current->callNow .remaining ();
256256 }
257257 }
258258
0 commit comments