Fix Sonoff Pow R2 and Sonoff S31

Fix Sonoff Pow R2 and Sonoff S31 Serial interface hang caused by Sonoff Basic R2 driver delay implementation (and possibly core bug)
This commit is contained in:
Theo Arends 2018-11-11 17:58:18 +01:00
parent 0868c72140
commit c0cfdde8ac
4 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* 6.3.0.7 20181111 /* 6.3.0.7 20181111
* Fix wifi connection errors using wifi disconnect and ESP.reset instead of ESP.restart * Fix wifi connection errors using wifi disconnect and ESP.reset instead of ESP.restart
* Fix Sonoff Pow R2 and Sonoff S31 Serial interface hang caused by MP3 driver * Fix Sonoff Pow R2 and Sonoff S31 Serial interface hang caused by Sonoff Basic R2 driver delay implementation (and possibly core bug)
* *
* 6.3.0.6 20181110 * 6.3.0.6 20181110
* Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40% * Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40%

View File

@ -765,6 +765,15 @@ uint8_t ValidGPIO(uint8_t pin, uint8_t gpio)
return result; return result;
} }
void AppDelay()
{
if (APP_BAUDRATE == baudrate) { // When baudrate too low it will fail on Sonoff Pow R2 and S31 serial interface initialization
if (global_state.wifi_down) {
delay(DRIVER_BOOT_DELAY);
}
}
}
/*********************************************************************************************\ /*********************************************************************************************\
* Sleep aware time scheduler functions borrowed from ESPEasy * Sleep aware time scheduler functions borrowed from ESPEasy
\*********************************************************************************************/ \*********************************************************************************************/

View File

@ -238,7 +238,7 @@ 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 (global_state.wifi_down) { delay(DRIVER_BOOT_DELAY); } AppDelay();
result = xdrv_func_ptr[x](Function); result = xdrv_func_ptr[x](Function);
if (result) break; if (result) break;
} }

View File

@ -568,7 +568,7 @@ boolean XsnsNextCall(byte Function)
xsns_index++; xsns_index++;
if (xsns_index == xsns_present) { xsns_index = 0; } if (xsns_index == xsns_present) { xsns_index = 0; }
} }
if (global_state.wifi_down) { delay(DRIVER_BOOT_DELAY); } AppDelay();
return xsns_func_ptr[xsns_index](Function); return xsns_func_ptr[xsns_index](Function);
} }
@ -586,7 +586,7 @@ boolean XsnsCall(byte Function)
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND #ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND
uint32_t profile_start_millis = millis(); uint32_t profile_start_millis = millis();
#endif // PROFILE_XSNS_SENSOR_EVERY_SECOND #endif // PROFILE_XSNS_SENSOR_EVERY_SECOND
if (global_state.wifi_down) { delay(DRIVER_BOOT_DELAY); } AppDelay();
result = xsns_func_ptr[x](Function); result = xsns_func_ptr[x](Function);
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND #ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND