add stuff

This commit is contained in:
2018-09-19 00:27:33 +02:00
parent 64e9a33971
commit 1319fb045c
4 changed files with 16 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ class PixelPlugin : public Plugin {
pixels->setBrightness(pixelConfig.brightness);
}
void activate(Scheduler* userScheduler, Network* network){
subscribe("pixels/colorWheel", bind(&PixelPlugin::colorWheel, this, _1));
subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1));
subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1));
subscribe("pixels/pattern", bind(&PixelPlugin::setPattern, this, _1));
@@ -43,6 +44,11 @@ class PixelPlugin : public Plugin {
void setState(String msg){
state.fromJsonString(msg);
}
void colorWheel(String msg){
int color = atoi(msg.c_str());
pixels->ActivePattern = NONE;
pixels->ColorSet(pixels->Wheel(color));
}
void setTotalSteps(String msg){
pixels->TotalSteps = atoi(msg.c_str());
}