esp8266-iot-framework icon indicating copy to clipboard operation
esp8266-iot-framework copied to clipboard

Added 2 new functions for better new and forget WiFi Handling

Open marcolino7 opened this issue 2 years ago • 0 comments

In order to have better handling of device when a wifi will be forgot and when a new WiFi will be configured I added 2 new function to WiFiManager. One is

void forgetWiFiFunctionCallback( std::function<void()> func );

and it will be called when a Forget WiFi procedure is completed. Other one is:

void newWiFiFunctionCallback( std::function<void()> func );

and it will be called when new WiFi procedure is completed. This permit better handling on device where I need to change behaviour of the hardware if on device wifi is configured or not.

Example:

void forgetWifiCallBack();
void newWifiCallBack();

void setup()
{
    WiFiManager.begin(configManager.data.projectName);
    WiFiManager.forgetWiFiFunctionCallback(forgetWifiCallBack);
    WiFiManager.newWiFiFunctionCallback(newWifiCallBack);
}

void forgetWifiCallBack(){
    Serial.println("My Forget Wifi CallBack");
}

void newWifiCallBack(){
    Serial.println("My New Wifi CallBack");
}

Documentation also updated.

marcolino7 avatar Mar 01 '22 19:03 marcolino7