From 83452d73bc2d2d8d14a2bbf097142731b201cba2 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Thu, 4 Mar 2021 11:17:17 +0100 Subject: [PATCH] Code clean-up. --- wled00/FX.cpp | 2 ++ wled00/const.h | 2 ++ wled00/json.cpp | 4 ++-- wled00/overlay.cpp | 2 +- wled00/wled.cpp | 2 ++ wled00/wled.h | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 30b1310b..cc712bf4 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -25,7 +25,9 @@ */ #include "FX.h" +#ifndef WLED_DISABLE_FX_HIGH_FLASH_USE #include "tv_colors.h" +#endif #define IBN 5100 #define PALETTE_SOLID_WRAP (paletteBlend == 1 || paletteBlend == 3) diff --git a/wled00/const.h b/wled00/const.h index faf5729f..c7ab4ebd 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -13,11 +13,13 @@ //increase if you need more #define WLED_MAX_USERMODS 4 +#ifndef WLED_MAX_BUSSES #ifdef ESP8266 #define WLED_MAX_BUSSES 3 #else #define WLED_MAX_BUSSES 10 #endif +#endif //Usermod IDs #define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present diff --git a/wled00/json.cpp b/wled00/json.cpp index fef878a9..6524f58a 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -781,13 +781,13 @@ void serveJson(AsyncWebServerRequest* request) bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient) { + #ifdef WLED_ENABLE_WEBSOCKETS AsyncWebSocketClient * wsc = nullptr; if (!request) { //not HTTP, use Websockets - #ifdef WLED_ENABLE_WEBSOCKETS wsc = ws.client(wsClient); if (!wsc || wsc->queueLength() > 0) return false; //only send if queue free - #endif } + #endif uint16_t used = ledCount; uint16_t n = (used -1) /MAX_LIVE_LEDS +1; //only serve every n'th LED if count over MAX_LIVE_LEDS diff --git a/wled00/overlay.cpp b/wled00/overlay.cpp index 87cb78c4..b427de40 100644 --- a/wled00/overlay.cpp +++ b/wled00/overlay.cpp @@ -369,7 +369,7 @@ void _drawOverlayCronixie() } #else // WLED_DISABLE_CRONIXIE -byte getSameCodeLength(char code, int index, char const cronixieDisplay[]) {} +byte getSameCodeLength(char code, int index, char const cronixieDisplay[]) {return 0;} void setCronixie() {} void _overlayCronixie() {} void _drawOverlayCronixie() {} diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 7106bc67..dcb6013c 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -219,6 +219,7 @@ void WLED::loop() //LED settings have been saved, re-init busses if (busConfigs[0] != nullptr) { + DEBUG_PRINTLN(F("Re-init busses.")); busses.removeAll(); uint32_t mem = 0; for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) { @@ -254,6 +255,7 @@ void WLED::loop() if (millis() - lastMqttReconnectAttempt > 30000) { // lastMqttReconnectAttempt = millis(); // don't do it in initMqtt() initMqtt(); + yield(); // refresh WLED nodes list refreshNodeList(); sendSysInfoUDP(); diff --git a/wled00/wled.h b/wled00/wled.h index e0514185..30ae1ab3 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2103030 +#define VERSION 2103040 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG