From bf8a8c621e04b07f589b0091c90d94bf52523d0b Mon Sep 17 00:00:00 2001 From: kruzer Date: Mon, 1 Nov 2021 12:31:08 +0100 Subject: [PATCH] added config variable StepPixels --- tasmota/i18n.h | 1 + tasmota/settings.h | 3 ++- tasmota/xlgt_01_ws2812.ino | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 9c8aed881..73d8ade89 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -477,6 +477,7 @@ #define D_CMND_FADE "Fade" #define D_CMND_PALETTE "Palette" #define D_CMND_PIXELS "Pixels" +#define D_CMND_STEPPIXELS "StepPixels" #define D_CMND_RGBWWTABLE "RGBWWTable" #define D_CMND_ROTATION "Rotation" #define D_CMND_SCHEME "Scheme" diff --git a/tasmota/settings.h b/tasmota/settings.h index 4e41c5916..8c903d6a4 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -733,8 +733,9 @@ typedef struct { uint8_t shd_leading_edge; // F5B uint16_t shd_warmup_brightness; // F5C uint8_t shd_warmup_time; // F5E + uint8_t light_step_pixels; // F5F - uint8_t free_f5f[61]; // F5F - Decrement if adding new Setting variables just above and below + uint8_t free_f5f[60]; // F60 - Decrement if adding new Setting variables just above and below // Only 32 bit boundary variables below diff --git a/tasmota/xlgt_01_ws2812.ino b/tasmota/xlgt_01_ws2812.ino index a7e7c9927..89e8dc66c 100644 --- a/tasmota/xlgt_01_ws2812.ino +++ b/tasmota/xlgt_01_ws2812.ino @@ -40,10 +40,10 @@ const uint8_t WS2812_SCHEMES = 8; // Number of WS2812 schemes const char kWs2812Commands[] PROGMEM = "|" // No prefix - D_CMND_LED "|" D_CMND_PIXELS "|" D_CMND_ROTATION "|" D_CMND_WIDTH ; + D_CMND_LED "|" D_CMND_PIXELS "|" D_CMND_ROTATION "|" D_CMND_WIDTH "|" D_CMND_STEPPIXELS ; void (* const Ws2812Command[])(void) PROGMEM = { - &CmndLed, &CmndPixels, &CmndRotation, &CmndWidth }; + &CmndLed, &CmndPixels, &CmndRotation, &CmndWidth, &CmndStepPixels }; #include @@ -568,6 +568,17 @@ void CmndPixels(void) ResponseCmndNumber(Settings->light_pixels); } +void CmndStepPixels(void) +{ + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= WS2812_MAX_LEDS)) { + Settings->light_step_pixels = XdrvMailbox.payload; + Ws2812Clear(); + Light.update = true; + } + ResponseCmndNumber(Settings->light_step_pixels); +} + + void CmndRotation(void) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < Settings->light_pixels)) {