From fef7f0bf657ff7702cb9a851d927e3d7972c6b4c Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sun, 25 Apr 2021 16:21:37 +0200 Subject: [PATCH] uDisplay - allow space as delimiter --- lib/lib_display/UDisplay/uDisplay.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index d529de26d..cbe950d94 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -108,7 +108,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { } if (*lp1 == ',') lp1++; } - if (*lp1 != ':' && *lp1 != '\n') { + if (*lp1 != ':' && *lp1 != '\n' && *lp1 != ' ') { // Add space char switch (section) { case 'H': // header line @@ -288,11 +288,16 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { } } } - if (*lp == '\n') { + if (*lp == '\n' || *lp == ' ') { // Add space char lp++; } else { lp = strchr(lp, '\n'); - if (!lp) break; + if (!lp) { + lp = strchr(lp, ' '); + if (!lp) { + break; + } + } lp++; } } @@ -1262,7 +1267,7 @@ void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) { uint8_t uDisplay::strlen_ln(char *str) { for (uint32_t cnt = 0; cnt < 256; cnt++) { - if (!str[cnt] || str[cnt] == '\n') return cnt; + if (!str[cnt] || str[cnt] == '\n' || str[cnt] == ' ') return cnt; } return 0; }