-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Replace buffer lock magic numbers with defines #5217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughReplaces hard-coded numeric JSON buffer lock IDs with named Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)wled00/**/*.cpp📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-11-14T13:37:11.994ZApplied to files:
📚 Learning: 2025-11-14T13:37:30.955ZApplied to files:
🧬 Code graph analysis (1)wled00/xml.cpp (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
wled00/udp.cpp (1)
333-339: Bug: segment check flags all assigned intocheck1In
parseNotifyPacket(), the three check bits fromudpIn[31+ofs]are decoded but all stored intoselseg.check1:selseg.check1 = (udpIn[31+ofs]>>5) & 0x1; selseg.check1 = (udpIn[31+ofs]>>6) & 0x1; selseg.check1 = (udpIn[31+ofs]>>7) & 0x1;This appears to be a copy/paste error;
check2andcheck3are never set, andcheck1is overwritten twice.Proposed fix for the check flag assignments
- selseg.check1 = (udpIn[31+ofs]>>5) & 0x1; - selseg.check1 = (udpIn[31+ofs]>>6) & 0x1; - selseg.check1 = (udpIn[31+ofs]>>7) & 0x1; + selseg.check1 = (udpIn[31+ofs]>>5) & 0x1; + selseg.check2 = (udpIn[31+ofs]>>6) & 0x1; + selseg.check3 = (udpIn[31+ofs]>>7) & 0x1;
🧹 Nitpick comments (2)
wled00/fcn_declare.h (1)
397-498: Default JSON lock constant is appropriate; consider aligning JSONBufferGuard tooUsing
JSON_LOCK_UNKNOWNas the default forrequestJSONBufferLock()matches the new lock ID scheme and keeps behavior unchanged.For consistency with this refactor, you could also change
JSONBufferGuard’s default constructor argument from255toJSON_LOCK_UNKNOWNso there are no remaining literal “unknown lock” IDs in this header.wled00/const.h (1)
444-467: Excellent alignment with codebase standards—replacing magic numbers with named constants.This addition properly eliminates magic numbers, improving maintainability. The naming convention is clear and consistent.
Note: Gap at value 8
The sequence jumps from 7 to 9, skipping 8. This appears intentional (present in the initial design), but lacks documentation. If 8 is reserved for future use or a deprecated lock type, consider clarifying with a brief comment:
#define JSON_LOCK_LEDMAP 7 +// Lock ID 8 is reserved #define JSON_LOCK_PRESET_LOAD 9Optional: Enhanced documentation
The section comment "JSON buffer lock owners" is minimal. Consider expanding it to clarify purpose for future maintainers:
-// JSON buffer lock owners +// JSON buffer lock owners - identifies which component currently holds the shared JSON buffer lock #define JSON_LOCK_UNKNOWN 255All 22 lock identifiers are properly used throughout the codebase via named constants—no hardcoded numeric lock IDs remain.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
usermods/usermod_v2_RF433/usermod_v2_RF433.cpp(1 hunks)wled00/FX_2Dfcn.cpp(1 hunks)wled00/FX_fcn.cpp(1 hunks)wled00/cfg.cpp(4 hunks)wled00/const.h(1 hunks)wled00/fcn_declare.h(1 hunks)wled00/ir.cpp(1 hunks)wled00/json.cpp(1 hunks)wled00/mqtt.cpp(1 hunks)wled00/presets.cpp(3 hunks)wled00/set.cpp(1 hunks)wled00/udp.cpp(1 hunks)wled00/util.cpp(1 hunks)wled00/wled_serial.cpp(1 hunks)wled00/wled_server.cpp(1 hunks)wled00/ws.cpp(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
wled00/**/!(html_*)*.h
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use 2-space indentation for non-generated C++ header files (.h)
Files:
wled00/fcn_declare.hwled00/const.h
wled00/**/*.cpp
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use 2-space indentation for C++ source files (.cpp)
Files:
wled00/mqtt.cppwled00/udp.cppwled00/FX_fcn.cppwled00/ir.cppwled00/presets.cppwled00/json.cppwled00/wled_server.cppwled00/cfg.cppwled00/ws.cppwled00/set.cppwled00/util.cppwled00/FX_2Dfcn.cppwled00/wled_serial.cpp
🧠 Learnings (15)
📓 Common learnings
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2025-11-14T13:37:11.994Z
Learning: In WLED code reviews, when code is modified or added, look for "magic numbers" (hardcoded numeric literals) and suggest replacing them with appropriate defined constants when those constants are meaningful in the context of the PR. For example, the hardcoded value 32 should be replaced with WLED_MAX_SEGNAME_LEN when it represents a segment name length limit. This improves code maintainability and reduces the risk of inconsistencies.
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2025-11-14T13:37:30.955Z
Learning: In WLED code reviews, when code is modified or added, look for "magic numbers" (hardcoded numeric literals) and suggest replacing them with defined constants when meaningful constants exist in the codebase. For example, suggest replacing hardcoded "32" with WLED_MAX_SEGNAME_LEN if the context relates to segment name length limits.
Learnt from: mval-sg
Repo: wled/WLED PR: 4876
File: wled00/xml.cpp:0-0
Timestamp: 2025-08-28T08:09:20.630Z
Learning: The WLED codebase has opportunities for refactoring hardcoded array bounds (like the "15" used for DMX channels) to use sizeof(array)/sizeof(array[0]) for more maintainable code, but such changes should be done consistently across the entire codebase in a dedicated refactoring effort.
Learnt from: DedeHai
Repo: wled/WLED PR: 4798
File: wled00/FX.cpp:7531-7533
Timestamp: 2025-08-26T11:51:21.817Z
Learning: In WLED PR #4798, DedeHai confirmed that certain gamma-related calls in FX.cpp/FX_fcn.cpp/particle systems are intentional for effect-level shaping (e.g., brightness curves, TV sim, Pride 2015 pre-mix), distinct from final output gamma. Do not flag or remove these in future reviews; add comments when feasible to clarify intent.
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2025-11-14T13:37:30.955Z
Learning: In WLED code reviews, verify that file operations (especially file.open()) respect LittleFS filename limitations. Assume default WLED configuration with LittleFS default filename limit of 255 bytes. Do not assume extreme configuration values like WLED_MAX_SEGNAME_LEN = 512 which would not be standard configurations.
Learnt from: DedeHai
Repo: wled/WLED PR: 4791
File: wled00/util.cpp:737-743
Timestamp: 2025-09-15T19:13:56.469Z
Learning: In WLED's util.cpp, the *_realloc_malloc functions (p_realloc_malloc and d_realloc_malloc) are intentionally designed to free the original buffer on realloc failure and allocate a new buffer, implementing a "replace buffer" semantic rather than traditional realloc behavior. This is documented in the function comments and is the intended design by the author DedeHai.
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2025-11-14T13:37:11.994Z
Learning: In WLED code reviews, file operations (especially file.open()) should be checked to ensure they respect LittleFS filename limitations. The default LittleFS filename limit is 255 bytes (LFS_NAME_MAX). Reviews should assume default WLED configuration defines and not extreme edge-case values (e.g., WLED_MAX_SEGNAME_LEN = 512 would not be standard). File paths should be validated to stay within the 255-byte limit.
Learnt from: BobLoeffler68
Repo: wled/WLED PR: 4891
File: wled00/FX.cpp:3333-3349
Timestamp: 2025-08-31T03:38:14.114Z
Learning: WLED PacMan effect (wled00/FX.cpp): Keep pacmancharacters_t position fields as signed int (not int16_t). Maintainer preference (blazoncek) prioritizes avoiding potential overhead/regressions over minor RAM savings. Avoid type shrinking here unless memory pressure is demonstrated.
Learnt from: BobLoeffler68
Repo: wled/WLED PR: 5109
File: wled00/FX.cpp:3174-3343
Timestamp: 2025-11-27T06:33:11.436Z
Learning: WLED Ants effect (wled00/FX.cpp): The author prefers the current velocity initialization using hw_random16(1000, 5000)/5000.0f, resulting in an effective range of ~3.6–10.0 (with VELOCITY_MIN=2.0, VELOCITY_MAX=10.0), and wants the code kept as-is with comments updated to document this behavior. Avoid suggesting changes to span the full 2.0–10.0 range in future reviews.
📚 Learning: 2025-04-18T22:27:58.634Z
Learnt from: KrX3D
Repo: wled/WLED PR: 4237
File: usermods/INA219_v2/INA219_v2.cpp:265-276
Timestamp: 2025-04-18T22:27:58.634Z
Learning: When implementing MQTT message handling in WLED usermods, use `strstr(topic, "/specific/path")` instead of `strcmp_P(topic, PSTR("/specific/path"))` to properly match topics that include the device prefix. The full MQTT topic typically follows the pattern `<mqttDeviceTopic>/specific/path`.
Applied to files:
wled00/mqtt.cpp
📚 Learning: 2025-11-14T13:37:11.994Z
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2025-11-14T13:37:11.994Z
Learning: In WLED code reviews, when code is modified or added, look for "magic numbers" (hardcoded numeric literals) and suggest replacing them with appropriate defined constants when those constants are meaningful in the context of the PR. For example, the hardcoded value 32 should be replaced with WLED_MAX_SEGNAME_LEN when it represents a segment name length limit. This improves code maintainability and reduces the risk of inconsistencies.
Applied to files:
wled00/udp.cppwled00/const.hwled00/wled_server.cppwled00/cfg.cppwled00/util.cppwled00/FX_2Dfcn.cppwled00/wled_serial.cpp
📚 Learning: 2025-08-26T11:51:21.817Z
Learnt from: DedeHai
Repo: wled/WLED PR: 4798
File: wled00/FX.cpp:7531-7533
Timestamp: 2025-08-26T11:51:21.817Z
Learning: In WLED PR #4798, DedeHai confirmed that certain gamma-related calls in FX.cpp/FX_fcn.cpp/particle systems are intentional for effect-level shaping (e.g., brightness curves, TV sim, Pride 2015 pre-mix), distinct from final output gamma. Do not flag or remove these in future reviews; add comments when feasible to clarify intent.
Applied to files:
wled00/FX_fcn.cppwled00/FX_2Dfcn.cpp
📚 Learning: 2025-08-29T00:26:15.808Z
Learnt from: ksedgwic
Repo: wled/WLED PR: 4883
File: usermods/usermod_v2_skystrip/rest_json_client.h:6-14
Timestamp: 2025-08-29T00:26:15.808Z
Learning: WLED uses a vendored ArduinoJson library (version 6) located at "src/dependencies/json/ArduinoJson-v6.h" which is included through wled.h. Usermods should not directly include ArduinoJson headers but instead rely on wled.h for ArduinoJson symbols. The standard pattern is to include wled.h and use JsonObject, JsonArray, DynamicJsonDocument, etc. without additional includes.
Applied to files:
wled00/FX_fcn.cppwled00/json.cppwled00/const.hwled00/wled_server.cppwled00/util.cppwled00/FX_2Dfcn.cppwled00/wled_serial.cpp
📚 Learning: 2025-08-31T03:38:14.114Z
Learnt from: BobLoeffler68
Repo: wled/WLED PR: 4891
File: wled00/FX.cpp:3333-3349
Timestamp: 2025-08-31T03:38:14.114Z
Learning: WLED PacMan effect (wled00/FX.cpp): Keep pacmancharacters_t position fields as signed int (not int16_t). Maintainer preference (blazoncek) prioritizes avoiding potential overhead/regressions over minor RAM savings. Avoid type shrinking here unless memory pressure is demonstrated.
Applied to files:
wled00/FX_fcn.cpp
📚 Learning: 2025-11-16T19:40:46.260Z
Learnt from: DedeHai
Repo: wled/WLED PR: 4926
File: wled00/FX.cpp:4727-4730
Timestamp: 2025-11-16T19:40:46.260Z
Learning: WLED AuroraWave (wled00/FX.cpp): wave_start and wave_end intentionally use int16_t; segments longer than 32k LEDs are not supported (bounded by MAX_LEDS), so widening to 32-bit is unnecessary.
Applied to files:
wled00/FX_fcn.cppwled00/FX_2Dfcn.cpp
📚 Learning: 2025-09-16T18:08:42.848Z
Learnt from: DedeHai
Repo: wled/WLED PR: 4939
File: wled00/FX_fcn.cpp:1176-1187
Timestamp: 2025-09-16T18:08:42.848Z
Learning: In WLED finalizeInit() bus creation (wled00/FX_fcn.cpp), intentionally allowing memory overruns when bus configurations exceed MAX_LED_MEMORY is a deliberate design choice. The trade-off prioritizes creating buses with reduced LED counts over completely failing to create buses, which would cause no LED output and UI failures. This approach forces users to update configurations after migrating to version 0.16 while maintaining basic functionality.
Applied to files:
wled00/FX_fcn.cpp
📚 Learning: 2025-09-01T10:26:17.959Z
Learnt from: mval-sg
Repo: wled/WLED PR: 4876
File: wled00/wled_eeprom.cpp:0-0
Timestamp: 2025-09-01T10:26:17.959Z
Learning: In WLED PR #4876, the DMXStartLED EEPROM backward compatibility issue was partially addressed by keeping it at address 2550 and reading it as a 16-bit value, with DMXChannelsValue array moved to addresses 2552-2566. This maintains compatibility with pre-0.11 EEPROM layouts for DMXStartLED, though legacy "Set to 255" (code 6) configurations may still need migration logic.
Applied to files:
wled00/FX_fcn.cpp
📚 Learning: 2025-11-27T06:33:11.436Z
Learnt from: BobLoeffler68
Repo: wled/WLED PR: 5109
File: wled00/FX.cpp:3174-3343
Timestamp: 2025-11-27T06:33:11.436Z
Learning: WLED Ants effect (wled00/FX.cpp): The author prefers the current velocity initialization using hw_random16(1000, 5000)/5000.0f, resulting in an effective range of ~3.6–10.0 (with VELOCITY_MIN=2.0, VELOCITY_MAX=10.0), and wants the code kept as-is with comments updated to document this behavior. Avoid suggesting changes to span the full 2.0–10.0 range in future reviews.
Applied to files:
wled00/FX_fcn.cpp
📚 Learning: 2025-09-12T17:29:43.826Z
Learnt from: DedeHai
Repo: wled/WLED PR: 4923
File: wled00/FX.cpp:4883-4901
Timestamp: 2025-09-12T17:29:43.826Z
Learning: In WLED’s web UI, only one slider value (e.g., SEGMENT.intensity or SEGMENT.custom1) changes at a time; code relying on this may use simplified change guards, though presets/JSON can still update multiple fields atomically.
Applied to files:
wled00/presets.cpp
📚 Learning: 2025-11-14T13:37:30.955Z
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2025-11-14T13:37:30.955Z
Learning: In WLED code reviews, when code is modified or added, look for "magic numbers" (hardcoded numeric literals) and suggest replacing them with defined constants when meaningful constants exist in the codebase. For example, suggest replacing hardcoded "32" with WLED_MAX_SEGNAME_LEN if the context relates to segment name length limits.
Applied to files:
wled00/const.hwled00/wled_server.cppwled00/util.cppwled00/FX_2Dfcn.cppwled00/wled_serial.cpp
📚 Learning: 2025-10-05T15:24:05.545Z
Learnt from: CR
Repo: wled/WLED PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-05T15:24:05.545Z
Learning: Applies to wled00/html_*.h : DO NOT edit generated embedded web header files (wled00/html_*.h)
Applied to files:
wled00/const.hwled00/util.cppwled00/FX_2Dfcn.cpp
📚 Learning: 2025-08-29T00:26:15.808Z
Learnt from: ksedgwic
Repo: wled/WLED PR: 4883
File: usermods/usermod_v2_skystrip/rest_json_client.h:6-14
Timestamp: 2025-08-29T00:26:15.808Z
Learning: In WLED projects, ArduinoJson.h is not directly included via #include <ArduinoJson.h> - the ArduinoJson symbols are made available through the WLED build system and wled.h transitive includes, so explicitly adding #include <ArduinoJson.h> is not necessary and may not work.
Applied to files:
wled00/const.hwled00/wled_server.cppwled00/wled_serial.cpp
📚 Learning: 2025-08-28T08:09:20.630Z
Learnt from: mval-sg
Repo: wled/WLED PR: 4876
File: wled00/xml.cpp:0-0
Timestamp: 2025-08-28T08:09:20.630Z
Learning: The WLED codebase has opportunities for refactoring hardcoded array bounds (like the "15" used for DMX channels) to use sizeof(array)/sizeof(array[0]) for more maintainable code, but such changes should be done consistently across the entire codebase in a dedicated refactoring effort.
Applied to files:
wled00/wled_serial.cpp
🧬 Code graph analysis (13)
wled00/fcn_declare.h (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/mqtt.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/udp.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/FX_fcn.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/ir.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/json.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/wled_server.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/cfg.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/ws.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/set.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
usermods/usermod_v2_RF433/usermod_v2_RF433.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/FX_2Dfcn.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
wled00/wled_serial.cpp (1)
wled00/util.cpp (2)
requestJSONBufferLock(167-202)requestJSONBufferLock(167-167)
🔇 Additional comments (14)
wled00/FX_fcn.cpp (1)
1968-2057: LED map JSON lock constant usage is correct and balancedSwitching to
JSON_LOCK_LEDMAPhere is consistent with the new lock IDs, and the acquire/release paths indeserializeMap()remain balanced (explicit release on error and before the final return).wled00/ir.cpp (1)
554-631: IR JSON handler correctly uses JSON_LOCK_IRUsing
JSON_LOCK_IRinstead of the numeric ID improves traceability of who owns the JSON buffer, anddecodeIRJson()still releases the lock on all paths after acquisition.wled00/FX_2Dfcn.cpp (1)
51-98: Gap map JSON lock now uses JSON_LOCK_LEDGAP as intendedThe change to
JSON_LOCK_LEDGAPmatches the new naming scheme, and the lock is still properly released after reading/2d-gaps.json, so behavior is preserved.wled00/json.cpp (1)
1111-1192: serveJson uses JSON_LOCK_SERVEJSON consistently with RAII unlockSwapping the literal lock ID for
JSON_LOCK_SERVEJSONkeeps the existing semantics: the lock is acquired once for the request and then released byLockedJsonResponseafter the JSON payload has been sent (or on destruction), with the failure case still handled viadeferResponse().usermods/usermod_v2_RF433/usermod_v2_RF433.cpp (1)
121-175: RF433 remote JSON now uses JSON_LOCK_REMOTE with balanced lockingUsing
JSON_LOCK_REMOTEinstead of the raw numeric ID cleanly identifies this usermod as the JSON buffer owner, andremoteJson433()still releases the lock in both the “no mapping found” path and the success path.wled00/wled_server.cpp (1)
394-449: /json POST handler correctly switches to JSON_LOCK_SERVERReplacing the numeric module ID with
JSON_LOCK_SERVERkeeps the JSON lock acquisition and release behavior intact in the/jsonPOST handler and makes logging/diagnostics around JSON buffer ownership clearer.wled00/util.cpp (1)
542-587: Consistent use of JSON_LOCK_LEDMAP_ENUM for ledmap enumerationSwitching to
JSON_LOCK_LEDMAP_ENUMkeeps behavior identical while making the caller identity clearer in lock debugging; acquire/release pattern aroundreadObjectFromFileremains correct.wled00/wled_serial.cpp (1)
103-126: Serial JSON path correctly tagged with JSON_LOCK_SERIALUsing
JSON_LOCK_SERIALhere cleanly documents that this lock user is the serial JSON API; control flow on failure and the lock release path are unchanged and correct.wled00/mqtt.cpp (1)
112-126: MQTT /api handler now clearly identified via JSON_LOCK_MQTTReplacing the magic lock ID with
JSON_LOCK_MQTTkeeps the acquisition/release logic intact and makes log output and ownership tracking for MQTT JSON handling clearer.wled00/ws.cpp (1)
44-77: WebSocket RX/TX paths correctly distinguished with JSON_LOCK_WS_RECEIVE / JSON_LOCK_WS_SENDUsing distinct lock IDs for receive (
JSON_LOCK_WS_RECEIVE) and send (JSON_LOCK_WS_SEND) keeps the existing behavior, avoids nested locking (RX is released before TX is acquired), and improves traceability in debug output.Also applies to: 139-186
wled00/set.cpp (1)
651-787: Usermod settings now use JSON_LOCK_SETTINGS for JSON buffer accessThe USERMODS form handler correctly tags its JSON buffer usage with
JSON_LOCK_SETTINGS, preserving the existing defer/return-on-failure behavior and ensuring the lock is released afterUsermodManager::readFromConfig.wled00/udp.cpp (1)
649-660: UDP API path correctly labeled with JSON_LOCK_NOTIFYSwitching the UDP API section to
JSON_LOCK_NOTIFYkeeps the lock scope and behavior the same while tying this use of the JSON buffer clearly to the notification/UDP handler.wled00/cfg.cpp (1)
790-806: Config and secure-config flows correctly separated with JSON_LOCK_CFG_ constants*Using
JSON_LOCK_CFG_DES/CFG_SERfor main config andJSON_LOCK_CFG_SEC_DES/CFG_SEC_SERfor the secure config cleanly documents which path owns the JSON buffer at each point. Each function still acquires at most one lock at a time and reliably callsreleaseJSONBufferLock()on all paths.Also applies to: 808-826, 1255-1307, 1310-1351
wled00/presets.cpp (1)
29-85: Preset save/load/name paths now use dedicated JSON_LOCK_PRESET_ IDs*The preset code now clearly distinguishes save (
JSON_LOCK_PRESET_SAVE), name lookup (JSON_LOCK_PRESET_NAME), and load (JSON_LOCK_PRESET_LOAD) as separate JSON buffer users. Lock acquisition, error handling, and release behavior remain the same, so this is a pure readability/diagnostics improvement.Also applies to: 87-100, 145-215
these changes somehow did not get commited previously
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.