From 5995f8482243d2aa6bd0ef2d7e26c56fc39a33c9 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Sat, 2 Mar 2019 15:43:12 -0500 Subject: [PATCH] buffering logs sometimes freezes, stop for now --- targets/stm32l432/src/redirect.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/targets/stm32l432/src/redirect.c b/targets/stm32l432/src/redirect.c index ed4147f..da8b19d 100644 --- a/targets/stm32l432/src/redirect.c +++ b/targets/stm32l432/src/redirect.c @@ -28,20 +28,20 @@ int _write (int fd, const void *buf, unsigned long int len) { uint8_t * data = (uint8_t *) buf; #if DEBUG_LEVEL>1 - static uint8_t logbuf[1000] = {0}; - static int logbuflen = 0; - if (logbuflen + len > sizeof(logbuf)) { - int mlen = logbuflen + len - sizeof(logbuf); - memmove(logbuf, &logbuf[mlen], sizeof(logbuf) - mlen); - logbuflen -= mlen; - } - memcpy(&logbuf[logbuflen], data, len); - logbuflen += len; + // static uint8_t logbuf[1000] = {0}; + // static int logbuflen = 0; + // if (logbuflen + len > sizeof(logbuf)) { + // int mlen = logbuflen + len - sizeof(logbuf); + // memmove(logbuf, &logbuf[mlen], sizeof(logbuf) - mlen); + // logbuflen -= mlen; + // } + // memcpy(&logbuf[logbuflen], data, len); + // logbuflen += len; // Send out USB serial - uint8_t res = CDC_Transmit_FS(logbuf, logbuflen); - if (res == USBD_OK) - logbuflen = 0; + CDC_Transmit_FS(buf, len); + // if (res == USBD_OK) + // logbuflen = 0; #endif #ifdef ENABLE_SERIAL_PRINTING // Send out UART serial