Fix Arduino_OTA compile error

Fix Arduino_OTA compile error (#7413)
This commit is contained in:
Theo Arends 2020-01-03 16:50:56 +01:00
parent d473d8068a
commit 8c2ff7237e
2 changed files with 12 additions and 5 deletions

View File

@ -1000,7 +1000,9 @@ void ArduinoOTAInit(void)
{
ArduinoOTA.setPort(8266);
ArduinoOTA.setHostname(my_hostname);
if (strlen(SettingsText(SET_WEBPWD))) { ArduinoOTA.setPassword(SettingsText(SET_WEBPWD)); }
if (strlen(SettingsText(SET_WEBPWD))) {
ArduinoOTA.setPassword(SettingsText(SET_WEBPWD));
}
ArduinoOTA.onStart([]()
{
@ -1059,6 +1061,14 @@ void ArduinoOTAInit(void)
ArduinoOTA.begin();
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266"));
}
void ArduinoOtaLoop(void)
{
MDNS.update();
ArduinoOTA.handle();
// Once OTA is triggered, only handle that and dont do other stuff. (otherwise it fails)
while (arduino_ota_triggered) { ArduinoOTA.handle(); }
}
#endif // USE_ARDUINO_OTA
/********************************************************************************************/

View File

@ -405,10 +405,7 @@ void loop(void)
if (!serial_local) { SerialInput(); }
#ifdef USE_ARDUINO_OTA
MDNS.update();
ArduinoOTA.handle();
// Once OTA is triggered, only handle that and dont do other stuff. (otherwise it fails)
while (arduino_ota_triggered) ArduinoOTA.handle();
ArduinoOtaLoop();
#endif // USE_ARDUINO_OTA
uint32_t my_activity = millis() - my_sleep;