feat: add support UTF-8 ° symbol for B&W radios (#2359)

- remove translation workaround for the `°` symbol
- switch every use of the `@` char for a `°` char to a new define
  - same for `≥` and `}`
This commit is contained in:
Malte Langermann
2022-09-26 12:45:04 +10:00
committed by GitHub
parent 22d784a20e
commit 83c21ad054
22 changed files with 26 additions and 66 deletions
+1 -1
View File
@@ -878,7 +878,7 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
att &= ~RIGHT & ~BOLD;
uint32_t absvalue = abs(value);
lcdDrawNumber(x, y, absvalue / 1000000, att); // ddd
lcdDrawChar(lcdLastRightPos, y, '@', att);
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, att);
absvalue = absvalue % 1000000;
absvalue *= 60;
if (g_eeGeneral.gpsFormat == 0 || !seconds) {
+1 -1
View File
@@ -47,7 +47,7 @@ void runPopupCurvePreset(event_t event)
}
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS);
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, '@', INVERS);
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, STR_CHAR_BW_DEGREE, INVERS);
if (warningResult) {
warningResult = 0;
+2 -2
View File
@@ -135,12 +135,12 @@ void menuRadioDiagAnalogs(event_t event)
uint8_t x = INDENT_WIDTH;
lcdDrawText(x, y, "X:");
lcdDrawNumber(x+3*FW-1, y, gyro.outputs[0] * 180 / 1024);
lcdDrawChar(lcdNextPos, y, '@');
lcdDrawChar(lcdNextPos, y, STR_CHAR_BW_DEGREE);
lcdDrawNumber(x+10*FW-1, y, gyro.scaledX(), RIGHT);
x = LCD_W/2 + INDENT_WIDTH;
lcdDrawText(x, y, "Y:");
lcdDrawNumber(x+3*FW-1, y, gyro.outputs[1] * 180 / 1024);
lcdDrawChar(lcdNextPos, y, '@');
lcdDrawChar(lcdNextPos, y, STR_CHAR_BW_DEGREE);
lcdDrawNumber(x+10*FW-1, y, gyro.scaledY(), RIGHT);
#endif
}
+2 -2
View File
@@ -398,7 +398,7 @@ void menuRadioSetup(event_t event)
case ITEM_RADIO_SETUP_IMU_MAX:
lcdDrawText(INDENT_WIDTH, y, STR_IMU_MAX);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, IMU_MAX_DEFAULT + g_eeGeneral.imuMax, attr|LEFT);
lcdDrawChar(lcdLastRightPos, y, '@', attr);
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, attr);
if (attr) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.imuMax, IMU_MAX_DEFAULT - IMU_MAX_RANGE, IMU_MAX_DEFAULT + IMU_MAX_RANGE);
lcdDrawText(LCD_W-4*FW, y, "(");
@@ -410,7 +410,7 @@ void menuRadioSetup(event_t event)
case ITEM_RADIO_SETUP_IMU_OFFSET:
lcdDrawText(INDENT_WIDTH, y, STR_IMU_OFFSET);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.imuOffset, attr|LEFT);
lcdDrawChar(lcdLastRightPos, y, '@', attr);
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, attr);
if (attr) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.imuOffset, IMU_OFFSET_MIN, IMU_OFFSET_MAX);
lcdDrawText(LCD_W-4*FW, y, "(");
+1 -1
View File
@@ -762,7 +762,7 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
att &= ~RIGHT;
if (x > 10) x-=10;
lcdDrawNumber(x, y, absvalue / 1000000, att); // ddd
lcdDrawChar(lcdLastRightPos, y, '@', att);
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, att);
absvalue = absvalue % 1000000;
absvalue *= 60;
if (g_eeGeneral.gpsFormat == 0 || !seconds) {
+1 -1
View File
@@ -49,7 +49,7 @@ void runPopupCurvePreset(event_t event)
}
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS);
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, '@', INVERS);
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, STR_CHAR_BW_DEGREE, INVERS);
if (warningResult) {
warningResult = 0;
+4 -1
View File
@@ -22,6 +22,7 @@
#include <stdint.h>
#include "definitions.h"
#include "translations/untranslated.h"
#if defined(TRANSLATIONS_FR)
static wchar_t _utf8_lut[] = {
@@ -103,7 +104,9 @@ unsigned char map_utf8_char(const char*& s, uint8_t& len)
return (unsigned char)w;
}
if(w == L'≥')
return '}';
return STR_CHAR_BW_GREATEREQUAL;
if(w == L'°')
return STR_CHAR_BW_DEGREE;
#if !defined(NO_UTF8_LUT)
return lookup_utf8_mapping(w);
#else