Moved individual calls to node->draw() or corner->draw() to a single central call to show_all.

This commit is contained in:
Fabian Schlenz 2021-01-10 16:30:53 +01:00
parent 808112ebb0
commit 4b3797f4fc

View File

@ -217,7 +217,6 @@ void loop() {
corner->infect(300, 600); corner->infect(300, 600);
} }
looping |= !corner->is_finished(); looping |= !corner->is_finished();
corner->draw();
} }
if (random8(128)==0) { if (random8(128)==0) {
@ -231,7 +230,6 @@ void loop() {
for(Node* node : nodes) { for(Node* node : nodes) {
node->step(); node->step();
node->infect(512); node->infect(512);
node->draw();
} }
if (random8(128)==0) { if (random8(128)==0) {
@ -245,7 +243,6 @@ void loop() {
for (Node* node : nodes) { for (Node* node : nodes) {
node->step(); node->step();
node->infect(512); node->infect(512);
node->draw();
} }
if (millis() / 1000 > last_loop / 1000) { if (millis() / 1000 > last_loop / 1000) {
@ -255,21 +252,17 @@ void loop() {
} else if (active_mode == AM_OFF || active_mode == AM_STATIC) { } else if (active_mode == AM_OFF || active_mode == AM_STATIC) {
for(Node* node : nodes) { for(Node* node : nodes) {
node->set_color(active_mode == AM_OFF ? CRGB::Black : color); node->set_color(active_mode == AM_OFF ? CRGB::Black : color);
node->draw();
} }
} else { // This includes AM_ERROR } else { // This includes AM_ERROR
for(Node* node : nodes) { for(Node* node : nodes) {
node->set_color(CRGB::Black); node->set_color(CRGB::Black);
} }
nodes[0]->set_color(CRGB::Red); nodes[0]->set_color(CRGB::Red);
for(Node* node : nodes) {
node->draw();
}
} }
last_loop = millis(); last_loop = millis();
} }
#endif #endif
FastLED.show(); show_all();
} }