Explorar el Código

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 hace 7 años
padre
commit
36958c5243
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. +2
    -2
      teensy3/EventResponder.cpp

+ 2
- 2
teensy3/EventResponder.cpp Ver fichero

@@ -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();
}

Cargando…
Cancelar
Guardar