I've wanted to make my ESP automatically enter soft ap mode if it can't connect as a station. But, every time it boots, always at least try to connect to its AP.
Every time I've tried, it easily switches and starts broadcasting an AP that my laptop can see, but phone can't. My computer can't associate though it tries. The auth attempts all fail.
If I start it in softap mode, everything works without a hitch.
At 10 hz, the following is performed:
int stat = wifi_station_get_connect_status();
if( stat == STATION_WRONG_PASSWORD || stat == STATION_NO_AP_FOUND || stat == STATION_CONNECT_FAIL )
{
wifi_station_disconnect();
printf( "Connection failed: %d\n", stat );
wifi_set_opmode_current( SOFTAP_MODE );
struct softap_config sc;
wifi_softap_get_config(&sc);
printed_ip = 0;
printf( "SoftAP mode: \"%s\":\"%s\" @ %d %d/%d\n", sc.ssid, sc.password, wifi_get_channel(), sc.ssid_len, wifi_softap_dhcps_status() );
printed_ip = 0;
}
I see it trying to make a new station, but no workie. I've tried restarting the DHCP server, combinations of starting in softap, switching and going back... nothing at all works. Google indicates no one else is trying to do this except me, unless I'm googling the wrong things.
Anyone else having experience with this?