Make cRGB initialization not depend on struct order.

pull/18/head
Jesse Vincent 9 years ago
parent b96c06338f
commit b461309910

@ -1,6 +1,23 @@
#include "LEDControl.h" #include "LEDControl.h"
LEDControl_::LEDControl_(void) { LEDControl_::LEDControl_(void) {
led_off.r = 0;
led_off.g = 0;
led_off.b = 0;
led_steady.r = 0;
led_steady.g = 255;
led_steady.b = 0;
led_blue.r = 0;
led_blue.g = 0;
led_blue.b = 255;
led_dark_blue.r = 0;
led_dark_blue.g = 0;
led_dark_blue .b = 127;
led_bright_red.r = 255;
led_bright_red.g = 0;
led_bright_red.b = 0;
} }
@ -107,7 +124,7 @@ void LEDControl_::led_compute_breath() {
} }
led_breathe.SetHSV(200, 255, breathe_brightness); hsv_to_rgb(&led_breathe,200, 255, breathe_brightness);
} }
void LEDControl_::effect_breathe_update() { void LEDControl_::effect_breathe_update() {

@ -32,17 +32,14 @@ class LEDControl_ {
uint8_t pos = 0; uint8_t pos = 0;
void hsv_to_rgb(cRGB *cRGB, uint16_t h, uint16_t s, uint16_t v); void hsv_to_rgb(cRGB *cRGB, uint16_t h, uint16_t s, uint16_t v);
cRGB led_off;
cRGB led_steady;
cRGB led_off = { .r = 0, .g = 0, .b = 0 }; cRGB led_blue;
cRGB led_steady = { .r = 0, .g = 255, .b = 0}; cRGB led_dark_blue;
cRGB led_blue = { .r = 0, .g = 0, .b = 255 }; cRGB led_bright_red;
cRGB led_dark_blue = { .r = 0, .g = 0, .b = 127 };
cRGB led_bright_red = { .r = 255, .g = 0, .b = 0};
cRGB led_breathe; cRGB led_breathe;
cRGB rainbow; cRGB rainbow;
uint16_t rainbow_hue = 0; //stores 0 to 614 uint16_t rainbow_hue = 0; //stores 0 to 614
static const uint8_t rainbow_steps = 1; //number of hues we skip in a 360 range per update static const uint8_t rainbow_steps = 1; //number of hues we skip in a 360 range per update

Loading…
Cancel
Save