Ver código fonte

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 7 anos atrás
pai
commit
36958c5243
1 arquivos alterados com 2 adições e 2 exclusões
  1. +2
    -2
      teensy3/EventResponder.cpp

+ 2
- 2
teensy3/EventResponder.cpp Ver arquivo

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

Carregando…
Cancelar
Salvar