Only write to usb when its around.

This commit is contained in:
Scott Shawcroft 2018-11-09 17:06:55 -08:00
parent 355abc835e
commit d012fd1553
No known key found for this signature in database
GPG Key ID: FD0EDC4B6C53CA59

View File

@ -48,6 +48,9 @@ bool serial_bytes_available(void) {
}
void serial_write_substring(const char* text, uint32_t length) {
if (!tud_cdc_connected()) {
return;
}
uint32_t count = 0;
while (count < length) {
count += tud_cdc_write(text + count, length - count);