Skip to content

Commit e5e9d2b

Browse files
committed
@hathach's changes; check cdc connected during string write
1 parent 9d43a25 commit e5e9d2b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

supervisor/shared/serial.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ bool serial_bytes_available(void) {
5252
}
5353

5454
void serial_write_substring(const char* text, uint32_t length) {
55-
#if CIRCUITPY_DISPLAYIO
55+
#if CIRCUITPY_DISPLAYIO
5656
int errcode;
5757
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
58-
#endif
59-
if (!tud_cdc_connected()) {
60-
return;
61-
}
58+
#endif
59+
6260
uint32_t count = 0;
63-
while (count < length) {
61+
while (count < length && tud_cdc_connected()) {
6462
count += tud_cdc_write(text + count, length - count);
6563
usb_background();
6664
}

0 commit comments

Comments
 (0)