justwifi
justwifi copied to clipboard
Fallback mode sets AP+STA rather than AP
If there are no networks defined, the WiFiMode will be set to WIFI_AP. If there are any networks defined, but none of the known networks are found in the scan the state machine moves into STATE_FALLBACK, and the WiFiMode gets set to WIFI_AP_STA.
Is this intentional or a bug?
In my situation, WIFI_AP_STA prevents clients from connecting to the AP, while WIFI_AP allows connection of the same clients.
I can get the behavior I want by changing the fallback state code to
case STATE_FALLBACK:
WiFi.enableSTA(false);
if (!_ap_connected & _ap_fallback_enabled) _doAP();
_timeout = millis();
_state = STATE_IDLE;
break;
This results in WiFiMode=WIFI_AP after a fallback (the same as with no networks defined) until the timeout is reached, whereupon it rescans and looks for known networks again. WiFi.enableSTA(true) gets called during scanning, so I dont think there is lasting harm.
If there is a way to set the jw configuration to get this behavior, I cant seem to find it.