Version 0.4p - added Sweep transition

Reverted clearTo-Simplification since it did not work with brightness
Sweep still does not work for brightness changes
Added current binaries
This commit is contained in:
cschwinne 2017-10-28 23:40:06 +02:00
parent 221ebfd8f1
commit 2f7e0ef672
6 changed files with 15 additions and 88 deletions

Binary file not shown.

Binary file not shown.

View File

@ -172,15 +172,10 @@ void WS2812FX::strip_off() {
} }
void WS2812FX::strip_off_respectLock() { void WS2812FX::strip_off_respectLock() {
if (_none_locked)
{
clear();
} else {
for(uint16_t i=0; i < _led_count; i++) { for(uint16_t i=0; i < _led_count; i++) {
if (!_locked[i]) if (!_locked[i])
setPixelColor(i, 0); setPixelColor(i, 0);
} }
}
show(); show();
} }
@ -228,15 +223,10 @@ uint8_t WS2812FX::get_random_wheel_index(uint8_t pos) {
* No blinking. Just plain old static light. * No blinking. Just plain old static light.
*/ */
void WS2812FX::mode_static(void) { void WS2812FX::mode_static(void) {
if (_none_locked)
{
setAllPixelColor(_color);
} else {
for(uint16_t i=0; i < _led_count; i++) { for(uint16_t i=0; i < _led_count; i++) {
if (!_locked[i]) if (!_locked[i])
setPixelColor(i, _color); setPixelColor(i, _color);
} }
}
show(); show();
_mode_delay = 25; _mode_delay = 25;
} }
@ -247,15 +237,10 @@ void WS2812FX::mode_static(void) {
*/ */
void WS2812FX::mode_blink(void) { void WS2812FX::mode_blink(void) {
if(_counter_mode_call % 2 == 1) { if(_counter_mode_call % 2 == 1) {
if (_none_locked)
{
setAllPixelColor(_color);
} else {
for(uint16_t i=0; i < _led_count; i++) { for(uint16_t i=0; i < _led_count; i++) {
if (!_locked[i]) if (!_locked[i])
setPixelColor(i, _color); setPixelColor(i, _color);
} }
}
show(); show();
} else { } else {
strip_off_respectLock(); strip_off_respectLock();
@ -1654,10 +1639,7 @@ void WS2812FX::setRange(int i, int i2, uint32_t col)
void WS2812FX::lock(int i) void WS2812FX::lock(int i)
{ {
if (i >= 0 && i < _led_count) if (i >= 0 && i < _led_count)
{
_locked[i] = true; _locked[i] = true;
_none_locked = false;
}
} }
void WS2812FX::lockRange(int i, int i2) void WS2812FX::lockRange(int i, int i2)
@ -1665,10 +1647,7 @@ void WS2812FX::lockRange(int i, int i2)
for (int x = i; x < i2; x++) for (int x = i; x < i2; x++)
{ {
if (x >= 0 && x < _led_count) if (x >= 0 && x < _led_count)
{
_locked[x] = true; _locked[x] = true;
_none_locked = false;
}
} }
} }
@ -1676,16 +1655,12 @@ void WS2812FX::lockAll()
{ {
for (int x = 0; x < _led_count; x++) for (int x = 0; x < _led_count; x++)
_locked[x] = true; _locked[x] = true;
_none_locked = false;
} }
void WS2812FX::unlock(int i) void WS2812FX::unlock(int i)
{ {
if (i >= 0 && i < _led_count) if (i >= 0 && i < _led_count)
_locked[i] = false; _locked[i] = false;
//lock check
_none_locked = true;
for (int x = 0; x < _led_count; x++) if (_locked[x]) _none_locked = false;
} }
void WS2812FX::unlockRange(int i, int i2) void WS2812FX::unlockRange(int i, int i2)
@ -1695,16 +1670,12 @@ void WS2812FX::unlockRange(int i, int i2)
if (x >= 0 && x < _led_count) if (x >= 0 && x < _led_count)
_locked[x] = false; _locked[x] = false;
} }
//lock check
_none_locked = true;
for (int x = 0; x < _led_count; x++) if (_locked[x]) _none_locked = false;
} }
void WS2812FX::unlockAll() void WS2812FX::unlockAll()
{ {
for (int x = 0; x < _led_count; x++) for (int x = 0; x < _led_count; x++)
_locked[x] = false; _locked[x] = false;
_none_locked = true;
} }
void WS2812FX::setLedCount(uint16_t i) void WS2812FX::setLedCount(uint16_t i)
@ -1773,33 +1744,6 @@ void WS2812FX::clear()
#endif #endif
} }
void WS2812FX::setAllPixelColor(uint32_t c)
{
#ifdef RGBW
NeoPixelBrightnessBus::ClearTo(RgbwColor((c>>16) & 0xFF, (c>>8) & 0xFF, (c) & 0xFF, (c>>24) & 0xFF));
#else
NeoPixelBrightnessBus::ClearTo(RgbColor((c>>16) & 0xFF, (c>>8) & 0xFF, (c) & 0xFF));
#endif
}
void WS2812FX::setAllPixelColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w)
{
#ifdef RGBW
NeoPixelBrightnessBus::ClearTo(RgbwColor(r,g,b,w));
#else
NeoPixelBrightnessBus::ClearTo(RgbColor(r,g,b));
#endif
}
void WS2812FX::setAllPixelColor(uint8_t r, uint8_t g, uint8_t b)
{
#ifdef RGBW
NeoPixelBrightnessBus::ClearTo(RgbwColor(r,g,b,0));
#else
NeoPixelBrightnessBus::ClearTo(RgbColor(r,g,b));
#endif
}
void WS2812FX::begin() void WS2812FX::begin()
{ {
NeoPixelBrightnessBus::Begin(); NeoPixelBrightnessBus::Begin();
@ -1818,7 +1762,3 @@ uint8_t WS2812FX::maxval (uint8_t v, uint8_t w)
if (w > v) return w; if (w > v) return w;
return v; return v;
} }

