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
14.74k stars 3.17k forks source link

Hardware profiles for pin assignment #1913

Closed tbnobody closed 2 years ago

tbnobody commented 3 years ago

Currently every user has to adjust each pin assignment by their own and for their specific hardware. If WLED is running on commercial or self designed PCB's it would be be nice to have profiles (e.g. in json format) to specify all the different hardware pins (IR/Ethernet/Data/Clk etc.) and just choose the specific profile within the webinterface to assign all the correct pins.

blazoncek commented 3 years ago

This can be achieved by HW vendor by pre-compiling with certain defaults set and providing a binary for users. All supported HW devices (button, IR, relay, LED pins) are available to be configured in this way.

CWempe commented 3 years ago

I think this is a good idea.

For example when you use the WLED-wemos-shield. Or any other hardware that has a wither "market share".

Tasmota solved this with templates. You can either select a template from a long list of a drop-down menu in the web interface. Or you can import/export a custom template (JSON format)and share this with others or reuse this for your similar projects.

blazoncek commented 3 years ago

It is possible to copy cfg.json from one device to the other which would give you a similar experience. Just reboot after uploading (and possibly change device name if you need).

henrygab commented 3 years ago

This is a GREAT idea.

Different problem than PinManager class solves...

The [`PinManager`](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/pin_manager.cpp#L13) class is intended to prevent use one pin for multiple purposes (or both input and output, or an input-only pin for output, ...). Two downsides: 1. Every PR that uses pins needs to know about and properly use this class. This fails over time, causing [really hard-to-diagnose problems](https://github.com/Aircoookie/WLED/issues/1027#issuecomment-723481641). 2. `PinManager` doesn't provide a method to define board / product specific availability of pins 3. `PinManager` doesn't provide an **_extensible_** method to determine (in code) how many of a given functional thing exists Here's a small list of potential pin uses ... | Max Pins | UseType | Use `PinManager` | |------|------|------| | 1 | IR | [Yes](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/cfg.cpp#L170-L174) | 1 | Relay | [Yes](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/cfg.cpp#L181-L186) | | 4 | Button | [Yes](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/cfg.cpp#L134-L139) | | 4 | Ethernet | **_No(!)_**, see [1](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/cfg.cpp#L56-L59), and [2](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/wled.cpp#L439-L447) | | 10 | Clockless LED | Only when creating [`Bus`](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/bus_manager.h#L114-L115) | | many | PWM | Only when creating [`Bus`](https://github.com/Aircoookie/WLED/blob/8c44147a4596112a7f5d5720ae809949399e9d44/wled00/bus_manager.h#L233-L234) |

Having Tasmota-style templates would be a huge win:

This idea definitely gets my vote!

blazoncek commented 2 years ago

FYI in the works. 😄

blazoncek commented 2 years ago

Implemented in 0.13 as a possibility to apply cfg.json to LED settings page.