diff --git a/README.adoc b/README.adoc index 737979c..ca6a309 100644 --- a/README.adoc +++ b/README.adoc @@ -171,6 +171,16 @@ to join its network to configure it. The short version is: you reconnect your laptop/phone to your normal network and access esp-link via its hostname or IP address +#### Notes on using AP (access point) mode + +Esp-link does not support STA+AP mode, however it does support STA mode and AP mode. What happens +is that STA+AP mode is used at boot and when making STA changes to allow for recovery: the AP +mode stays on for a while so you can connect to it and fix the STA mode. Once STA has connected, +esp-link switches to STA-only mode. There is no setting to stay in STA+AP mode. So... if you want +to use AP ensure you set esp-link to AP-only mode. If you want STA+AP mode you're gonna have to +modify the source for yourself. (This stuff is painful to test and rather tricky, so don't expect +the way it works to change.) + ### LED indicators Assuming appropriate hardware attached to GPIO pins, the green "conn" LED will show the wifi diff --git a/esp-link/cgiwifi.c b/esp-link/cgiwifi.c index 9dc694a..afb6223 100644 --- a/esp-link/cgiwifi.c +++ b/esp-link/cgiwifi.c @@ -551,30 +551,34 @@ int ICACHE_FLASH_ATTR cgiApSettingsChange(HttpdConnData *connData) { if (checkString(buff) && len>7 && len<=64) { // String preprocessing done in client side, wifiap.js line 31 os_memcpy(apconf.password, buff, len); + os_printf("Setting AP password len=%d\n", len); } else if (len != 0) { jsonHeader(connData, 400); httpdSend(connData, "PASSWORD not valid or out of range", -1); return HTTPD_CGI_DONE; } // Set auth mode - if(len != 0){ + if (len != 0) { // Set authentication mode, before password to check open settings len=httpdFindArg(connData->getArgs, "ap_authmode", buff, sizeof(buff)); - if(len>0){ + if (len > 0) { int value = atoi(buff); - if(value >= 0 && value <= 4){ + if (value > 0 && value <= 4) { apconf.authmode = value; - }else{ + } else { // If out of range set by default + os_printf("Forcing AP authmode to WPA_WPA2_PSK\n"); apconf.authmode = 4; } - }else{ + } else { // Valid password but wrong auth mode, default 4 + os_printf("Forcing AP authmode to WPA_WPA2_PSK\n"); apconf.authmode = 4; } - }else{ + } else { apconf.authmode = 0; } + os_printf("Setting AP authmode=%d\n", apconf.authmode); // Set max connection number len=httpdFindArg(connData->getArgs, "ap_maxconn", buff, sizeof(buff)); if(len>0){ diff --git a/html/wifi/wifiAp.html b/html/wifi/wifiAp.html index e93e54d..41b3697 100644 --- a/html/wifi/wifiAp.html +++ b/html/wifi/wifiAp.html @@ -31,7 +31,6 @@