From 5995df787d0c99d016d2f81471308ab2e6bac2d3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zimon Date: Thu, 11 Jul 2019 17:40:31 +0000 Subject: [PATCH] add soft-ap channel option fix for #345 and #453 Signed-off-by: Bartlomiej Zimon --- esp-link/cgiwifi.c | 13 +++++++++++++ html/wifi/wifiAp.html | 6 ++++++ html/wifi/wifiAp.js | 1 + 3 files changed, 20 insertions(+) diff --git a/esp-link/cgiwifi.c b/esp-link/cgiwifi.c index 8ae7e3a..9a0ea62 100644 --- a/esp-link/cgiwifi.c +++ b/esp-link/cgiwifi.c @@ -640,6 +640,17 @@ int ICACHE_FLASH_ATTR cgiApSettingsChange(HttpdConnData *connData) { apconf.ssid_hidden = 0; } } + // Set channel to be hidden or not + len=httpdFindArg(connData->getArgs, "ap_channel", buff, sizeof(buff)); + if(len>0){ + int value = atoi(buff); + if(value >= 1 || value <= 13){ + apconf.channel = value; + }else{ + // If out of range, set by default + apconf.channel = 1; + } + } // Store new configuration wifi_softap_set_config(&apconf); @@ -659,6 +670,7 @@ int ICACHE_FLASH_ATTR cgiApSettingsInfo(HttpdConnData *connData) { "\"ap_authmode\": %d, " "\"ap_maxconn\": %d, " "\"ap_beacon\": %d, " + "\"ap_channel\": %d, " "\"ap_hidden\": \"%s\" " " }", apconf.ssid, @@ -666,6 +678,7 @@ int ICACHE_FLASH_ATTR cgiApSettingsInfo(HttpdConnData *connData) { apconf.authmode, apconf.max_connection, apconf.beacon_interval, + apconf.channel, apconf.ssid_hidden ? "enabled" : "disabled" ); diff --git a/html/wifi/wifiAp.html b/html/wifi/wifiAp.html index 41b3697..e61c341 100644 --- a/html/wifi/wifiAp.html +++ b/html/wifi/wifiAp.html @@ -69,6 +69,12 @@ +
+ + + +
+
diff --git a/html/wifi/wifiAp.js b/html/wifi/wifiAp.js index 59dd6ce..50b2c24 100644 --- a/html/wifi/wifiAp.js +++ b/html/wifi/wifiAp.js @@ -3,6 +3,7 @@ specials["ap_ssid"] = "SSID name"; specials["ap_password"] = "PASSWORD"; specials["ap_maxconn"] = "Max Connections number"; specials["ap_beacon"] = "Beacon Interval"; +specials["ap_channel"] = "Channel"; function changeWifiMode(m) { blockScan = 1;