Here is some stuff I dug up but haven’t had a chance to check because I don’t need the functionality right now.
To summarize what I think I read, certain flags in the original code became true and don’t get changed.
For instance, if you have called WiFi.softAP() once, the flag will be true, and WiFi.begin() will consider it and set the mode to WIFI_AP_STA (as opposed to WIFI_AP if the flag wasn’t set, which happens to be the default).
From the second link:
Links2004 commented on Aug 9
yes WiFi.mode(WIFI_STA); goes to STA mode only.
what version do you use. this behavior is changed 27 days ago.
see 6233977 and #529
WiFi.softAPdisconnect(true); shut work too, the difference to WiFi.mode(WIFI_STA); is its delete the AP config complete form the espressif config memory.
WiFi.softAPdisconnect(true) seems like a good possible option. If you are using a library from prior to middle of July this functionality won’t work.