Improved colortwinkles on longer strips
Added offMode
This commit is contained in:
parent
d3fc0309c0
commit
bec745d095
@ -2582,16 +2582,19 @@ uint16_t WS2812FX::mode_colortwinkle()
|
||||
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
||||
}
|
||||
}
|
||||
|
||||
if( random8() <= SEGMENT.intensity ) {
|
||||
for (uint8_t times = 0; times < 5; times++) //attempt to spawn a new pixel 5 times
|
||||
{
|
||||
int i = SEGMENT.start + random16(SEGMENT_LENGTH);
|
||||
if(getPixelColor(i) == 0) {
|
||||
fastled_col = ColorFromPalette(currentPalette, random8(), 64, NOBLEND);
|
||||
_locked[i] = true;
|
||||
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
||||
return 20; //only spawn 1 new pixel per frame
|
||||
|
||||
for (uint16_t j = 0; j <= SEGMENT_LENGTH / 50; j++)
|
||||
{
|
||||
if ( random8() <= SEGMENT.intensity ) {
|
||||
for (uint8_t times = 0; times < 5; times++) //attempt to spawn a new pixel 5 times
|
||||
{
|
||||
int i = SEGMENT.start + random16(SEGMENT_LENGTH);
|
||||
if(getPixelColor(i) == 0) {
|
||||
fastled_col = ColorFromPalette(currentPalette, random8(), 64, NOBLEND);
|
||||
_locked[i] = true;
|
||||
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
||||
break; //only spawn 1 new pixel per frame per 50 LEDs
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1812052
|
||||
#define VERSION 1812141
|
||||
char versionString[] = "0.8.2";
|
||||
|
||||
|
||||
@ -271,6 +271,8 @@ unsigned long nightlightStartTime;
|
||||
byte briNlT = 0; //current nightlight brightness
|
||||
|
||||
//brightness
|
||||
bool offMode = false;
|
||||
unsigned long lastOnTime = 0;
|
||||
byte bri = briS;
|
||||
byte briOld = 0;
|
||||
byte briT = 0;
|
||||
@ -528,7 +530,19 @@ void loop() {
|
||||
handleHue();
|
||||
handleBlynk();
|
||||
}
|
||||
if (briT) strip.service(); //do not update strip if off, prevents flicker on ESP32
|
||||
if (briT) lastOnTime = millis();
|
||||
if (millis() - lastOnTime < 600)
|
||||
{
|
||||
offMode = false;
|
||||
strip.service();
|
||||
} else if (!offMode)
|
||||
{
|
||||
/*#if LEDPIN == 2 //turn off onboard LED
|
||||
pinMode(2, OUTPUT);
|
||||
digitalWrite(2, HIGH);
|
||||
#endif*/
|
||||
offMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
//DEBUG serial logging
|
||||
|
Loading…
Reference in New Issue
Block a user