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
|
## Startup sequence
|
||||||
|
|
||||||
During startup:
|
During startup:
|
||||||
* 1 green corner: FastLED is initialized. Layout is now being analyzed.
|
* 1 green corner: FastLED is initialized.
|
||||||
* 2 green corners: Layout is done. WiFi is being connected.
|
* 2 green corners: WiFi is connecting...
|
||||||
* 3 green corners: WiFi connection established. Connecting to MQTT server.
|
* 3 green corners: Layout is analyzed...
|
||||||
* 4 green corners (only if OTA_DELAY is set): Waiting for an OTA connection.
|
* 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.
|
* 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) {
|
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;
|
uint16_t old_cbs = color_blend_state >= effect_speed ? color_blend_state - effect_speed : 0;
|
||||||
return (old_cbs < level && color_blend_state >= level);
|
return (old_cbs < level && color_blend_state >= level);
|
||||||
}
|
}
|
||||||
|
12
src/main.cpp
12
src/main.cpp
@ -167,16 +167,16 @@ void setup() {
|
|||||||
setup_fastled();
|
setup_fastled();
|
||||||
show_status(1);
|
show_status(1);
|
||||||
|
|
||||||
setup_layout();
|
|
||||||
show_status(2);
|
|
||||||
|
|
||||||
#ifdef TEST_MODE
|
#ifdef TEST_MODE
|
||||||
LOGln("TEST_MODE is active!");
|
LOGln("TEST_MODE is active!");
|
||||||
#else
|
#else
|
||||||
|
show_status(2);
|
||||||
wifi_setup();
|
wifi_setup();
|
||||||
|
|
||||||
show_status(3);
|
show_status(3);
|
||||||
|
setup_layout();
|
||||||
|
|
||||||
|
show_status(4);
|
||||||
mqtt_setup();
|
mqtt_setup();
|
||||||
ArduinoOTA.setHostname(OTA_HOSTNAME);
|
ArduinoOTA.setHostname(OTA_HOSTNAME);
|
||||||
ArduinoOTA.onProgress([&](unsigned int progress, unsigned int total){
|
ArduinoOTA.onProgress([&](unsigned int progress, unsigned int total){
|
||||||
@ -187,7 +187,7 @@ void setup() {
|
|||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
|
|
||||||
#ifdef WAIT_FOR_OTA
|
#ifdef WAIT_FOR_OTA
|
||||||
show_status(4);
|
show_status(5);
|
||||||
LOGln("Waiting %d seconds for OTA requests...", WAIT_FOR_OTA);
|
LOGln("Waiting %d seconds for OTA requests...", WAIT_FOR_OTA);
|
||||||
unsigned long ota_target_time = millis() + WAIT_FOR_OTA*1000;
|
unsigned long ota_target_time = millis() + WAIT_FOR_OTA*1000;
|
||||||
while (millis() < ota_target_time) {
|
while (millis() < ota_target_time) {
|
||||||
@ -209,6 +209,10 @@ void setup() {
|
|||||||
display_layout();
|
display_layout();
|
||||||
LOGln("Showing layout is done.");
|
LOGln("Showing layout is done.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for(Corner* corner : corners) {
|
||||||
|
corner->set_color(CRGB::Black);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
Loading…
Reference in New Issue
Block a user