diff --git a/WifiControlSensor/EEPROM.h b/WifiControlSensor/EEPROM.h
index 663173d..ac7f36d 100644
--- a/WifiControlSensor/EEPROM.h
+++ b/WifiControlSensor/EEPROM.h
@@ -15,6 +15,9 @@ typedef struct productConfig_t {
uint32_t mask;
uint32_t dns;
uint32_t dns2;
+ int32_t channel;
+ char *bssid;
+
} productConfig;
int EepromSaveConfig(productConfig &config);
diff --git a/WifiControlSensor/EEPROM.ino b/WifiControlSensor/EEPROM.ino
index 0ae00a4..92cf7a6 100644
--- a/WifiControlSensor/EEPROM.ino
+++ b/WifiControlSensor/EEPROM.ino
@@ -1,5 +1,5 @@
/* EEPROM LAYOUT
- "BOOTMODE;SSID;PASSWORD;HOSTNAME;MQTT_SERVER;MQTT_USERNAME;MQTT_PASSWD;MQTT_PORT;IP_CONFIG;IP;GATEWAY;NETMASK;DNS1;DNS2;"
+ "BOOTMODE;SSID;PASSWORD;HOSTNAME;MQTT_SERVER;MQTT_USERNAME;MQTT_PASSWD;MQTT_PORT;IP_CONFIG;IP;GATEWAY;NETMASK;DNS1;DNS2;WIFI_CHANNEL;WIFI_BSSID;"
BOOTMODE could be 0 for Setup, 1 for normal use, 2 for OTA
IP_CONFIG could be 0 for DHCP, 1 for static
Setup mode is trigger by setting GPIO3 to ground or at first boot
@@ -17,7 +17,8 @@ int EepromSaveConfig(productConfig &config) {
+ String(config.mqttPort) + ";"
+ String(config.ip_mode) + ";"
+ config.ip + ";" + config.gw + ";" + config.mask + ";"
- + config.dns + ";" + config.dns2 + ";";
+ + config.dns + ";" + config.dns2 + ";" + config.channel + ";"
+ + config.bssid + ";";
if (eeprom.length() > CONFIG_EEPROM_SIZE )
return -EMSGSIZE;
@@ -95,5 +96,8 @@ void EepromReadConfig(productConfig &config) {
config.dns = atoi(tmpString);
readConfElement(&tmpString, i);
config.dns2 = atoi(tmpString);
+ readConfElement(&tmpString, i);
+ config.channel = atoi(tmpString);
+ readConfElement(&config.bssid, i);
}
diff --git a/WifiControlSensor/WebServer.ino b/WifiControlSensor/WebServer.ino
index 50eb32d..f998fc8 100644
--- a/WifiControlSensor/WebServer.ino
+++ b/WifiControlSensor/WebServer.ino
@@ -19,8 +19,12 @@ void WebBuildGpioObserved(String &html){
}
void WebHandleRoot() {
String gpioObserved = "";
+ String optimiseConfig = "";
WebBuildGpioObserved(gpioObserved);
+ if(WiFi.status() == WL_CONNECTED){
+ optimiseConfig = "Optimize Config
";
+ }
server.send(200, "text/html",
"