buffering logs sometimes freezes, stop for now
This commit is contained in:
parent
1ff00895b1
commit
5995f84822
@ -28,20 +28,20 @@ int _write (int fd, const void *buf, unsigned long int len)
|
|||||||
{
|
{
|
||||||
uint8_t * data = (uint8_t *) buf;
|
uint8_t * data = (uint8_t *) buf;
|
||||||
#if DEBUG_LEVEL>1
|
#if DEBUG_LEVEL>1
|
||||||
static uint8_t logbuf[1000] = {0};
|
// static uint8_t logbuf[1000] = {0};
|
||||||
static int logbuflen = 0;
|
// static int logbuflen = 0;
|
||||||
if (logbuflen + len > sizeof(logbuf)) {
|
// if (logbuflen + len > sizeof(logbuf)) {
|
||||||
int mlen = logbuflen + len - sizeof(logbuf);
|
// int mlen = logbuflen + len - sizeof(logbuf);
|
||||||
memmove(logbuf, &logbuf[mlen], sizeof(logbuf) - mlen);
|
// memmove(logbuf, &logbuf[mlen], sizeof(logbuf) - mlen);
|
||||||
logbuflen -= mlen;
|
// logbuflen -= mlen;
|
||||||
}
|
// }
|
||||||
memcpy(&logbuf[logbuflen], data, len);
|
// memcpy(&logbuf[logbuflen], data, len);
|
||||||
logbuflen += len;
|
// logbuflen += len;
|
||||||
|
|
||||||
// Send out USB serial
|
// Send out USB serial
|
||||||
uint8_t res = CDC_Transmit_FS(logbuf, logbuflen);
|
CDC_Transmit_FS(buf, len);
|
||||||
if (res == USBD_OK)
|
// if (res == USBD_OK)
|
||||||
logbuflen = 0;
|
// logbuflen = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_SERIAL_PRINTING
|
#ifdef ENABLE_SERIAL_PRINTING
|
||||||
// Send out UART serial
|
// Send out UART serial
|
||||||
|
Loading…
x
Reference in New Issue
Block a user