Basic utf8 support for B&W radios

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 86152da85d
commit 30e3ac3399
10 changed files with 259 additions and 77 deletions
+22 -5
View File
@@ -745,6 +745,14 @@ void checkSwitches()
LED_ERROR_END();
}
#elif defined(GUI)
static const char* switch_state_str[] {
" ",
STR_CHAR_UP,
"-",
STR_CHAR_DOWN,
};
void checkSwitches()
{
swarnstate_t last_bad_switches = 0xff;
@@ -780,10 +788,9 @@ void checkSwitches()
((states & mask) == (switches_states & mask)) ? 0 : INVERS;
if (attr) {
if (++numWarnings < 6) {
char c = (" " STR_CHAR_UP
"-" STR_CHAR_DOWN)[(states & mask) >> (i * 3)];
const char* s = switch_state_str[(states & mask) >> (i * 3)];
drawSource(x, y, MIXSRC_FIRST_SWITCH + i, attr);
lcdDrawChar(lcdNextPos, y, c, attr);
lcdDrawText(lcdNextPos, y, s, attr);
x = lcdNextPos + 3;
}
}
@@ -801,9 +808,19 @@ void checkSwitches()
if (++numWarnings < 6) {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, NUM_STICKS + 1 + i, INVERS);
if (IS_POT(POT1 + i))
lcdDrawChar(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? 126 : 127, INVERS); // TODO: use constants for chars
lcdDrawChar(
lcdNextPos, y,
g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i)
? 126
: 127,
INVERS); // TODO: use constants for chars
else
lcdDrawChar(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? CHAR_UP : CHAR_DOWN, INVERS);
lcdDrawText(
lcdNextPos, y,
g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i)
? STR_CHAR_UP
: STR_CHAR_DOWN,
INVERS);
x = lcdNextPos + 3;
}
}