浏览代码

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...
teensy4-core
Kurt Eckhardt 7 年前
父节点
当前提交
36958c5243
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      teensy3/EventResponder.cpp

+ 2
- 2
teensy3/EventResponder.cpp 查看文件

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

正在加载...
取消
保存