Fixed effects (#466)
This commit is contained in:
parent
512c4dd6f1
commit
94200dd3a4
@ -151,7 +151,7 @@ uint16_t WS2812FX::color_wipe(bool rev, bool useRandomColors) {
|
||||
uint32_t col1 = useRandomColors? color_wheel(SEGENV.aux1) : SEGCOLOR(1);
|
||||
for (uint16_t i = SEGMENT.start; i < SEGMENT.stop; i++)
|
||||
{
|
||||
uint16_t index = (rev && back)? SEGMENT.stop -1 -i : i;
|
||||
uint16_t index = (rev && back)? SEGMENT.stop -1 -i +SEGMENT.start : i;
|
||||
uint32_t col0 = useRandomColors? color_wheel(SEGENV.aux0) : color_from_palette(index, true, PALETTE_SOLID_WRAP, 0);
|
||||
|
||||
if (i - SEGMENT.start < ledIndex)
|
||||
@ -729,33 +729,40 @@ uint16_t WS2812FX::mode_colorful(void) {
|
||||
cols[3] = 0x0077F0F0;
|
||||
for (uint8_t i = 4; i < 7; i++) cols[i] = cols[i-4];
|
||||
}
|
||||
int i = SEGMENT.start;
|
||||
for (i; i < SEGMENT.stop ; i+=4)
|
||||
|
||||
uint32_t cycleTime = 50 + (15 * (uint32_t)(255 - SEGMENT.speed));
|
||||
uint32_t it = now / cycleTime;
|
||||
if (it != SEGENV.step)
|
||||
{
|
||||
setPixelColor(i, cols[SEGENV.step]);
|
||||
setPixelColor(i+1, cols[SEGENV.step+1]);
|
||||
setPixelColor(i+2, cols[SEGENV.step+2]);
|
||||
setPixelColor(i+3, cols[SEGENV.step+3]);
|
||||
if (SEGMENT.speed > 0) SEGENV.aux0++;
|
||||
if (SEGENV.aux0 > 3) SEGENV.aux0 = 0;
|
||||
SEGENV.step = it;
|
||||
}
|
||||
|
||||
uint16_t i = SEGMENT.start;
|
||||
for (i; i < SEGMENT.stop -3; i+=4)
|
||||
{
|
||||
setPixelColor(i, cols[SEGENV.aux0]);
|
||||
setPixelColor(i+1, cols[SEGENV.aux0+1]);
|
||||
setPixelColor(i+2, cols[SEGENV.aux0+2]);
|
||||
setPixelColor(i+3, cols[SEGENV.aux0+3]);
|
||||
}
|
||||
i+=4;
|
||||
if(i < SEGMENT.stop)
|
||||
{
|
||||
setPixelColor(i, cols[SEGENV.step]);
|
||||
setPixelColor(i, cols[SEGENV.aux0]);
|
||||
|
||||
if(i+1 < SEGMENT.stop)
|
||||
{
|
||||
setPixelColor(i+1, cols[SEGENV.step+1]);
|
||||
setPixelColor(i+1, cols[SEGENV.aux0+1]);
|
||||
|
||||
if(i+2 < SEGMENT.stop)
|
||||
{
|
||||
setPixelColor(i+2, cols[SEGENV.step+2]);
|
||||
setPixelColor(i+2, cols[SEGENV.aux0+2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SEGMENT.speed > 0) SEGENV.step++; //static if lowest speed
|
||||
if (SEGENV.step >3) SEGENV.step = 0;
|
||||
return 50 + (15 * (uint32_t)(255 - SEGMENT.speed));
|
||||
return FRAMETIME;
|
||||
}
|
||||
|
||||
|
||||
@ -768,7 +775,7 @@ uint16_t WS2812FX::mode_traffic_light(void) {
|
||||
uint32_t mdelay = 500;
|
||||
for (int i = SEGMENT.start; i < SEGMENT.stop-2 ; i+=3)
|
||||
{
|
||||
switch (SEGENV.step)
|
||||
switch (SEGENV.aux0)
|
||||
{
|
||||
case 0: setPixelColor(i, 0x00FF0000); mdelay = 150 + (100 * (uint32_t)(255 - SEGMENT.speed));break;
|
||||
case 1: setPixelColor(i, 0x00FF0000); mdelay = 150 + (20 * (uint32_t)(255 - SEGMENT.speed)); setPixelColor(i+1, 0x00EECC00); break;
|
||||
@ -777,9 +784,14 @@ uint16_t WS2812FX::mode_traffic_light(void) {
|
||||
}
|
||||
}
|
||||
|
||||
SEGENV.step++;
|
||||
if (SEGENV.step >3) SEGENV.step = 0;
|
||||
return mdelay;
|
||||
if (now - SEGENV.step > mdelay)
|
||||
{
|
||||
SEGENV.aux0++;
|
||||
if (SEGENV.aux0 > 3) SEGENV.aux0 = 0;
|
||||
SEGENV.step = now;
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
}
|
||||
|
||||
|
||||
@ -1074,7 +1086,7 @@ uint16_t WS2812FX::gradient_base(bool loading) {
|
||||
}
|
||||
per = val/brd;
|
||||
if (per >1.0) per = 1.0;
|
||||
setPixelColor(SEGMENT.start + i, color_blend(SEGCOLOR(0), color_from_palette(SEGMENT.start + i, true, PALETTE_SOLID_WRAP, 1), per*255));
|
||||
setPixelColor(i, color_blend(SEGCOLOR(0), color_from_palette(i, true, PALETTE_SOLID_WRAP, 1), per*255));
|
||||
}
|
||||
|
||||
SEGENV.step++;
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
/*
|
||||
* @title WLED project sketch
|
||||
* @version 0.9.0-b1
|
||||
* @version 0.9.0-b2
|
||||
* @author Christian Schwinne
|
||||
*/
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1912191
|
||||
#define VERSION 1912211
|
||||
char versionString[] = "0.9.0-b2";
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ void initServer()
|
||||
|
||||
AsyncCallbackJsonWebHandler* handler = new AsyncCallbackJsonWebHandler("/json", [](AsyncWebServerRequest *request) {
|
||||
bool verboseResponse = false;
|
||||
if (1) { //scope JsonDocument so it releases its buffer
|
||||
{ //scope JsonDocument so it releases its buffer
|
||||
DynamicJsonDocument jsonBuffer(8192);
|
||||
DeserializationError error = deserializeJson(jsonBuffer, (uint8_t*)(request->_tempObject));
|
||||
JsonObject root = jsonBuffer.as<JsonObject>();
|
||||
|
Loading…
Reference in New Issue
Block a user