From b7aba15d5836dba1d7e3cc58d1a7493a45d4b31b Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sun, 22 Sep 2024 15:27:23 +0100 Subject: [PATCH] Always copy all the pin data --- usermods/rgb-rotary-encoder/rgb-rotary-encoder.h | 2 +- wled00/bus_manager.h | 2 +- wled00/cfg.cpp | 2 +- wled00/set.cpp | 2 +- wled00/wled_eeprom.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/usermods/rgb-rotary-encoder/rgb-rotary-encoder.h b/usermods/rgb-rotary-encoder/rgb-rotary-encoder.h index 00fc2272..b06037f5 100644 --- a/usermods/rgb-rotary-encoder/rgb-rotary-encoder.h +++ b/usermods/rgb-rotary-encoder/rgb-rotary-encoder.h @@ -56,7 +56,7 @@ class RgbRotaryEncoderUsermod : public Usermod void initLedBus() { - byte _pins[5] = {(byte)ledIo, 255, 255, 255, 255}; + byte _pins[OUTPUT_MAX_PINS] = {(byte)ledIo, 255, 255, 255, 255}; BusConfig busCfg = BusConfig(TYPE_WS2812_RGB, _pins, 0, numLeds, COL_ORDER_GRB, false, 0); ledBus = new BusDigital(busCfg, WLED_MAX_BUSSES - 1); diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 98408af3..dc54b27b 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -391,7 +391,7 @@ struct BusConfig { { refreshReq = (bool) GET_BIT(busType,7); type = busType & 0x7F; // bit 7 may be/is hacked to include refresh info (1=refresh in off state, 0=no refresh) - size_t nPins = Bus::getNumberOfPins(type); + size_t nPins = OUTPUT_MAX_PINS; for (size_t i = 0; i < nPins; i++) pins[i] = ppins[i]; } diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 3f6cfbac..e043c343 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -193,7 +193,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { for (JsonObject elm : ins) { if (s >= WLED_MAX_BUSSES+WLED_MIN_VIRTUAL_BUSSES) break; - uint8_t pins[5] = {255, 255, 255, 255, 255}; + uint8_t pins[OUTPUT_MAX_PINS] = {255, 255, 255, 255, 255}; JsonArray pinArr = elm["pin"]; if (pinArr.size() == 0) continue; //pins[0] = pinArr[0]; diff --git a/wled00/set.cpp b/wled00/set.cpp index 96eb3ed1..47bb6482 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -125,7 +125,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) unsigned colorOrder, type, skip, awmode, channelSwap, maPerLed; unsigned length, start, maMax; - uint8_t pins[5] = {255, 255, 255, 255, 255}; + uint8_t pins[OUTPUT_MAX_PINS] = {255, 255, 255, 255, 255}; unsigned ablMilliampsMax = request->arg(F("MA")).toInt(); BusManager::setMilliampsMax(ablMilliampsMax); diff --git a/wled00/wled_eeprom.cpp b/wled00/wled_eeprom.cpp index 4f2c14d4..57d82f7e 100755 --- a/wled00/wled_eeprom.cpp +++ b/wled00/wled_eeprom.cpp @@ -92,7 +92,7 @@ void loadSettingsFromEEPROM() if (apHide > 1) apHide = 1; uint16_t length = EEPROM.read(229) + ((EEPROM.read(398) << 8) & 0xFF00); //was ledCount if (length > MAX_LEDS || length == 0) length = 30; - uint8_t pins[5] = {2, 255, 255, 255, 255}; + uint8_t pins[OUTPUT_MAX_PINS] = {2, 255, 255, 255, 255}; uint8_t colorOrder = COL_ORDER_GRB; if (lastEEPROMversion > 9) colorOrder = EEPROM.read(383); if (colorOrder > COL_ORDER_GBR) colorOrder = COL_ORDER_GRB;