From bb90b55ddec9c1817729a507ca096c2a514d8dc3 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Thu, 2 Dec 2021 21:30:11 -0500 Subject: [PATCH] Flush uart after getting message The internal stdout buffering causes problems when we're trying to get data, but the data doesn't have any newlines or anything like that. We're forced to wait for forever until the buffer gets filled up and output to the console. This solves that by flushing immediately after each message. --- examples/nordic_uart/nordic_uart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/nordic_uart/nordic_uart.c b/examples/nordic_uart/nordic_uart.c index 8cc4278..670a217 100644 --- a/examples/nordic_uart/nordic_uart.c +++ b/examples/nordic_uart/nordic_uart.c @@ -44,6 +44,7 @@ void notification_cb(const uuid_t* uuid, const uint8_t* data, size_t data_length for(i = 0; i < data_length; i++) { printf("%c", data[i]); } + fflush(stdout); } static void usage(char *argv[]) {