Reduction of flicering on web access (info)

This commit is contained in:
Blaz Kristan 2022-08-10 20:53:11 +02:00
parent e0a954caa2
commit 1cb3ab82c2
5 changed files with 20 additions and 7 deletions

View File

@ -809,6 +809,11 @@ void WS2812FX::finalizeInit(void)
seg.resetIfRequired();
}
// for the lack of better place enumerate ledmaps here
// if we do it in json.cpp (serializeInfo()) we are getting flashes on LEDs
// unfortunately this means we do not get updates after uploads
enumerateLedmaps();
_hasWhiteChannel = _isOffRefreshRequired = false;
//if busses failed to load, add default (fresh install, FS issue, ...)

View File

@ -327,6 +327,7 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
int16_t extractModeDefaults(uint8_t mode, const char *segVar);
uint16_t crc16(const unsigned char* data_p, size_t length);
um_data_t* simulateSound(uint8_t simulationId);
void enumerateLedmaps();
#ifdef WLED_ADD_EEPROM_SUPPORT
//wled_eeprom.cpp

View File

@ -654,12 +654,7 @@ void serializeInfo(JsonObject root)
JsonArray ledmaps = root.createNestedArray(F("maps"));
for (size_t i=0; i<10; i++) {
char fileName[16];
strcpy_P(fileName, PSTR("/ledmap"));
if (i) sprintf(fileName +7, "%d", i);
strcat_P(fileName, PSTR(".json"));
bool isFile = WLED_FS.exists(fileName);
if (isFile || i==0) ledmaps.add(i);
if ((ledMaps>>i) & 0x0001) ledmaps.add(i);
}
JsonObject wifi_info = root.createNestedObject("wifi");

View File

@ -503,3 +503,14 @@ um_data_t* simulateSound(uint8_t simulationId)
return um_data;
}
#endif
void enumerateLedmaps() {
ledMaps = 1;
for (size_t i=1; i<10; i++) {
char fileName[16];
sprintf_P(fileName, PSTR("/ledmap%d.json"), i);
bool isFile = WLED_FS.exists(fileName);
if (isFile) ledMaps |= 1 << i;
}
}

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2208061
#define VERSION 2208101
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG
@ -639,6 +639,7 @@ WLED_GLOBAL WS2812FX strip _INIT(WS2812FX());
WLED_GLOBAL BusConfig* busConfigs[WLED_MAX_BUSSES] _INIT({nullptr}); //temporary, to remember values from network callback until after
WLED_GLOBAL bool doInitBusses _INIT(false);
WLED_GLOBAL int8_t loadLedmap _INIT(-1);
WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available ledmaps
// Usermod manager
WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());