Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Initialize or remove uninitialized variables currentspeed and percircle
These variables are declared uninitialized and marked [[maybe_unused]], which risks undefined behavior if they later become used. Either initialize them explicitly (e.g., = 0) or remove them if truly unused.

🤖 Prompt for AI Agents
In wled00/FX.cpp at line 7860, the variables currentspeed and percircle are
declared but uninitialized and marked [[maybe_unused]], which can lead to
undefined behavior if used later. To fix this, either initialize both variables
explicitly to zero or another appropriate default value, or remove their
declarations entirely if they are not used anywhere in the code.

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
Expand Down
18 changes: 11 additions & 7 deletions wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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
Comment on lines +789 to +791
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical logic error: cfg.json reading should not depend on EEPROM support.

The readObjectFromFile call reads from the filesystem (/cfg.json), not from EEPROM. Making this conditional on WLED_ADD_EEPROM_SUPPORT means the configuration file won't be read when EEPROM support is disabled, causing deserializeConfig() to operate on an empty JsonObject.

This breaks the core configuration loading functionality when EEPROM support is compiled out.

-  #ifdef WLED_ADD_EEPROM_SUPPORT
   success = readObjectFromFile(s_cfg_json, nullptr, pDoc);
-  #endif
🤖 Prompt for AI Agents
In wled00/cfg.cpp around lines 789 to 791, remove the #ifdef
WLED_ADD_EEPROM_SUPPORT conditional around the readObjectFromFile call so that
the configuration file is always read regardless of EEPROM support. This ensures
deserializeConfig() receives the correct JsonObject from the filesystem and
prevents loading failures when EEPROM support is disabled.


// NOTE: This routine deserializes *and* applies the configuration
// Therefore, must also initialize ethernet from this function
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -1338,4 +1342,4 @@ void serializeConfigSec() {
if (f) serializeJson(root, f);
f.close();
releaseJSONBufferLock();
}
}