mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Revert "Revert "added a short delay and comment to boolean operator in CDC""
This reverts commit 200eefb4e2
.
This commit is contained in:
parent
74b6126dd2
commit
437025c6ee
@ -213,10 +213,19 @@ size_t Serial_::write(uint8_t c)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This operator is a convenient way for a sketch to check whether the
|
||||||
|
// port has actually been configured and opened by the host (as opposed
|
||||||
|
// to just being connected to the host). It can be used, for example, in
|
||||||
|
// setup() before printing to ensure that an application on the host is
|
||||||
|
// actually ready to receive and display the data.
|
||||||
|
// We add a short delay before returning to fix a bug observed by Federico
|
||||||
|
// where the port is configured (lineState != 0) but not quite opened.
|
||||||
Serial_::operator bool() {
|
Serial_::operator bool() {
|
||||||
if (_usbLineInfo.lineState > 0)
|
bool result = false;
|
||||||
return true;
|
if (_usbLineInfo.lineState > 0)
|
||||||
return false;
|
result = true;
|
||||||
|
delay(10);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial_ Serial;
|
Serial_ Serial;
|
||||||
|
Loading…
Reference in New Issue
Block a user