diff --git a/src/main.cpp b/src/main.cpp index a0a7710..045e23a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -122,21 +122,56 @@ void setup_fastled() { set_all_leds(CRGB::Black); } +void show_all() { + for(Node* node : nodes) { + node->draw(); + } + FastLED.show(); +} + +void show_status(uint8_t status, CRGB color=CRGB::Green) { + for (int i=0; iset_color(color); + } + } + for (int i=status; iset_color(CRGB::Black); + } + show_all(); +} + void setup() { Serial.begin(74880); LOGln("ESPleaf starting."); - setup_layout(); + setup_fastled(); + show_status(1); + + setup_layout(); + show_status(2); + #ifdef TEST_MODE LOGln("TEST_MODE is active!"); #else wifi_setup(); + + show_status(3); + mqtt_setup(); ArduinoOTA.setHostname(OTA_HOSTNAME); + ArduinoOTA.onProgress([&](unsigned int progress, unsigned int total){ + uint8_t count = progress * corners.size() / total; + show_status(count, CRGB::Blue); + }); + ArduinoOTA.onEnd([](){ show_status(0); }); ArduinoOTA.begin(); + + show_status(255); + delay(250); + show_status(0); #endif - } void loop() {