Moved mode names (& slider data) to a static array

-- may break some things --
This commit is contained in:
Blaz Kristan
2022-05-21 18:37:09 +02:00
parent e003ec39fb
commit a6d7ed3824
6 changed files with 419 additions and 26 deletions

View File

@@ -234,6 +234,22 @@ void releaseJSONBufferLock()
// caller must provide large enough buffer for name (incluing SR extensions)!
uint8_t extractModeName(uint8_t mode, const char *src, char *dest, uint8_t maxLen)
{
if (src == JSON_mode_names) {
if (mode < MODE_COUNT) {
char lineBuffer[256];
strcpy_P(lineBuffer, (const char*)pgm_read_dword(&(WS2812FX::_modeData[mode])));
if (strlen(lineBuffer) > 0) {
size_t j = 0;
for (; j < maxLen; j++) {
if (lineBuffer[j] == '\0' || lineBuffer[j] == '@') break;
dest[j] = lineBuffer[j];
}
dest[j] = 0; // terminate string
}
return strlen(dest);
} else return 0;
}
uint8_t qComma = 0;
bool insideQuotes = false;
uint8_t printedChars = 0;