Skip to content

Commit b7c863a

Browse files
Copilotsofthack007
andauthored
Add clarifying comments per code review feedback
Agent-Logs-Url: https://github.com/wled/WLED/sessions/88471964-aa31-4148-9f41-fa2fbdc8da34 Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
1 parent 5497f7e commit b7c863a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

wled00/json.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,8 +1228,10 @@ void respondModeData(AsyncWebServerRequest* request, bool namesOnly = false) {
12281228
strncpy_P(lineBuffer, strip.getModeData(fx_index), sizeof(lineBuffer)-1); // Copy to stack buffer for strchr
12291229
if (lineBuffer[0] != 0) {
12301230
lineBuffer[sizeof(lineBuffer)-1] = '\0'; // terminate string (only needed if strncpy filled the buffer)
1231-
char* dataPtr = strchr(lineBuffer,'@'); // Find '@', if there is one
1231+
char* dataPtr = strchr(lineBuffer,'@'); // Find '@', if there is one; non-const to allow truncation
12321232
const char* value;
1233+
// namesOnly=true → emit the display name (everything before '@')
1234+
// namesOnly=false → emit the fx-data string (everything after '@')
12331235
if (namesOnly) {
12341236
if (dataPtr) *dataPtr = '\0'; // truncate at '@' to get name only
12351237
value = lineBuffer;

0 commit comments

Comments
 (0)