uDisplay - allow space as delimiter

This commit is contained in:
Stephan Hadinger 2021-04-25 16:21:37 +02:00
parent 8c42b5065d
commit fef7f0bf65
1 changed files with 9 additions and 4 deletions

View File

@ -108,7 +108,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
} }
if (*lp1 == ',') lp1++; if (*lp1 == ',') lp1++;
} }
if (*lp1 != ':' && *lp1 != '\n') { if (*lp1 != ':' && *lp1 != '\n' && *lp1 != ' ') { // Add space char
switch (section) { switch (section) {
case 'H': case 'H':
// header line // header line
@ -288,11 +288,16 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
} }
} }
} }
if (*lp == '\n') { if (*lp == '\n' || *lp == ' ') { // Add space char
lp++; lp++;
} else { } else {
lp = strchr(lp, '\n'); lp = strchr(lp, '\n');
if (!lp) break; if (!lp) {
lp = strchr(lp, ' ');
if (!lp) {
break;
}
}
lp++; lp++;
} }
} }
@ -1262,7 +1267,7 @@ void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) {
uint8_t uDisplay::strlen_ln(char *str) { uint8_t uDisplay::strlen_ln(char *str) {
for (uint32_t cnt = 0; cnt < 256; cnt++) { 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; return 0;
} }