diff --git a/sonoff/xplg_ws2812.ino b/sonoff/xplg_ws2812.ino index 5fdc68f82..d230b5a94 100644 --- a/sonoff/xplg_ws2812.ino +++ b/sonoff/xplg_ws2812.ino @@ -24,35 +24,27 @@ #include +#if (USE_WS2812_CTYPE == NEO_GRB) + typedef NeoGrbFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_BRG) + typedef NeoBrgFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_RBG) + typedef NeoRbgFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_RGBW) + typedef NeoRgbwFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_GRBW) + typedef NeoGrbwFeature selectedNeoFeatureType; +#else // USE_WS2812_CTYPE + typedef NeoRgbFeature selectedNeoFeatureType; +#endif // USE_WS2812_CTYPE + + #ifdef USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_BRG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RBG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RGBW) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_GRBW) - NeoPixelBus *strip = NULL; -#else // USE_WS2812_CTYPE - NeoPixelBus *strip = NULL; -#endif // USE_WS2812_CTYPE + typedef Neo800KbpsMethod selectedNeoSpeedType; #else // USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_BRG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RBG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RGBW) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_GRBW) - NeoPixelBus *strip = NULL; -#else // USE_WS2812_CTYPE - NeoPixelBus *strip = NULL; -#endif // USE_WS2812_CTYPE + typedef NeoEsp8266BitBang800KbpsMethod selectedNeoSpeedType; #endif // USE_WS2812_DMA + NeoPixelBus *strip = NULL; struct WsColor { uint8_t red, green, blue; @@ -305,33 +297,9 @@ void Ws2812Bars(uint8_t schemenr) void Ws2812Init(void) { #ifdef USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_BRG) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_RBG) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_RGBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_GRBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#else // USE_WS2812_CTYPE - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#endif // USE_WS2812_CTYPE + strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. #else // USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_BRG) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_RBG) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_RGBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_GRBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#else // USE_WS2812_CTYPE - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#endif // USE_WS2812_CTYPE + strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); #endif // USE_WS2812_DMA strip->Begin(); Ws2812Clear();