Updated usermods for WLED-SR FX mode names.

This commit is contained in:
Blaž Kristan
2021-11-02 13:12:14 +01:00
parent 73c75635b1
commit 10fc9fe268
9 changed files with 71 additions and 299 deletions

View File

@@ -285,33 +285,9 @@ class St7789DisplayUsermod : public Usermod {
// mode name
tft.setTextColor(TFT_CYAN);
tft.setCursor(0, 144);
uint8_t qComma = 0;
bool insideQuotes = false;
uint8_t printedChars = 0;
char singleJsonSymbol;
// Find the mode name in JSON
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++)
{
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i);
switch (singleJsonSymbol)
{
case '"':
insideQuotes = !insideQuotes;
break;
case '[':
case ']':
break;
case ',':
qComma++;
default:
if (!insideQuotes || (qComma != knownMode))
break;
tft.print(singleJsonSymbol);
printedChars++;
}
if ((qComma > knownMode) || (printedChars > tftcharwidth - 1))
break;
}
char lineBuffer[tftcharwidth+1];
extractModeName(knownMode, JSON_mode_names, lineBuffer, tftcharwidth);
tft.print(lineBuffer);
// palette name
tft.setTextColor(TFT_YELLOW);