diff --git a/wled00/FX.cpp b/wled00/FX.cpp index c862a085..fc13c60d 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -2302,6 +2302,10 @@ uint16_t WS2812FX::mode_glitter() } +//values close to 100 produce 5Hz flicker, which looks very candle-y +//Inspired by https://github.com/avanhanegem/ArduinoCandleEffectNeoPixel +//and https://cpldcpu.wordpress.com/2016/01/05/reverse-engineering-a-real-candle/ + uint16_t WS2812FX::mode_candle() { if (SEGENV.call == 0) { @@ -2329,17 +2333,14 @@ uint16_t WS2812FX::mode_candle() uint8_t valrange = SEGMENT.intensity; uint8_t rndval = valrange >> 1; target = random8(rndval) + random8(rndval); - if (target < (rndval >> 1)) target += random8(rndval >> 1); + if (target < (rndval >> 1)) target = (rndval >> 1) + random8(rndval); uint8_t offset = (255 - valrange) >> 1; target += offset; uint8_t dif = (target > s) ? target - s : s - target; - uint16_t fadeSpeed = 50 + ((255-SEGMENT.speed) >> 1); //how much to move closer to target per frame - fadeStep = dif; - uint8_t frames = 1; - if (fadeSpeed > FRAMETIME) fadeStep = dif / (fadeSpeed / FRAMETIME); + fadeStep = dif >> 2; //mode called every ~25 ms, so 4 frames to have a new target every 100ms if (fadeStep == 0) fadeStep = 1; SEGENV.step = fadeStep; diff --git a/wled00/FX.h b/wled00/FX.h index 9ba70357..44be95d5 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -571,12 +571,12 @@ class WS2812FX { const char JSON_mode_names[] PROGMEM = R"=====([ "Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow", "Scan","Dual Scan","Fade","Theater","Theater Rainbow","Running","Saw","Twinkle","Dissolve","Dissolve Rnd", -"Sparkle","Dark Sparkle","Sparkle+","Strobe","Strobe Rainbow","Mega Strobe","Blink Rainbow","Android","Chase","Chase Random", +"Sparkle","Sparkle Dark","Sparkle+","Strobe","Strobe Rainbow","Strobe Mega","Blink Rainbow","Android","Chase","Chase Random", "Chase Rainbow","Chase Flash","Chase Flash Rnd","Rainbow Runner","Colorful","Traffic Light","Sweep Random","Running 2","Red & Blue","Stream", "Scanner","Lighthouse","Fireworks","Rain","Merry Christmas","Fire Flicker","Gradient","Loading","Police","Police All", "Two Dots","Two Areas","Circus","Halloween","Tri Chase","Tri Wipe","Tri Fade","Lightning","ICU","Multi Comet", -"Dual Scanner","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise", -"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Smooth Meteor","Railway","Ripple", +"Scanner Dual ","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise", +"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple", "Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle" ])====="; diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 460bcadf..c3f1cb77 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -10,7 +10,7 @@ -