From 24520bfcfa246380814399289c3aacb7091d386f Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Sat, 5 Aug 2017 20:11:20 +0200 Subject: [PATCH] v5.5.1a 5.5.1a * Extent max number of WS2812 pixels from 256 to 512 (#667) --- README.md | 2 +- sonoff/_releasenotes.ino | 5 ++++- sonoff/sonoff.ino | 4 ++-- sonoff/xdrv_ws2812.ino | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index cfa2dca4d..77f5bcc13 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Sonoff-Tasmota Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. -Current version is **5.5.1** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information. +Current version is **5.5.1a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 99fe095fb..fc5ecc00b 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,7 @@ -/* 5.5.1 20170805 +/* 5.5.1a + * Extent max number of WS2812 pixels from 256 to 512 (#667) + * + * 5.5.1 20170805 * Fix Sonoff Rf Bridge issues * Add Sonoff RF Bridge MQTT messages on received and learned RF signal * Add command VoltRes 0|1 to select voltage resolution to 0.1 V (#654) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index d1b211f2d..e7f0adc99 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x05050100 // 5.5.1 +#define VERSION 0x05050101 // 5.5.1a enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; enum week_t {Last, First, Second, Third, Fourth}; @@ -119,7 +119,7 @@ enum emul_t {EMUL_NONE, EMUL_WEMO, EMUL_HUE, EMUL_MAX}; #define APP_POWER 0 // Default saved power state Off #define MAX_COUNTERS 4 // Max number of counter sensors #define MAX_PULSETIMERS 4 // Max number of supported pulse timers -#define WS2812_MAX_LEDS 256 // Max number of LEDs +#define WS2812_MAX_LEDS 512 // Max number of LEDs #define PWM_RANGE 1023 // 255..1023 needs to be devisible by 256 //#define PWM_FREQ 1000 // 100..1000 Hz led refresh diff --git a/sonoff/xdrv_ws2812.ino b/sonoff/xdrv_ws2812.ino index 9b3d7f898..93a6e5fe4 100644 --- a/sonoff/xdrv_ws2812.ino +++ b/sonoff/xdrv_ws2812.ino @@ -259,18 +259,18 @@ void ws2812_clock() ws2812_stripShow(); } -void ws2812_gradientColor(struct wsColor* mColor, uint8_t range, uint8_t gradRange, uint8_t i) +void ws2812_gradientColor(struct wsColor* mColor, uint16_t range, uint16_t gradRange, uint16_t i) { /* * Compute the color of a pixel at position i using a gradient of the color scheme. * This function is used internally by the gradient function. */ ColorScheme scheme = schemes[sysCfg.ws_scheme -3]; - uint8_t curRange = i / range; - uint8_t rangeIndex = i % range; - uint8_t colorIndex = rangeIndex / gradRange; - uint8_t start = colorIndex; - uint8_t end = colorIndex +1; + uint16_t curRange = i / range; + uint16_t rangeIndex = i % range; + uint16_t colorIndex = rangeIndex / gradRange; + uint16_t start = colorIndex; + uint16_t end = colorIndex +1; if (curRange % 2 != 0) { start = (scheme.count -1) - start; end = (scheme.count -1) - end; @@ -299,9 +299,9 @@ void ws2812_gradient() } uint8_t repeat = repeatValues[sysCfg.ws_width]; // number of scheme.count per ledcount - uint8_t range = (uint8_t)ceil((float)sysCfg.ws_pixels / (float)repeat); - uint8_t gradRange = (uint8_t)ceil((float)range / (float)(scheme.count - 1)); - uint8_t offset = speedValues[sysCfg.ws_speed] > 0 ? stripTimerCntr / speedValues[sysCfg.ws_speed] : 0; + uint16_t range = (uint16_t)ceil((float)sysCfg.ws_pixels / (float)repeat); + uint16_t gradRange = (uint16_t)ceil((float)range / (float)(scheme.count - 1)); + uint16_t offset = speedValues[sysCfg.ws_speed] > 0 ? stripTimerCntr / speedValues[sysCfg.ws_speed] : 0; wsColor oldColor, currentColor; ws2812_gradientColor(&oldColor, range, gradRange, offset); @@ -340,7 +340,7 @@ void ws2812_bars() ColorScheme scheme = schemes[sysCfg.ws_scheme -3]; - uint8_t maxSize = sysCfg.ws_pixels / scheme.count; + uint16_t maxSize = sysCfg.ws_pixels / scheme.count; if (widthValues[sysCfg.ws_width] > maxSize) { maxSize = 0; }