Repository navigation
Description
What happened?
When activating the Rotary Encoder usermod on ESP32-C3 (SuperMini), the device immediately crashes with a "Load access fault" (Guru Meditation Error) and enters a boot loop.
The crash occurs even when:
No hardware is connected
All GPIO pins in the usermod config are set to "unused"
Simply enabling the usermod in the web interface triggers the crash
To Reproduce Bug
Hardware: ESP32-C3 SuperMini
WLED Version: 0.15.0-b3
Build Method: Web-based compiler (https://wled-install.github.io/)
Selected Build: ESP32-C3 (4MB Flash, M: Audioreactive, Usermods incl: Temp, AutoSave, 4-L Display, Rotary encoder)
Steps:
Flash WLED build with Rotary Encoder usermod to ESP32-C3
Complete initial setup (WiFi, etc.)
Navigate to Config → LED Preferences → Usermod settings
Set all Rotary Encoder pins to "unused"
Enable the Rotary Encoder usermod
Device immediately crashes and reboots
Expected Behavior
The usermod should initialize without crashing, even with all pins set to unused.
Serial Output
Install Method
Self-Compiled
What version of WLED?
WLED Version: 0.15.0-b3
Which microcontroller/board are you seeing the problem on?
ESP32-C3
Relevant log/trace output
[01:55:06]Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.
[01:55:06]
[01:55:06]Core 0 register dump:
[01:55:06]MEPC : 0x4206662a RA : 0x42066880 SP : 0x3fca4d50 GP : 0x3fc8d000
[01:55:06]TP : 0x3fc7c834 T0 : 0x42066628 T1 : 0x40389620 T2 : 0xffffffff
[01:55:06]S0/FP : 0x00000000 S1 : 0x00000000 A0 : 0x00000000 A1 : 0x00000000
[01:55:06]A2 : 0x00000000 A3 : 0x000040d2 A4 : 0x000040d2 A5 : 0x25000000
[01:55:06]A6 : 0xfa000000 A7 : 0x00000003 S2 : 0x3fc9d880 S3 : 0x00000000
[01:55:06]S4 : 0x00000000 S5 : 0x00000000 S6 : 0x00000000 S7 : 0x00000000
[01:55:06]S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000
[01:55:06]T3 : 0x00000006 T4 : 0x00000000 T5 : 0x00000030 T6 : 0x00000000
[01:55:06]MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0x00000010
[01:55:06]MHARTID : 0x00000000
[01:55:06]
[01:55:06]Rebooting...Anything else?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
coderabbitai commentedon Dec 17, 2025
📝 CodeRabbit Plan Mode
Generate an implementation plan and prompts that you can use with your favorite coding agent.
Examples
🔗 Similar Issues
Related Issues
👤 Suggested Assignees
🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord or schedule a call!
DedeHai commentedon Dec 17, 2025
I looked at this before, IIRC the workaround was to add a custom palette before enabling it.
DedeHai commentedon Dec 17, 2025
It's an off-by-one error, overrunning an array. I will check if I can fix it.
lnx1-1 commentedon Dec 17, 2025
I tried to set a custom color palette. But it just crashed again when I enabled the mod:
DedeHai commentedon Dec 17, 2025
I can get it to run without crashing, I just need to check on how to properly fix it. If you want to try: change this line
WLED/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.cpp
Line 404 in dd3edf1
to
palettes_qstrings = re_findModeStrings(JSON_palette_names, getPaletteCount()+1);DedeHai commentedon Dec 17, 2025
I fixed this line in main, please try it once it is available in nightly build tomorrow.
softhack007 commentedon Dec 17, 2025
@DedeHai I am not sure that your fix in 624763c is correct 🤔
This is very old code, that was written before custom palettes were added. I've tried to understand the old stuff (with some AI help), and i think the correct fix would be to exclude custom palettes in the call
palettes_qstrings = re_findModeStrings(JSON_palette_names, getPaletteCount() - customPalettes.size() + 1);AI analysis (might be wrong, but looks sound to me)
Edit: the
- customPalettes.size()part seems "optional" to me. numModes is only used to allocate an array, then the loop runs over JSON_palette_names. So it should not matter much if extra entries for custom palettes are added, because these will not considered in re_findModeStrings().However the code in
re_findModeStrings()should be improved to check array bounds before writing into themodeStringsarrays.DedeHai commentedon Dec 18, 2025
I did track it down with serial prints, that one-off was definitely wrong. I am wondering if this was ever correct and why we only see this issue now.
I agree there should be bound-checks, there are other places that don't do any checks so the whole usermod is fragile.
softhack007 commentedon Dec 18, 2025
@DedeHai true, I can remember that the rotary usermod -especially the effects and palettes sorting part - was always kind of fragile, but we never had the time to really understand the root cause.
I've looked into "my" codebase in WLED-MM - 1-2 years behind upstream - and found no off-by-one problem there. It looks like
getPaletteCount()was changed at some time to "skip" slot 0 for the default palette.We might actually have a bigger problem here... older features - like irremote, Alexa, and a bunch of usermods - might still assume the previous behaviour of getPaletteCount(), leading to possibly more off-by-one problems in these features.
Lessons learned: never change a public API - better to rename the function if it does not behave like before...
blazoncek commentedon Dec 20, 2025
@softhack007 is correct, FIXED_PALETTE_COUNT is off by one but that is not all.
Quicksort will also wreck havoc in there.
See: blazoncek@167cb06
I is interesting to note that original code will not crash on ESP32.
Fix for #5201
Palettes fix (#5263)
Palettes fix (wled#5263)