mirror of
https://gitlab.com/wirelos/sprocket-plugin-neopixel.git
synced 2025-12-14 21:52:21 +01:00
add single color color wheel
This commit is contained in:
@@ -26,8 +26,10 @@ PixelPlugin::PixelPlugin()
|
|||||||
defaultAnimation();
|
defaultAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelPlugin::loadConfigFromFile(){
|
void PixelPlugin::loadConfigFromFile()
|
||||||
if (SPIFFS.begin()){
|
{
|
||||||
|
if (SPIFFS.begin())
|
||||||
|
{
|
||||||
pixelConfig.fromFile(PIXEL_CONFIG_FILE);
|
pixelConfig.fromFile(PIXEL_CONFIG_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +39,8 @@ void PixelPlugin::applyConfig(NeoPixelConfig cfg)
|
|||||||
pixels->setBrightness(pixelConfig.brightness);
|
pixels->setBrightness(pixelConfig.brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelPlugin::defaultAnimation() {
|
void PixelPlugin::defaultAnimation()
|
||||||
|
{
|
||||||
pixels->RainbowCycle(pixelConfig.updateInterval);
|
pixels->RainbowCycle(pixelConfig.updateInterval);
|
||||||
animate();
|
animate();
|
||||||
}
|
}
|
||||||
@@ -49,6 +52,7 @@ void PixelPlugin::activate(Scheduler *userScheduler)
|
|||||||
animation.enable();
|
animation.enable();
|
||||||
|
|
||||||
subscribe("pixels/colorWheel", bind(&PixelPlugin::colorWheel, this, _1));
|
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/colorWheel2", bind(&PixelPlugin::colorWheel2, this, _1));
|
||||||
subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1));
|
subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1));
|
||||||
subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1));
|
subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1));
|
||||||
@@ -76,9 +80,19 @@ void PixelPlugin::setState(String msg)
|
|||||||
|
|
||||||
void PixelPlugin::colorWheel(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->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)
|
void PixelPlugin::colorWheel2(String msg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class PixelPlugin : public Plugin
|
|||||||
void defaultAnimation();
|
void defaultAnimation();
|
||||||
void setState(String msg);
|
void setState(String msg);
|
||||||
void colorWheel(String msg);
|
void colorWheel(String msg);
|
||||||
|
void colorWheel1(String msg);
|
||||||
void colorWheel2(String msg);
|
void colorWheel2(String msg);
|
||||||
void setTotalSteps(String msg);
|
void setTotalSteps(String msg);
|
||||||
void setBrightness(String msg);
|
void setBrightness(String msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user