Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
781 B

  1. #if GARLAND_SUPPORT
  2. #include "../anim.h"
  3. #include "../palette.h"
  4. //------------------------------------------------------------------------------
  5. class AnimGlow : public Anim {
  6. public:
  7. AnimGlow() : Anim("Glow") {
  8. }
  9. void SetupImpl() override {
  10. curColor = palette->getRndInterpColor();
  11. inc = secureRandom(2) * 2 - 1;
  12. glowSetUp();
  13. }
  14. void Run() override {
  15. if (inc > 0) {
  16. for (int i = 0; i < numLeds; ++i) {
  17. leds[i] = curColor;
  18. glowForEachLed(i);
  19. }
  20. } else {
  21. for (int i = numLeds - 1 ; i >= 0; --i) {
  22. leds[i] = curColor;
  23. glowForEachLed(i);
  24. }
  25. }
  26. glowRun();
  27. }
  28. };
  29. #endif // GARLAND_SUPPORT