Updated to use the new LEDMode/LEDControl API

Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
pull/365/head
Gergely Nagy 7 years ago
parent 43b768cabb
commit 25cb263e6a

@ -1,9 +1,8 @@
#include "Kaleidoscope-LEDEffect-Rainbow.h"
LEDRainbowEffect_::LEDRainbowEffect_(void) {
}
namespace kaleidoscope {
void LEDRainbowEffect_::update(void) {
void LEDRainbowEffect::update(void) {
if (rainbow_current_ticks++ < rainbow_ticks) {
return;
} else {
@ -16,21 +15,17 @@ void LEDRainbowEffect_::update(void) {
if (rainbow_hue >= 255) {
rainbow_hue -= 255;
}
LEDControl.set_all_leds_to(rainbow);
::LEDControl.set_all_leds_to(rainbow);
}
void LEDRainbowEffect_::brightness(byte brightness) {
void LEDRainbowEffect::brightness(byte brightness) {
rainbow_value = brightness;
}
LEDRainbowEffect_ LEDRainbowEffect;
// ---------
LEDRainbowWaveEffect_::LEDRainbowWaveEffect_(void) {
}
void LEDRainbowWaveEffect_::update(void) {
void LEDRainbowWaveEffect::update(void) {
if (rainbow_current_ticks++ < rainbow_wave_ticks) {
return;
} else {
@ -43,7 +38,7 @@ void LEDRainbowWaveEffect_::update(void) {
key_hue -= 255;
}
cRGB rainbow = hsvToRgb(key_hue, rainbow_saturation, rainbow_value);
LEDControl.setCrgbAt(i, rainbow);
::LEDControl.setCrgbAt(i, rainbow);
}
rainbow_hue += rainbow_wave_steps;
if (rainbow_hue >= 255) {
@ -51,8 +46,10 @@ void LEDRainbowWaveEffect_::update(void) {
}
}
void LEDRainbowWaveEffect_::brightness(byte brightness) {
void LEDRainbowWaveEffect::brightness(byte brightness) {
rainbow_value = brightness;
}
}
LEDRainbowWaveEffect_ LEDRainbowWaveEffect;
kaleidoscope::LEDRainbowEffect LEDRainbowEffect;
kaleidoscope::LEDRainbowWaveEffect LEDRainbowWaveEffect;

@ -3,9 +3,10 @@
#include "Kaleidoscope-LEDControl.h"
#include "LEDUtils.h"
class LEDRainbowEffect_ : public LEDMode {
namespace kaleidoscope {
class LEDRainbowEffect : public LEDMode {
public:
LEDRainbowEffect_(void);
LEDRainbowEffect(void) {}
void brightness(byte);
void update(void) final;
@ -21,11 +22,10 @@ class LEDRainbowEffect_ : public LEDMode {
byte rainbow_value = 50;
};
extern LEDRainbowEffect_ LEDRainbowEffect;
class LEDRainbowWaveEffect_ : public LEDMode {
class LEDRainbowWaveEffect : public LEDMode {
public:
LEDRainbowWaveEffect_(void);
LEDRainbowWaveEffect(void) {}
void brightness(byte);
void update(void) final;
@ -40,5 +40,7 @@ class LEDRainbowWaveEffect_ : public LEDMode {
byte rainbow_saturation = 255;
byte rainbow_value = 50;
};
}
extern LEDRainbowWaveEffect_ LEDRainbowWaveEffect;
extern kaleidoscope::LEDRainbowEffect LEDRainbowEffect;
extern kaleidoscope::LEDRainbowWaveEffect LEDRainbowWaveEffect;

Loading…
Cancel
Save