add colorPattern config option, use mqtt boilerplate with watchdog
This commit is contained in:
@ -43,7 +43,7 @@ typedef struct {
|
||||
|
||||
|
||||
// Adafruit_NeoPixel pixels(NUM_OF_LEDs, PIXEL_PIN, NEO_RGB + NEO_KHZ400);
|
||||
Adafruit_NeoPixel pixels(NUM_OF_LEDs, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
|
||||
Adafruit_NeoPixel pixels(NUM_OF_LEDs, PIXEL_PIN, NEO_RGB + NEO_KHZ800);
|
||||
#endif
|
||||
|
||||
bool show = false;
|
||||
@ -102,7 +102,23 @@ void subscribeApplication() {
|
||||
|
||||
|
||||
|
||||
static void setColor(int16_t ledNumber, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
static void setColor(int16_t ledNumber, uint8_t x, uint8_t y, uint8_t z) {
|
||||
uint8_t red, green, blue;
|
||||
|
||||
switch (configBlock.colorPattern) {
|
||||
case 1:
|
||||
red = y;
|
||||
green = x;
|
||||
blue = z;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
red = x;
|
||||
green = y;
|
||||
blue = z;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ledNumber == -1) {
|
||||
for (uint16_t i = 0; i < NUM_OF_LEDs; i++) {
|
||||
#ifdef WS2811
|
||||
@ -188,6 +204,7 @@ void callbackApplication(char *topic, uint8_t tokenCnt, char **tokens) {
|
||||
void setupApplication() {
|
||||
mqttSetup();
|
||||
|
||||
|
||||
#ifdef WS2811
|
||||
FastLED.addLeds<NEOPIXEL, PIXEL_PIN>(leds, NUM_OF_LEDs);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user