Reduce CPU usage at boot time

If many drivers has been enabled, there is a peak of CPU usage at boot time that it is translated as a peak in power consumption. This address to a wifi connection issue in poor power regulated devices like Sonoff Basic R2. This fix reduces cpu usage making the wifi connection to establish faster.
This commit is contained in:
Adrian Scillato 2018-10-31 15:03:47 -03:00 committed by GitHub
parent 9e2df8f38c
commit 5d1f5a40a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -249,6 +249,9 @@ boolean XdrvCall(byte Function)
boolean result = false; boolean result = false;
for (byte x = 0; x < xdrv_present; x++) { for (byte x = 0; x < xdrv_present; x++) {
if (!((WL_CONNECTED == WiFi.status()) && (static_cast<uint32_t>(WiFi.localIP()) != 0))) {
delay(1);
}
result = xdrv_func_ptr[x](Function); result = xdrv_func_ptr[x](Function);
if (result) break; if (result) break;
} }