Merge pull request #4410 from andrethomas/patch-1

Update boot delay code
This commit is contained in:
Theo Arends 2018-11-22 16:23:07 +01:00 committed by GitHub
commit 9ec57e0203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -2778,11 +2778,11 @@ void loop(void)
delay(sleep); // https://github.com/esp8266/Arduino/issues/2021
uint32_t my_activity = millis() - my_sleep;
if (global_state.wifi_down) {
delay(my_activity /2); // Force max of 50% processing vs. yield time while wifi is down
if (my_activity < (uint32_t)Settings.param[P_LOOP_SLEEP_DELAY]) {
delay((uint32_t)Settings.param[P_LOOP_SLEEP_DELAY] - my_activity); // Provide time for background tasks like wifi
} else {
if (my_activity < (uint32_t)Settings.param[P_LOOP_SLEEP_DELAY]) {
delay((uint32_t)Settings.param[P_LOOP_SLEEP_DELAY] - my_activity); // Provide time for background tasks like wifi
if (global_state.wifi_down) {
delay(my_activity /2); // If wifi down and my_activity > setoption36 then force loop delay to 1/3 of my_activity period
}
}
}