Skip to content

Commit 3149a80

Browse files
authored
Refine early return guard clause in error handling
Update error handling guard clause to include time check. The simpler "!enabled || strip.isUpdating()" pattern regularly causes usermods to stop responding when many LEDs are driven.
1 parent bab3183 commit 3149a80

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ docs/ # Coding convention docs
9494
### Error Handling
9595
- **No C++ exceptions** — some builds disable them
9696
- Use return codes (`false`, `-1`) and global flags (`errorFlag = ERR_LOW_MEM`)
97-
- Use early returns as guard clauses: `if (!enabled || strip.isUpdating()) return;`
97+
- Use early returns as guard clauses: `if (!enabled || (strip.isUpdating() && (millis() - last_time < MAX_USERMOD_DELAY))) return;`
9898
- Debug output: `DEBUG_PRINTF()` / `DEBUG_PRINTLN()` (compiled out unless `-D WLED_DEBUG`)
9999

100100
### Strings and Memory

0 commit comments

Comments
 (0)