View File

@ -1,3 +1,5 @@
//#define RGBW
/* /*
WS2812FX.h - Library for WS2812 LED effects. WS2812FX.h - Library for WS2812 LED effects.
@ -236,7 +238,6 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
_counter_mode_call = 0; _counter_mode_call = 0;
_counter_mode_step = 0; _counter_mode_step = 0;
_locked = new boolean[n]; _locked = new boolean[n];
_none_locked = true;
} }
void void
@ -293,9 +294,6 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
setPixelColor(uint16_t i, uint32_t c), setPixelColor(uint16_t i, uint32_t c),
setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b), setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b),
setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b, uint8_t w), setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b, uint8_t w),
setAllPixelColor(uint32_t c),
setAllPixelColor(uint8_t r, uint8_t g, uint8_t b),
setAllPixelColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w),
dofade(void), dofade(void),
strip_off(void), strip_off(void),
strip_off_respectLock(void), strip_off_respectLock(void),
@ -356,7 +354,6 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
boolean boolean
_triggered, _triggered,
_none_locked,
_running; _running;
boolean* boolean*

View File

@ -20,10 +20,9 @@
#include "CallbackFunction.h" #include "CallbackFunction.h"
//version in format yymmddb (b = daily build) //version in format yymmddb (b = daily build)
#define VERSION 1710283 #define VERSION 1710284
//uncomment if you have an RGBW strip //If you have an RGBW strip, uncomment first line in WS2812FX.h!
#define RGBW
//to toggle usb serial debug (un)comment following line //to toggle usb serial debug (un)comment following line
//#define DEBUG //#define DEBUG

View File

@ -12,21 +12,12 @@ void setAllLeds() {
} else { } else {
strip.setBrightness(val); strip.setBrightness(val);
} }
#ifdef RGBW
if (useGammaCorrectionRGB) if (useGammaCorrectionRGB)
{ {
strip.setColor(gamma8[col_t[0]], gamma8[col_t[1]], gamma8[col_t[2]], gamma8[white_t]); strip.setColor(gamma8[col_t[0]], gamma8[col_t[1]], gamma8[col_t[2]], gamma8[white_t]);
} else { } else {
strip.setColor(col_t[0], col_t[1], col_t[2], white_t); strip.setColor(col_t[0], col_t[1], col_t[2], white_t);
} }
#else
if (useGammaCorrectionRGB)
{
strip.setColor(gamma8[col_t[0]], gamma8[col_t[1]], gamma8[col_t[2]]);
} else {
strip.setColor(col_t[0], col_t[1], col_t[2]);
}
#endif
} }
void setLedsStandard() void setLedsStandard()
@ -67,7 +58,7 @@ void colorUpdated(int callMode)
notify(callMode); notify(callMode);
if (fadeTransition || sweepTransition) if (fadeTransition || sweepTransition)
{ {
if (transitionActive && fadeTransition) if (transitionActive)
{ {
col_old[0] = col_t[0]; col_old[0] = col_t[0];
col_old[1] = col_t[1]; col_old[1] = col_t[1];