I have all of this working. However, where I run in to problems is that once the wifi starts the connection process to the router, I start to see tons of dropped packets on the soft AP ip. The connection normally stays open long enough for the new ip address to get sent, but not always. I would like this to be fool proof since I plan on giving it to people.
This is what I run in the setup:
WiFi.mode(WIFI_AP_STA);
boolean result = WiFi.softAP("motion-sensor", "password", 8);
if(result == true) {
Serial.println("Ready");
} else {
Serial.println("Starting soft-AP Failed! Rebooting...");
delay(5000);
ESP.restart();
}
When my modest HTTP server receives an HTTP POST with the wifi credentials I run the following which is exactly when I start to see dropped packets:
WiFi.begin(ssid.c_str(), password.c_str());
I have read that the channel can cause issues if its heavily used in your area. I have it set on channel 8 because it looked like it had the least amount of overlap from my scans.
As I mentioned, this works probably 85% of the time if not more, but I would really like to figure out why I get so many dropped packets once both the soft ap and the station are active.