mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Add callback for OTA update (#1286)
This commit is contained in:
@@ -2629,6 +2629,15 @@ void WiFiManager::setPreSaveConfigCallback( std::function<void()> func ) {
|
||||
_presavecallback = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* setPreOtaUpdateCallback, set a callback to fire before OTA update
|
||||
* @access public
|
||||
* @param {[type]} void (*func)(void)
|
||||
*/
|
||||
void WiFiManager::setPreOtaUpdateCallback( std::function<void()> func ) {
|
||||
_preotaupdatecallback = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* set custom head html
|
||||
* custom element will be added to head, eg. new style tag etc.
|
||||
@@ -3587,6 +3596,10 @@ void WiFiManager::handleUpdating(){
|
||||
if(_debug) Serial.setDebugOutput(true);
|
||||
uint32_t maxSketchSpace;
|
||||
|
||||
// Use new callback for before OTA update
|
||||
if (_preotaupdatecallback != NULL) {
|
||||
_preotaupdatecallback();
|
||||
}
|
||||
#ifdef ESP8266
|
||||
WiFiUDP::stopAll();
|
||||
maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
|
||||
|
||||
Reference in New Issue
Block a user