mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-16 10:04:30 +01:00
fix completion, add moar events
This commit is contained in:
@@ -34,13 +34,18 @@ class PixelPlugin : public Plugin {
|
||||
subscribe("pixels/totalSteps", bind(&PixelPlugin::setTotalSteps, this, _1));
|
||||
subscribe("pixels/brightness", bind(&PixelPlugin::setBrightness, this, _1));
|
||||
subscribe("pixels/state", bind(&PixelPlugin::setState, this, _1));
|
||||
subscribe("pixels/stream", bind(&PixelPlugin::stream, this, _1));
|
||||
|
||||
animation.set(TASK_MILLISECOND * pixelConfig.updateInterval, TASK_FOREVER, bind(&PixelPlugin::animate, this));
|
||||
userScheduler->addTask(animation);
|
||||
animation.enable();
|
||||
PRINT_MSG(Serial, SPROCKET_TYPE, "NeoPixels activated");
|
||||
}
|
||||
void stream(String msg){
|
||||
// TODO handle LED byte array stream
|
||||
}
|
||||
void setState(String msg) {
|
||||
PRINT_MSG(Serial, SPROCKET_TYPE, msg.c_str());
|
||||
state.fromJsonString(msg);
|
||||
pixels->setBrightness(state.brightness);
|
||||
pixels->ColorSet(state.color);
|
||||
@@ -49,6 +54,7 @@ class PixelPlugin : public Plugin {
|
||||
pixels->Color2 = state.color2;
|
||||
pixels->TotalSteps = state.totalSteps;
|
||||
pixels->ActivePattern = (pattern) state.pattern;
|
||||
pixels->Direction = FORWARD;
|
||||
}
|
||||
void colorWheel(String msg){
|
||||
int color = atoi(msg.c_str());
|
||||
|
||||
Reference in New Issue
Block a user