- larger stack buffer for oappend
- increase max segment name for ESP32
This commit is contained in:
Blaz Kristan 2023-06-27 16:01:20 +02:00
parent 481bd6f57a
commit f442aad962
6 changed files with 998 additions and 981 deletions

View File

@ -5879,7 +5879,7 @@ uint16_t mode_2Dscrollingtext(void) {
} }
const bool zero = SEGMENT.check3; const bool zero = SEGMENT.check3;
const int yoffset = map(SEGMENT.intensity, 0, 255, -rows/2, rows/2) + (rows-letterHeight)/2; const int yoffset = map(SEGMENT.intensity, 0, 255, -rows/2, rows/2) + (rows-letterHeight)/2;
char text[33] = {'\0'}; char text[WLED_MAX_SEGNAME_LEN+1] = {'\0'};
if (SEGMENT.name) for (size_t i=0,j=0; i<strlen(SEGMENT.name); i++) if (SEGMENT.name[i]>31 && SEGMENT.name[i]<128) text[j++] = SEGMENT.name[i]; if (SEGMENT.name) for (size_t i=0,j=0; i<strlen(SEGMENT.name); i++) if (SEGMENT.name[i]>31 && SEGMENT.name[i]<128) text[j++] = SEGMENT.name[i];
if (!strlen(text) if (!strlen(text)

View File

@ -91,6 +91,21 @@
#endif #endif
#endif #endif
#ifndef WLED_MAX_SEGNAME_LEN
#ifdef ESP8266
#define WLED_MAX_SEGNAME_LEN 32
#else
#define WLED_MAX_SEGNAME_LEN 64
#endif
#else
#if WLED_MAX_SEGNAME_LEN<32
#undef WLED_MAX_SEGNAME_LEN
#define WLED_MAX_SEGNAME_LEN 32
#else
#warning WLED UI does not support modified maximum segment name length!
#endif
#endif
//Usermod IDs //Usermod IDs
#define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present #define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present
#define USERMOD_ID_UNSPECIFIED 1 //Default value for a general user mod that does not specify a custom ID #define USERMOD_ID_UNSPECIFIED 1 //Default value for a general user mod that does not specify a custom ID
@ -388,7 +403,7 @@
#ifdef ESP8266 #ifdef ESP8266
#define SETTINGS_STACK_BUF_SIZE 2048 #define SETTINGS_STACK_BUF_SIZE 2048
#else #else
#define SETTINGS_STACK_BUF_SIZE 3096 #define SETTINGS_STACK_BUF_SIZE 3608 // warning: quite a large value for stack
#endif #endif
#ifdef WLED_USE_ETHERNET #ifdef WLED_USE_ETHERNET

View File

@ -773,7 +773,7 @@ function populateSegments(s)
`<i class="icons e-icon flr" id="sege${i}" onclick="expand(${i})">&#xe395;</i>`+ `<i class="icons e-icon flr" id="sege${i}" onclick="expand(${i})">&#xe395;</i>`+
(cfg.comp.segpwr ? segp : '') + (cfg.comp.segpwr ? segp : '') +
`<div class="segin" id="seg${i}in">`+ `<div class="segin" id="seg${i}in">`+
`<input type="text" class="ptxt" id="seg${i}t" autocomplete="off" maxlength=32 value="${inst.n?inst.n:""}" placeholder="Enter name..."/>`+ `<input type="text" class="ptxt" id="seg${i}t" autocomplete="off" maxlength=${li.arch=="esp8266"?32:64} value="${inst.n?inst.n:""}" placeholder="Enter name..."/>`+
`<table class="infot segt">`+ `<table class="infot segt">`+
`<tr>`+ `<tr>`+
`<td>${isMSeg?'Start X':'Start LED'}</td>`+ `<td>${isMSeg?'Start X':'Start LED'}</td>`+

File diff suppressed because it is too large Load Diff

View File

@ -70,9 +70,10 @@ bool deserializeSegment(JsonObject elem, byte it, byte presetId)
const char * name = elem["n"].as<const char*>(); const char * name = elem["n"].as<const char*>();
size_t len = 0; size_t len = 0;
if (name != nullptr) len = strlen(name); if (name != nullptr) len = strlen(name);
if (len > 0 && len < 33) { if (len > 0) {
if (len > WLED_MAX_SEGNAME_LEN) len = WLED_MAX_SEGNAME_LEN;
seg.name = new char[len+1]; seg.name = new char[len+1];
if (seg.name) strlcpy(seg.name, name, 33); if (seg.name) strlcpy(seg.name, name, WLED_MAX_SEGNAME_LEN+1);
} else { } else {
// but is empty (already deleted above) // but is empty (already deleted above)
elem.remove("n"); elem.remove("n");
@ -425,7 +426,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
// a) already applied preset content (requires "seg" or "win" but will ignore the rest) // a) already applied preset content (requires "seg" or "win" but will ignore the rest)
if (!root["pd"].isNull() && stateChanged) { if (!root["pd"].isNull() && stateChanged) {
currentPreset = root[F("pd")] | currentPreset; currentPreset = root[F("pd")] | currentPreset;
if (root["win"].isNull()) presetCycCurr = currentPreset; if (root["win"].isNull()) presetCycCurr = currentPreset; // otherwise it was set in handleSet() [set.cpp]
presetToRestore = currentPreset; // stateUpdated() will clear the preset, so we need to restore it after presetToRestore = currentPreset; // stateUpdated() will clear the preset, so we need to restore it after
//unloadPlaylist(); // applying a preset unloads the playlist, may be needed here too? //unloadPlaylist(); // applying a preset unloads the playlist, may be needed here too?
} else if (!root["ps"].isNull()) { } else if (!root["ps"].isNull()) {

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2306240 #define VERSION 2306270
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG