소스 검색

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
main
Kurt Eckhardt 7 년 전
부모
커밋
5638ec5417
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. +2
    -0
      teensy3/EventResponder.cpp

+ 2
- 0
teensy3/EventResponder.cpp 파일 보기

@@ -210,6 +210,7 @@ void MillisTimer::addToWaitingList()
bool irq = disableTimerInterrupt();
_next = listWaiting;
listWaiting = this; // TODO: use STREX to avoid interrupt disable
_state = TimerWaiting;
enableTimerInterrupt(irq);
}

@@ -261,6 +262,7 @@ void MillisTimer::end()
if (s == TimerActive) {
if (_next) {
_next->_prev = _prev;
_next->_ms += _ms; // add in the rest of our timing to next entry...
}
if (_prev) {
_prev->_next = _next;

Loading…
취소
저장