From 1f89786021d318b71eb72e8d8bc9111ca03d0e54 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Wed, 4 Nov 2020 19:32:46 +0100
Subject: [PATCH] fix(serial): Unblock if the queue is full

For some reason a portYIELD() is not enough to give the serial task the
option to run. I tried vTaskDelay() and that works. To not block more than
needed portYIELD() is still called when the queue is not full and only
call vTaskDelay() when it is full.

Closes #218
---
 epicardium/modules/serial.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/epicardium/modules/serial.c b/epicardium/modules/serial.c
index e80e30f75..f2ec9e934 100644
--- a/epicardium/modules/serial.c
+++ b/epicardium/modules/serial.c
@@ -119,7 +119,11 @@ void epic_uart_write_str(const char *str, size_t length)
 					SERIAL_WRITE_NOTIFY,
 					eSetBits
 				);
-				portYIELD();
+				if (bytes_sent == 0) {
+					vTaskDelay(1);
+				} else {
+					portYIELD();
+				}
 			}
 		} while (index < length);
 	}
-- 
GitLab