It did not like PROGMEM.

This commit is contained in:
Blaz Kristan 2022-05-22 00:41:45 +02:00
parent a6d7ed3824
commit 6e342983f9
4 changed files with 8 additions and 5 deletions

View File

@ -5911,7 +5911,7 @@ static const char *_data_FX_MODE_BLOBS PROGMEM = "2D Blobs@!,# blobs;!,!,!;!";
//////////////////////////////////////////////////////////////////////////////////////////
// mode data
const char * const WS2812FX::_modeData[] PROGMEM = {
const char *WS2812FX::_modeData[] = {
_data_FX_MODE_STATIC,
_data_FX_MODE_BLINK,
_data_FX_MODE_BREATH,

View File

@ -280,7 +280,7 @@ class WS2812FX {
public:
// mode (effect) name and its slider control data array
static const char * const _modeData[MODE_COUNT];
static const char *_modeData[];
// segment parameters
typedef struct Segment { // 35 (36 in memory) bytes

View File

@ -826,7 +826,8 @@ void serializeModeData(JsonArray fxdata)
for (size_t i = 0; i < MODE_COUNT; i++) {
//char buffer[256];
//strcpy_P(buffer, (const char*)pgm_read_dword(&(WS2812FX::_modeData[i])));
String lineBuffer = (const char*)pgm_read_dword(&(WS2812FX::_modeData[i]));
//String lineBuffer = (const char*)pgm_read_dword(&(WS2812FX::_modeData[i]));
String lineBuffer = WS2812FX::_modeData[i];
if (lineBuffer.length() > 0) {
uint8_t endPos = lineBuffer.indexOf('@');
if (endPos>0) fxdata.add(lineBuffer.substring(endPos));
@ -874,7 +875,8 @@ void serializeModeData(JsonArray fxdata)
// also removes WLED-SR extensions (@...) from deserialised names
void serializeModeNames(JsonArray arr, const char *qstring) {
for (size_t i = 0; i < MODE_COUNT; i++) {
String lineBuffer = (const char*)pgm_read_dword(&(WS2812FX::_modeData[i]));
//String lineBuffer = (const char*)pgm_read_dword(&(WS2812FX::_modeData[i]));
String lineBuffer = WS2812FX::_modeData[i];
if (lineBuffer.length() > 0) {
uint8_t endPos = lineBuffer.indexOf('@');
if (endPos>0) arr.add(lineBuffer.substring(0,endPos));

View File

@ -237,7 +237,8 @@ uint8_t extractModeName(uint8_t mode, const char *src, char *dest, uint8_t maxLe
if (src == JSON_mode_names) {
if (mode < MODE_COUNT) {
char lineBuffer[256];
strcpy_P(lineBuffer, (const char*)pgm_read_dword(&(WS2812FX::_modeData[mode])));
//strcpy_P(lineBuffer, (const char*)pgm_read_dword(&(WS2812FX::_modeData[mode])));
strcpy_P(lineBuffer, WS2812FX::_modeData[mode]);
if (strlen(lineBuffer) > 0) {
size_t j = 0;
for (; j < maxLen; j++) {