Skip to content

Commit 9a489ca

Browse files
Changed USB Serial so that it will send to the host even if DTR is not set. Note this does not effect the operation of the boolean operation e.g.. while(!Serial); used to wait for the Arduino terminal to open
1 parent 61ed869 commit 9a489ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

STM32F1/cores/maple/usb_serial.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,16 @@ size_t n = 0;
119119
size_t USBSerial::write(const uint8 *buf, uint32 len)
120120
{
121121
size_t n = 0;
122-
if (!(bool) *this || !buf) {
122+
123+
#ifdef USB_SERIAL_REQUIRE_DTR
124+
if (!(bool) *this || !buf) {
125+
return 0;
126+
}
127+
#else
128+
if (!buf || !(usb_is_connected(USBLIB) && usb_is_configured(USBLIB))) {
123129
return 0;
124130
}
131+
#endif
125132

126133
uint32 txed = 0;
127134
while (txed < len) {

0 commit comments

Comments
 (0)