Skip to content

Commit c80c9bd

Browse files
Update usermods/rgb-rotary-encoder/rgb-rotary-encoder.cpp
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 3dc45b8 commit c80c9bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

usermods/rgb-rotary-encoder/rgb-rotary-encoder.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ class RgbRotaryEncoderUsermod : public Usermod
5454

5555
void initLedBus()
5656
{
57-
byte _pins[OUTPUT_MAX_PINS] = {(byte)ledIo, 255, 255, 255, 255};
57+
// Initialize all pins to the sentinel value first…
58+
byte _pins[OUTPUT_MAX_PINS];
59+
std::fill(std::begin(_pins), std::end(_pins), 255);
60+
// …then set only the LED pin
61+
_pins[0] = static_cast<byte>(ledIo);
5862
BusConfig busCfg = BusConfig(TYPE_WS2812_RGB, _pins, 0, numLeds, COL_ORDER_GRB, false, 0);
5963

6064
ledBus = new BusDigital(busCfg, WLED_MAX_BUSSES - 1);

0 commit comments

Comments
 (0)