Explorar el Código

MillisTimer - handle begin when active

Two issues:

if you called begin or begingRepeating while still in waiting queue, it would create circular state (code did not set state to waiting)

If you called begin on one in active list, it would first remove it from list, but did not update the timings for items left as the timing all rely on items before it
teensy4-core
Kurt Eckhardt hace 7 años
padre
commit
5638ec5417
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. +2
    -0
      teensy3/EventResponder.cpp

+ 2
- 0
teensy3/EventResponder.cpp Ver fichero

bool irq = disableTimerInterrupt(); bool irq = disableTimerInterrupt();
_next = listWaiting; _next = listWaiting;
listWaiting = this; // TODO: use STREX to avoid interrupt disable listWaiting = this; // TODO: use STREX to avoid interrupt disable
_state = TimerWaiting;
enableTimerInterrupt(irq); enableTimerInterrupt(irq);
} }


if (s == TimerActive) { if (s == TimerActive) {
if (_next) { if (_next) {
_next->_prev = _prev; _next->_prev = _prev;
_next->_ms += _ms; // add in the rest of our timing to next entry...
} }
if (_prev) { if (_prev) {
_prev->_next = _next; _prev->_next = _next;

Cargando…
Cancelar
Guardar