From f6772eaf596894b63f508f21a37d0baf226c9db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Tue, 23 Mar 2021 07:05:40 +0100 Subject: [PATCH] FPS drop workaround. --- wled00/set.cpp | 1 + wled00/wled.cpp | 4 +++- wled00/wled.h | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wled00/set.cpp b/wled00/set.cpp index 42e3b276b..4eaee9afe 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -121,6 +121,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) // actual finalization is done in WLED::loop() (removing old busses and adding new) if (busConfigs[s] != nullptr) delete busConfigs[s]; busConfigs[s] = new BusConfig(type, pins, start, length, colorOrder, request->hasArg(cv), skipFirstLed); + doInitBusses = true; } ledCount = request->arg(F("LC")).toInt(); diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 951f02355..272522cda 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -218,7 +218,9 @@ void WLED::loop() handleBlynk(); //LED settings have been saved, re-init busses - if (busConfigs[0] != nullptr) { + //This code block causes severe FPS drop on ESP32 with the original "if (busConfigs[0] != nullptr)" conditional. Investigate! + if (doInitBusses) { + doInitBusses = false; DEBUG_PRINTLN(F("Re-init busses.")); busses.removeAll(); uint32_t mem = 0; diff --git a/wled00/wled.h b/wled00/wled.h index 06e403c72..b0960f66d 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2103221 +#define VERSION 2103230 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG @@ -173,7 +173,7 @@ #endif // Global Variable definitions -WLED_GLOBAL char versionString[] _INIT("0.12.0-b1"); +WLED_GLOBAL char versionString[] _INIT("0.12.0-b2"); #define WLED_CODENAME "Hikari" // AP and OTA default passwords (for maximum security change them!) @@ -563,7 +563,8 @@ WLED_GLOBAL bool e131NewData _INIT(false); // led fx library object WLED_GLOBAL BusManager busses _INIT(BusManager()); WLED_GLOBAL WS2812FX strip _INIT(WS2812FX()); -WLED_GLOBAL BusConfig* busConfigs[WLED_MAX_BUSSES]; //temporary, to remember values from network callback until after +WLED_GLOBAL BusConfig* busConfigs[WLED_MAX_BUSSES]; //temporary, to remember values from network callback until after +WLED_GLOBAL bool doInitBusses _INIT(false); // Usermod manager WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());