Pārlūkot izejas kodu

MillisTimer off by 2ms...

When you do a timer.begin(650) it actually triggered 652 ms from your current time.  Did minimal update to see if delay time < 2 set to zero else decrement by 2...
main
Kurt Eckhardt pirms 7 gadiem
vecāks
revīzija
36958c5243
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. +2
    -2
      teensy3/EventResponder.cpp

+ 2
- 2
teensy3/EventResponder.cpp Parādīt failu

@@ -189,7 +189,7 @@ void MillisTimer::begin(unsigned long milliseconds, EventResponderRef event)
if (_state != TimerOff) end();
if (!milliseconds) return;
_event = &event;
_ms = milliseconds;
_ms = (milliseconds > 2)? milliseconds-2 : 0;
_reload = 0;
addToWaitingList();
}
@@ -199,7 +199,7 @@ void MillisTimer::beginRepeating(unsigned long milliseconds, EventResponderRef e
if (_state != TimerOff) end();
if (!milliseconds) return;
_event = &event;
_ms = milliseconds;
_ms = (milliseconds > 2)? milliseconds-2 : 0;
_reload = milliseconds;
addToWaitingList();
}

Notiek ielāde…
Atcelt
Saglabāt