diff --git a/src/PixelPlugin.cpp b/src/PixelPlugin.cpp index 613138c..6fe4032 100644 --- a/src/PixelPlugin.cpp +++ b/src/PixelPlugin.cpp @@ -26,8 +26,10 @@ PixelPlugin::PixelPlugin() defaultAnimation(); } -void PixelPlugin::loadConfigFromFile(){ - if (SPIFFS.begin()){ +void PixelPlugin::loadConfigFromFile() +{ + if (SPIFFS.begin()) + { pixelConfig.fromFile(PIXEL_CONFIG_FILE); } } @@ -37,7 +39,8 @@ void PixelPlugin::applyConfig(NeoPixelConfig cfg) pixels->setBrightness(pixelConfig.brightness); } -void PixelPlugin::defaultAnimation() { +void PixelPlugin::defaultAnimation() +{ pixels->RainbowCycle(pixelConfig.updateInterval); animate(); } @@ -49,6 +52,7 @@ void PixelPlugin::activate(Scheduler *userScheduler) animation.enable(); subscribe("pixels/colorWheel", bind(&PixelPlugin::colorWheel, this, _1)); + subscribe("pixels/colorWheel1", bind(&PixelPlugin::colorWheel1, this, _1)); subscribe("pixels/colorWheel2", bind(&PixelPlugin::colorWheel2, this, _1)); subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1)); subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1)); @@ -76,9 +80,19 @@ void PixelPlugin::setState(String msg) void PixelPlugin::colorWheel(String msg) { - int color = atoi(msg.c_str()); + int color = pixels->Wheel(atoi(msg.c_str())); + pixels->Color1 = color; pixels->ActivePattern = NONE; - pixels->ColorSet(pixels->Wheel(color)); + pixels->ColorSet(color); +} +void PixelPlugin::colorWheel1(String msg) +{ + int color = pixels->Wheel(atoi(msg.c_str())); + pixels->Color1 = color; + if (pixels->ActivePattern == NONE) + { + pixels->ColorSet(color); + } } void PixelPlugin::colorWheel2(String msg) { diff --git a/src/PixelPlugin.h b/src/PixelPlugin.h index f532926..796f2bf 100644 --- a/src/PixelPlugin.h +++ b/src/PixelPlugin.h @@ -44,6 +44,7 @@ class PixelPlugin : public Plugin void defaultAnimation(); void setState(String msg); void colorWheel(String msg); + void colorWheel1(String msg); void colorWheel2(String msg); void setTotalSteps(String msg); void setBrightness(String msg);