From 38a2b7bde76bf8a6106061c9ac6de473b276bae7 Mon Sep 17 00:00:00 2001 From: ingDIY <10012263+ingDIY@users.noreply.github.com> Date: Fri, 20 Jun 2025 13:53:18 +0200 Subject: [PATCH 1/2] fix_warning fixed warning: vars may be used uninitialized in this function --- wled00/FX.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 4a364ea654..1ad61b8dbc 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -7856,10 +7856,11 @@ uint16_t mode_particlefireworks(void) { // check each rocket's state and emit particles according to its state: moving up = emit exhaust, at top = explode; falling down = standby time uint32_t emitparticles, frequency, baseangle, hueincrement; // number of particles to emit for each rocket's state // variables for circular explosions - [[maybe_unused]] int32_t speed, currentspeed, speedvariation, percircle; + [[maybe_unused]] int32_t speed = 2; // just init to min value + [[maybe_unused]] int32_t currentspeed, percircle; int32_t counter = 0; - [[maybe_unused]] uint16_t angle; - [[maybe_unused]] unsigned angleincrement; + [[maybe_unused]] uint16_t angle = 0; // just init to zero + [[maybe_unused]] unsigned angleincrement = 2730; // minimum 15° bool circularexplosion = false; // emit particles for each rocket From ea49a7443c6b2a19fb97a6dfbfcf9c2a4f5d2361 Mon Sep 17 00:00:00 2001 From: ingDIY <10012263+ingDIY@users.noreply.github.com> Date: Fri, 20 Jun 2025 14:06:41 +0200 Subject: [PATCH 2/2] fixed unused var warnings fixed compiler warning: var is unused --- wled00/cfg.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 6d5698f426..e3686078d1 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -775,8 +775,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { static const char s_cfg_json[] PROGMEM = "/cfg.json"; void deserializeConfigFromFS() { - [[maybe_unused]] bool success = deserializeConfigSec(); #ifdef WLED_ADD_EEPROM_SUPPORT + bool success = deserializeConfigSec(); if (!success) { //if file does not exist, try reading from EEPROM deEEPSettings(); } @@ -785,8 +785,10 @@ void deserializeConfigFromFS() { if (!requestJSONBufferLock(1)) return; DEBUG_PRINTLN(F("Reading settings from /cfg.json...")); - + + #ifdef WLED_ADD_EEPROM_SUPPORT success = readObjectFromFile(s_cfg_json, nullptr, pDoc); + #endif // NOTE: This routine deserializes *and* applies the configuration // Therefore, must also initialize ethernet from this function @@ -1270,13 +1272,13 @@ bool deserializeConfigSec() { JsonObject ap = root["ap"]; getStringFromJson(apPass, ap["psk"] , 65); - [[maybe_unused]] JsonObject interfaces = root["if"]; - +#if !defined(WLED_DISABLE_MQTT) || !defined(WLED_DISABLE_HUESYNC) + JsonObject interfaces = root["if"]; +#endif #ifndef WLED_DISABLE_MQTT JsonObject if_mqtt = interfaces["mqtt"]; getStringFromJson(mqttPass, if_mqtt["psk"], 65); #endif - #ifndef WLED_DISABLE_HUESYNC getStringFromJson(hueApiKey, interfaces["hue"][F("key")], 47); #endif @@ -1314,7 +1316,9 @@ void serializeConfigSec() { JsonObject ap = root.createNestedObject("ap"); ap["psk"] = apPass; - [[maybe_unused]] JsonObject interfaces = root.createNestedObject("if"); +#if !defined(WLED_DISABLE_MQTT) || !defined(WLED_DISABLE_HUESYNC) + JsonObject interfaces = root.createNestedObject("if"); +#endif #ifndef WLED_DISABLE_MQTT JsonObject if_mqtt = interfaces.createNestedObject("mqtt"); if_mqtt["psk"] = mqttPass; @@ -1338,4 +1342,4 @@ void serializeConfigSec() { if (f) serializeJson(root, f); f.close(); releaseJSONBufferLock(); -} \ No newline at end of file +}