Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.04k stars 3.25k forks source link

Sorry, pins [X, X, X ...] can't be used. #4208

Closed Jo5cha closed 1 month ago

Jo5cha commented 1 month ago

What happened?

Bug: I made a personal usermod with 0.14. and everything worked fine but then changed WLED to 0.15.0-b6 and suddenly one rotary encoder was not working anymore and if I tried to change some LED Pins in the WLED UI I've got the above Error-Message: "Sorry, Pins [5, 7, 8, 9, 10, 11, 24, 28, 29, 30, 31, 32, 15, 14] can't be used."

Solution/Workaround: It took me resoldering of 7 wires and destroying one rotary encoder to realize that (at least part of) the issue lies in the Audireactive Usermod which is now implemented from the start. The usermod has a microphone setting where 4-5 wires are pre defined and thus blocking pins which have formerly been used by my usermod. Changing these pins manually back to not assigned got rid of the problem.

Its actually quite an easy fix in the end but took me long time to figure out to look in the audioreactive settings. And hopefully will help others who are having the same issue.

Fix: Audioreactive Pins should be set to "not assigned" (or what the wording is here) by default. Thank you.

To Reproduce Bug

Installing the new beta and importing usermods and settings from a previous Version.

Expected Behavior

Audioreactive Usermod should have Pins assigned to -1 / not assigned

Install Method

Self-Compiled

What version of WLED?

0.15.0-b6

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

softhack007 commented 1 month ago

Thanks for pointing out this topic!

The usermod has a microphone setting where 4-5 wires are pre defined and thus blocking pins

(small correction - audioreactive allocates 3 wires/pins if you don't modify the defaults)

Its a general design policy for WLED - all PINs are allocated at startup. This is true for any usermod, and also true for relay, IR, buttons, and I2C pins. We might need to rethink this (0.16 ?), and only run the "setup()" when a usermod is enabled. However this requires a redesign of the usermodManager component.

Fix: Audioreactive Pins should be set to "not assigned" (or what the wording is here) by default. Thank you.

Edit: setting PIN defaults to "not assigned" is not a good solution, because many users who want to connect an I2S mic would be asking lots of support questions if we would not provide recommended defaults.

Jo5cha commented 1 month ago

You got actually a very valid point. Thanks for the reply. It's also a really easy fix if you know where to look. So maybe just keep it like that and have this post as hint for people encountering the same issue. ;)