Added "Effect" AM_STATIC ("static") and some more colors.

This commit is contained in:
Fabian Schlenz 2021-01-08 22:22:06 +01:00
parent 40efeee436
commit 8fe03313ac
3 changed files with 8 additions and 4 deletions

View File

@ -24,7 +24,8 @@ enum AnimationMode {
AM_FLASH,
AM_OFF,
AM_ERROR,
AM_NONE
AM_NONE,
AM_STATIC
};
extern AnimationMode mode;

View File

@ -216,10 +216,9 @@ void loop() {
nodes[0]->blend_to(((millis() / 1000) % 2 == 0) ? CRGB::Black : color, 0, 64);
}
} else if (active_mode == AM_OFF) {
LOGln("Blanking.");
} else if (active_mode == AM_OFF || active_mode == AM_STATIC) {
for(Node* node : nodes) {
node->set_color(CRGB::Black);
node->set_color(active_mode == AM_OFF ? CRGB::Black : color);
node->draw();
}
} else { // This includes AM_ERROR

View File

@ -50,6 +50,7 @@ void callback(char* topic, byte* pl, unsigned int length) {
else if (value.equals("first_corner")) { new_mode = AM_FIRST_CORNER; }
else if (value.equals("off")) { new_mode = AM_OFF; }
else if (value.equals("flash")) { new_mode = AM_FLASH; }
else if (value.equals("static")) { new_mode = AM_STATIC; }
else { LOGln("Unknown mode '%s'.", value.c_str()); }
} else if (key.equals("duration")) {
duration = value.toInt();
@ -62,6 +63,9 @@ void callback(char* topic, byte* pl, unsigned int length) {
if (value.equals("red")) { color = CRGB::Red; }
else if (value.equals("green")) { color = CRGB::Green; }
else if (value.equals("blue")) { color = CRGB::Blue; }
else if (value.equals("pink")) { color = CRGB::Pink; }
else if (value.equals("yellow")) { color = CRGB::Yellow; }
else if (value.equals("orange")) { color = CRGB::Orange; }
else { LOGln("Unknown color name %s.", value.c_str());}
} else {
LOGln("Unknown key '%s'. (For reference: Value is '%s'.)", key.c_str(), value.c_str());