浏览代码

USB Serial.begin wait to 2.5 seconds (hopefully enough)

teensy4-core
PaulStoffregen 7 年前
父节点
当前提交
243f48ce7a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      teensy3/usb_serial.h

+ 2
- 2
teensy3/usb_serial.h 查看文件

@@ -75,13 +75,13 @@ public:
void begin(long) {
uint32_t millis_begin = systick_millis_count;
while (!(*this)) {
// wait up to 4 seconds for Arduino Serial Monitor
// wait up to 2.5 seconds for Arduino Serial Monitor
// Yes, this is a long time, but some Windows systems open
// the port very slowly. This wait allows programs for
// Arduino Uno to "just work" (without forcing a reboot when
// the port is opened), and when no PC is connected the user's
// sketch still gets to run normally after this wait time.
if ((uint32_t)(systick_millis_count - millis_begin) > 4000) break;
if ((uint32_t)(systick_millis_count - millis_begin) > 2500) break;
}
}
void end() { /* TODO: flush output and shut down USB port */ };

正在加载...
取消
保存