From b2d397e14db8ae15b6b30c9cdbec2b6e484f53d3 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 11 Oct 2015 18:16:58 +0200 Subject: [PATCH] New flame effect Flame effect added Minor initialization issue fixed --- src/Ala.h | 1 + src/AlaLed.cpp | 14 +++++++++++++- src/AlaLed.h | 1 + src/AlaLedRgb.cpp | 4 +--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Ala.h b/src/Ala.h index 1d347b7..02b5dc5 100644 --- a/src/Ala.h +++ b/src/Ala.h @@ -49,6 +49,7 @@ #define ALA_FADECOLORS 351 #define ALA_FADECOLORSLOOP 352 #define ALA_PIXELSFADECOLORS 353 +#define ALA_FLAME 354 #define ALA_FIRE 501 #define ALA_BOUNCINGBALLS 502 diff --git a/src/AlaLed.cpp b/src/AlaLed.cpp index f1c13fd..5da4056 100644 --- a/src/AlaLed.cpp +++ b/src/AlaLed.cpp @@ -3,6 +3,7 @@ #include "ExtTlc5940.h" + AlaLed::AlaLed() { maxOut=255; @@ -16,7 +17,7 @@ AlaLed::AlaLed() void AlaLed::initPWM(byte pin) { - byte *pins_ = (byte *)malloc(numLeds); + byte *pins_ = (byte *)malloc(1); pins_[0] = pin; initPWM(1, pins_); @@ -178,6 +179,8 @@ void AlaLed::setAnimationFunc(int animation) case ALA_FADEOUT: animFunc = &AlaLed::fadeOut; break; case ALA_FADEINOUT: animFunc = &AlaLed::fadeInOut; break; case ALA_GLOW: animFunc = &AlaLed::glow; break; + case ALA_FLAME: animFunc = &AlaLed::flame; break; + default: animFunc = &AlaLed::off; } } @@ -442,3 +445,12 @@ void AlaLed::glow() leds[x] = (-cos(s)+1)*maxOut/2; } } + +void AlaLed::flame() +{ + for(int x=0; x