Changed the bootup order: Connecting to WiFi first allows us to send the logs of the layout analyzer via syslog.
This commit is contained in:
parent
f4864dec05
commit
db76255a2c
@ -35,8 +35,9 @@ Valid keys are:
|
||||
## Startup sequence
|
||||
|
||||
During startup:
|
||||
* 1 green corner: FastLED is initialized. Layout is now being analyzed.
|
||||
* 2 green corners: Layout is done. WiFi is being connected.
|
||||
* 3 green corners: WiFi connection established. Connecting to MQTT server.
|
||||
* 4 green corners (only if OTA_DELAY is set): Waiting for an OTA connection.
|
||||
* 1 green corner: FastLED is initialized.
|
||||
* 2 green corners: WiFi is connecting...
|
||||
* 3 green corners: Layout is analyzed...
|
||||
* 4 green corners: Connecting to MQTT server...
|
||||
* 5 green corners (only if OTA_DELAY is set): Waiting for an OTA connection...
|
||||
* Everything green (quarter of a second): Initialization done.
|
@ -39,6 +39,7 @@ void Corner::infect(uint16_t infect_short_level, uint16_t infect_long_level) {
|
||||
}
|
||||
|
||||
bool Corner::reached_level(uint16_t level) {
|
||||
if (color_blend_state >= 1024) return false;
|
||||
uint16_t old_cbs = color_blend_state >= effect_speed ? color_blend_state - effect_speed : 0;
|
||||
return (old_cbs < level && color_blend_state >= level);
|
||||
}
|
||||
|
12
src/main.cpp
12
src/main.cpp
@ -167,16 +167,16 @@ void setup() {
|
||||
setup_fastled();
|
||||
show_status(1);
|
||||
|
||||
setup_layout();
|
||||
show_status(2);
|
||||
|
||||
#ifdef TEST_MODE
|
||||
LOGln("TEST_MODE is active!");
|
||||
#else
|
||||
show_status(2);
|
||||
wifi_setup();
|
||||
|
||||
show_status(3);
|
||||
setup_layout();
|
||||
|
||||
show_status(4);
|
||||
mqtt_setup();
|
||||
ArduinoOTA.setHostname(OTA_HOSTNAME);
|
||||
ArduinoOTA.onProgress([&](unsigned int progress, unsigned int total){
|
||||
@ -187,7 +187,7 @@ void setup() {
|
||||
ArduinoOTA.begin();
|
||||
|
||||
#ifdef WAIT_FOR_OTA
|
||||
show_status(4);
|
||||
show_status(5);
|
||||
LOGln("Waiting %d seconds for OTA requests...", WAIT_FOR_OTA);
|
||||
unsigned long ota_target_time = millis() + WAIT_FOR_OTA*1000;
|
||||
while (millis() < ota_target_time) {
|
||||
@ -209,6 +209,10 @@ void setup() {
|
||||
display_layout();
|
||||
LOGln("Showing layout is done.");
|
||||
#endif
|
||||
|
||||
for(Corner* corner : corners) {
|
||||
corner->set_color(CRGB::Black);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
Loading…
Reference in New Issue
Block a user