From 1766b7d6c006f6885860a9d2a37feba1f0ce75a7 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 13 Oct 2022 09:27:45 +0200 Subject: [PATCH] fix: hard coded special characters (#2538) * fix(B&W): delta character in outputs * fix: more special characters * fix: NV14 compilation --- radio/src/gui/128x64/lcd.cpp | 14 +++++++------- radio/src/gui/128x64/model_outputs.cpp | 5 +++-- radio/src/gui/212x64/lcd.cpp | 8 ++++---- radio/src/gui/212x64/model_outputs.cpp | 3 ++- radio/src/gui/colorlcd/keyboard_curve.cpp | 11 ++++++----- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index e0250d00e..3fe923f76 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -734,11 +734,11 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att) idx = idx - MIXSRC_Rud; if (g_eeGeneral.anaNames[idx][0]) { if (idx < MIXSRC_FIRST_POT-MIXSRC_Rud ) - lcdDrawChar(x, y, '\207', att); // stick symbol + lcdDrawSizedText(x, y, STR_CHAR_STICK, 2, att); else if (idx <= MIXSRC_LAST_POT-MIXSRC_Rud ) - lcdDrawChar(x, y, '\210', att); // pot symbol + lcdDrawSizedText(x, y, STR_CHAR_POT, 2, att); else - lcdDrawChar(x, y, '\211', att); // slider symbol + lcdDrawSizedText(x, y, STR_CHAR_SLIDER, 2, att); lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, att); } else { @@ -751,20 +751,20 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att) if(idx >= MIXSRC_FIRST_FS_SWITCH) { idx = idx-(MIXSRC_FIRST_SWITCH+NUM_REGULAR_SWITCHES); if (ZEXIST(g_model.switchNames[idx])) { - lcdDrawChar(x, y, '\214', att); //switch symbol + lcdDrawSizedText(x, y, STR_CHAR_SWITCH, 2, att); lcdDrawSizedText(lcdNextPos, y, g_model.switchNames[idx], LEN_SWITCH_NAME, att); } else { char s[LEN_SWITCH_NAME] = {'S', 'W'}; s[LEN_SWITCH_NAME-1] = '1' + idx; - lcdDrawChar(x, y, '\214', att); //switch symbol + lcdDrawSizedText(x, y, STR_CHAR_SWITCH, 2, att); lcdDrawSizedText(lcdNextPos, y, s, LEN_SWITCH_NAME, att); } } else { idx = idx-MIXSRC_FIRST_SWITCH; if (ZEXIST(g_eeGeneral.switchNames[idx])) { - lcdDrawChar(x, y, '\214', att); //switch symbol + lcdDrawSizedText(x, y, STR_CHAR_SWITCH, 2, att); lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, att); } else @@ -773,7 +773,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att) #else idx = idx-MIXSRC_FIRST_SWITCH; if (ZEXIST(g_eeGeneral.switchNames[idx])) { - lcdDrawChar(x, y, '\214', att); //switch symbol + lcdDrawSizedText(x, y, STR_CHAR_SWITCH, 2, att); //switch symbol lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, att); } else diff --git a/radio/src/gui/128x64/model_outputs.cpp b/radio/src/gui/128x64/model_outputs.cpp index 0a41da90f..a766f5648 100644 --- a/radio/src/gui/128x64/model_outputs.cpp +++ b/radio/src/gui/128x64/model_outputs.cpp @@ -184,7 +184,8 @@ void menuModelLimitsOne(event_t event) #if defined(PPM_LIMITS_SYMETRICAL) case ITEM_OUTPUTONE_SYMETRICAL: lcdDrawTextAlignedLeft(y, TR_LIMITS_HEADERS_SUBTRIMMODE); - lcdDrawChar(LIMITS_ONE_2ND_COLUMN, y, ld->symetrical ? '=' : '\206', attr); + lcdDrawSizedText(LIMITS_ONE_2ND_COLUMN, y, + ld->symetrical ? "=" : STR_CHAR_DELTA, 2, attr); if (active) { CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1); } @@ -333,7 +334,7 @@ void menuModelLimits(event_t event) break; case ITEM_OUTPUTS_SYMETRICAL: - lcdDrawChar(LCD_W-FW, y, ld->symetrical ? '=' : '\206', 0); + lcdDrawSizedText(LCD_W-FW, y, ld->symetrical ? "=" : STR_CHAR_DELTA, 2, 0); break; } } diff --git a/radio/src/gui/212x64/lcd.cpp b/radio/src/gui/212x64/lcd.cpp index 8f0daca61..4d4e2c74b 100644 --- a/radio/src/gui/212x64/lcd.cpp +++ b/radio/src/gui/212x64/lcd.cpp @@ -657,11 +657,11 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att) idx = idx-MIXSRC_Rud; if (g_eeGeneral.anaNames[idx][0]) { if (idx < MIXSRC_FIRST_POT-MIXSRC_Rud ) - lcdDrawChar(x, y, '\207', att); //stick symbol + lcdDrawSizedText(x, y, STR_CHAR_STICK, 2, att); else if (idx < MIXSRC_FIRST_SLIDER-MIXSRC_Rud ) - lcdDrawChar(x, y, '\210', att); //pot symbol + lcdDrawSizedText(x, y, STR_CHAR_POT, 2, att); else - lcdDrawChar(x, y, '\211', att); //slider symbol + lcdDrawSizedText(x, y, STR_CHAR_SLIDER, 2, att); lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, att); } else @@ -670,7 +670,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att) else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) { idx = idx - MIXSRC_FIRST_SWITCH; if (g_eeGeneral.switchNames[idx][0]) { - lcdDrawChar(x, y, '\212', att); //switch symbol + lcdDrawSizedText(x, y, STR_CHAR_SWITCH, 2, att); lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, att); } else { diff --git a/radio/src/gui/212x64/model_outputs.cpp b/radio/src/gui/212x64/model_outputs.cpp index 887eb2ec9..832143c71 100644 --- a/radio/src/gui/212x64/model_outputs.cpp +++ b/radio/src/gui/212x64/model_outputs.cpp @@ -234,7 +234,8 @@ void menuModelLimits(event_t event) #if defined(PPM_LIMITS_SYMETRICAL) case ITEM_LIMITS_SYMETRICAL: - lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\206', attr); + lcdDrawSizedText(LCD_W - FW - MENUS_SCROLLBAR_WIDTH, y, + ld->symetrical ? "=" : STR_CHAR_DELTA, 2, attr); if (active) { CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1); } diff --git a/radio/src/gui/colorlcd/keyboard_curve.cpp b/radio/src/gui/colorlcd/keyboard_curve.cpp index db9118c2c..9bef69e38 100644 --- a/radio/src/gui/colorlcd/keyboard_curve.cpp +++ b/radio/src/gui/colorlcd/keyboard_curve.cpp @@ -21,7 +21,8 @@ #include "keyboard_curve.h" #include "button.h" -#include "lcd.h" + +#include "translations/untranslated.h" constexpr coord_t KEYBOARD_HEIGHT = 110; @@ -31,28 +32,28 @@ CurveKeyboard::CurveKeyboard() : Keyboard(KEYBOARD_HEIGHT) { // up - new TextButton(this, {LCD_W / 2 - 20, 5, 40, 40}, "\200", + new TextButton(this, {LCD_W / 2 - 20, 5, 40, 40}, STR_CHAR_UP, [=]() -> uint8_t { pushEvent(EVT_VIRTUAL_KEY_UP); return 0; }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS); // down - new TextButton(this, {LCD_W / 2 - 20, 65, 40, 40}, "\201", + new TextButton(this, {LCD_W / 2 - 20, 65, 40, 40}, STR_CHAR_DOWN, [=]() -> uint8_t { pushEvent(EVT_VIRTUAL_KEY_DOWN); return 0; }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS); // left - left = new TextButton(this, {LCD_W / 2 - 70, 35, 40, 40}, "\177", + left = new TextButton(this, {LCD_W / 2 - 70, 35, 40, 40}, STR_CHAR_LEFT, [=]() -> uint8_t { pushEvent(EVT_VIRTUAL_KEY_LEFT); return 0; }, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS); // right - right = new TextButton(this, {LCD_W / 2 + 30, 35, 40, 40}, "\176", + right = new TextButton(this, {LCD_W / 2 + 30, 35, 40, 40}, STR_CHAR_RIGHT, [=]() -> uint8_t { pushEvent(EVT_VIRTUAL_KEY_RIGHT); return 0;