From e6a764b65097ca1c366d5826d6b4e844d5cd79dc Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Sun, 10 Oct 2021 21:39:21 +0200 Subject: [PATCH] correct launchsite display on oled --- RX_FSK/data/screens1.txt | 2 +- RX_FSK/src/Display.cpp | 20 ++++++++++++++++++-- RX_FSK/version.h | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/RX_FSK/data/screens1.txt b/RX_FSK/data/screens1.txt index baa0fd5..52bd823 100644 --- a/RX_FSK/data/screens1.txt +++ b/RX_FSK/data/screens1.txt @@ -115,7 +115,7 @@ timeaction=#,D,+ 0,5=S#: 0,9=T 3,0=F MHz -5,0=S +5,0,16=S 7,5=n ############ diff --git a/RX_FSK/src/Display.cpp b/RX_FSK/src/Display.cpp index 66d063f..7c708b9 100644 --- a/RX_FSK/src/Display.cpp +++ b/RX_FSK/src/Display.cpp @@ -305,6 +305,17 @@ void U8x8Display::getDispSize(uint8_t *height, uint8_t *width, uint8_t *lineskip void U8x8Display::drawString(uint16_t x, uint16_t y, const char *s, int16_t width, uint16_t fg, uint16_t bg) { char buf[50]; utf2latin15(s, buf, 50); + if(width!=WIDTH_AUTO && width>0) { + for(int l = strlen(buf); ldrawString(x, y, buf); } @@ -1355,8 +1366,13 @@ void Display::drawSite(DispEntry *de) { buf[5]=0; break; case 0: case 'l': default: // launch site - drawString(de, sonde.si()->launchsite); - return; + // TODO: This is a workaround to be compatible with older screens1.txt + // This does not work correctly with non-ascii utf8 characters. + // For this reason, this workaround will likely be removed in the future + // Instead, all screens?.txt should always indicate the max. length of the displayed string. + snprintf(buf, 17, "%-16s", sonde.si()->launchsite); + //drawString(de, sonde.si()->launchsite); + //return; } if(de->extra[0]) strcat(buf, de->extra+1); drawString(de, buf); diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 8e2ff68..70400e3 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20211009"; +const char *version_id = "devel20211010"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=16;