Adding multiple compile time pins.

This commit is contained in:
Blaz Kristan 2021-03-12 23:56:29 +01:00
parent f91384596c
commit caae57d960
3 changed files with 22 additions and 3 deletions

View File

@ -53,11 +53,26 @@ void WS2812FX::finalizeInit(void)
RESET_RUNTIME;
_useRgbw = false;
//if busses failed to load, add default (FS issue...)
//if busses failed to load, add default (fresh install, FS issue, ...)
if (busses.getNumBusses() == 0) {
uint8_t defPin[] = {LEDPIN};
BusConfig defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#ifdef LEDPIN1
defPin[0] = {LEDPIN1};
defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#endif
#ifdef LEDPIN2
defPin[0] = {LEDPIN2};
defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#endif
#ifdef LEDPIN3
defPin[0] = {LEDPIN3};
defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#endif
}
deserializeMap();

View File

@ -242,7 +242,11 @@
//this is merely a default now and can be changed at runtime
#ifndef LEDPIN
#define LEDPIN 2
#ifdef ESP8266
#define LEDPIN 2 // GPIO2 (D4) on Wemod D1 mini compatible boards
#else
#define LEDPIN 16 // alligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards
#endif
#endif
#endif

View File

@ -423,8 +423,8 @@ void serializeInfo(JsonObject root)
leds[F("count")] = ledCount;
leds[F("rgbw")] = useRGBW;
leds[F("wv")] = useRGBW && (strip.rgbwMode == RGBW_MODE_MANUAL_ONLY || strip.rgbwMode == RGBW_MODE_DUAL); //should a white channel slider be displayed?
JsonArray leds_pin = leds.createNestedArray("pin");
//leds_pin.add(LEDPIN);
for (uint8_t s=0; s<busses.getNumBusses(); s++) {
Bus *bus = busses.getBus(s);
uint8_t pins[5];