From 31f9eb2364bbf2ef79a3bdc64c3b692cb218db81 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Thu, 22 Jul 2010 20:33:53 -0400 Subject: last usbserial change... please? --- wirish/usb_serial.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp index c066112..fafdf49 100644 --- a/wirish/usb_serial.cpp +++ b/wirish/usb_serial.cpp @@ -46,6 +46,9 @@ void USBSerial::end(void) { } void USBSerial::write(uint8 ch) { + if(!(usbIsConnected() && usbIsConfigured())) { + return; + } uint16 status = 0; uint32 start = millis(); while(status == 0 && (millis() - start <= USB_TIMEOUT)) { @@ -54,6 +57,9 @@ void USBSerial::write(uint8 ch) { } void USBSerial::write(const char *str) { + if(!(usbIsConnected() && usbIsConfigured())) { + return; + } uint32 len = strlen(str); uint16 status = 0; uint16 oldstatus = 0; @@ -67,9 +73,12 @@ void USBSerial::write(const char *str) { } void USBSerial::write(void *buf, uint32 size) { - if (!buf) { - return; - } + if(!(usbIsConnected() && usbIsConfigured())) { + return; + } + if (!buf) { + return; + } uint16 status = 0; uint16 oldstatus = 0; uint32 start = millis(); -- cgit v1.2.3