mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-16 10:04:30 +01:00
moar topics
This commit is contained in:
@@ -26,11 +26,38 @@ class PixelPlugin : public Plugin {
|
||||
pixels->setBrightness(pixelConfig.brightness);
|
||||
}
|
||||
void activate(Scheduler* userScheduler, Network* network){
|
||||
subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1));
|
||||
subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1));
|
||||
subscribe("pixels/pattern", bind(&PixelPlugin::setPattern, this, _1));
|
||||
subscribe("pixels/totalSteps", bind(&PixelPlugin::setTotalSteps, this, _1));
|
||||
subscribe("pixels/brightness", bind(&PixelPlugin::setBrightness, this, _1));
|
||||
|
||||
animation.set(TASK_MILLISECOND * pixelConfig.updateInterval, TASK_FOREVER, bind(&PixelPlugin::animate, this));
|
||||
userScheduler->addTask(animation);
|
||||
animation.enable();
|
||||
Serial.println("NeoPixels activated");
|
||||
}
|
||||
void setTotalSteps(String msg){
|
||||
pixels->TotalSteps = atoi(msg.c_str());
|
||||
}
|
||||
void setBrightness(String msg){
|
||||
int inVal = atoi(msg.c_str());
|
||||
pixels->setBrightness(inVal);
|
||||
pixels->show();
|
||||
}
|
||||
void setColor(String msg){
|
||||
pixels->Color1 = atoi(msg.c_str());
|
||||
if(pixels->ActivePattern == NONE){
|
||||
pixels->ColorSet(pixels->Color1);
|
||||
}
|
||||
}
|
||||
void setColor2(String msg){
|
||||
pixels->Color2 = atoi(msg.c_str());
|
||||
}
|
||||
void setPattern(String msg){
|
||||
pixels->Index = 0;
|
||||
pixels->ActivePattern = (pattern)atoi(msg.c_str());
|
||||
}
|
||||
void animate(){
|
||||
pixels->Update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user