diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 45cc45518..4824ab3de 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,6 +1,7 @@ /* 5.10.0f * Differentiate between JSON text defines and other text defines to allow for English JSON while using different locale (#1449) * Fix display of build date and time in non-english locale (#1465) + * Add define for additional number of WS2812 schemes (#1463) * * 5.10.0e * Add Italian language file (#1449) diff --git a/sonoff/xdrv_light.ino b/sonoff/xdrv_light.ino index d98c90a3c..a3a554890 100644 --- a/sonoff/xdrv_light.ino +++ b/sonoff/xdrv_light.ino @@ -51,6 +51,8 @@ * \*********************************************************************************************/ +#define WS2812_SCHEMES 7 // Number of additional WS2812 schemes supported by xdrv_ws2812.ino + enum LightCommands { CMND_COLOR, CMND_COLORTEMPERATURE, CMND_DIMMER, CMND_LED, CMND_LEDTABLE, CMND_FADE, CMND_PIXELS, CMND_SCHEME, CMND_SPEED, CMND_WAKEUP, CMND_WAKEUPDURATION, CMND_WIDTH, CMND_UNDOCA }; @@ -377,7 +379,7 @@ void LightInit(void) light_subtype++; // from RGB to RGBW #endif Ws2812Init(); - max_scheme = LS_MAX +7; + max_scheme = LS_MAX + WS2812_SCHEMES; } #endif // USE_WS2812 ************************************************************************ else { @@ -1069,7 +1071,7 @@ boolean LightCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_le } #endif // USE_WS2812 ************************************************************************ else if ((CMND_SCHEME == command_code) && (light_subtype >= LST_RGB)) { - uint8_t max_scheme = (LT_WS2812 == light_type) ? LS_MAX +7 : LS_MAX -1; + uint8_t max_scheme = (LT_WS2812 == light_type) ? LS_MAX + WS2812_SCHEMES : LS_MAX -1; if (('+' == option) && (Settings.light_scheme < max_scheme)) { payload = Settings.light_scheme + ((0 == Settings.light_scheme) ? 2 : 1); // Skip wakeup } diff --git a/sonoff/xdrv_ws2812.ino b/sonoff/xdrv_ws2812.ino index 2aea22054..9f76c9b9c 100644 --- a/sonoff/xdrv_ws2812.ino +++ b/sonoff/xdrv_ws2812.ino @@ -62,7 +62,7 @@ WsColor kHanukkah[2] = { 0,0,255, 255,255,255 }; WsColor kwanzaa[3] = { 255,0,0, 0,0,0, 0,255,0 }; WsColor kRainbow[7] = { 255,0,0, 255,128,0, 255,255,0, 0,255,0, 0,0,255, 128,0,255, 255,0,255 }; WsColor kFire[3] = { 255,0,0, 255,102,0, 255,192,0 }; -ColorScheme kSchemes[7] = { +ColorScheme kSchemes[WS2812_SCHEMES] = { kIncandescent, 2, kRgb, 3, kChristmas, 2,