B4R Question ESP8266 Reset WiFi settings

janderkan

Active Member
Licensed User
There are a lot of post about it:
https://www.b4x.com/android/forum/threads/esp8266-wifi-and-socket.69164/#post-438940
https://www.b4x.com/android/forum/threads/not-possible-to-remove-wemos-mini-accesspoint.72501/
https://www.b4x.com/android/forum/threads/wifi-library-and-wifi-startaccesspoint.77655/#content
https://www.b4x.com/android/forum/threads/can-an-accesspoint-be-stopped-without-powering-down.106363/#post-665913
These posts helped many but unfortunately not me.
If I once had started an access point on my ESp8266, it would continue to start the AP every time I turned ESP on.
Now I found the solution for me.
Esp8266 from different vendors have different default settings.
The important setting is PERSISTENT.
https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/generic-class.html#persistent
If this is set to True, all wifi settings will be the same on boot up.
This is what helped me:
B4X:
private Sub ResetWifi
    RunNative("StopPersistent",Null)
    RunNative("StopAP",Null)
End Sub

#if C
void StopAP(B4R::Object* o) {
     WiFi.softAPdisconnect(true);
}
void StopPersistent(B4R::Object* o) {
     WiFi.persistent(false);
}
#end if
 
Top