1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Add ArduinoOTAClass::end() (#8379)

This adds the end() function for the ArduinoOTA class.

ESP32 has this implemented, however ESP8266 was lacking this.
This commit is contained in:
Phil1pp 2021-12-02 22:49:42 +01:00 committed by GitHub
parent 7fc43b6ddd
commit 0af18ab313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -349,6 +349,18 @@ void ArduinoOTAClass::_runUpdate() {
}
}
void ArduinoOTAClass::end() {
_initialized = false;
_udp_ota->unref();
_udp_ota = 0;
if(_useMDNS){
MDNS.end();
}
_state = OTA_IDLE;
#ifdef OTA_DEBUG
OTA_DEBUG.printf("OTA server stopped.\n");
#endif
}
//this needs to be called in the loop()
void ArduinoOTAClass::handle() {
if (_state == OTA_RUNUPDATE) {

View File

@ -62,6 +62,8 @@ class ArduinoOTAClass
//Starts the ArduinoOTA service
void begin(bool useMDNS = true);
//Ends the ArduinoOTA service
void end();
//Call this in loop() to run the service. Also calls MDNS.update() when begin() or begin(true) is used.
void handle();