diff --git a/WifiControlSensor/WebServer.ino b/WifiControlSensor/WebServer.ino
index f998fc8..03b5ac6 100644
--- a/WifiControlSensor/WebServer.ino
+++ b/WifiControlSensor/WebServer.ino
@@ -6,10 +6,10 @@ String gpioControlHTML = "";
String pwmControlHTML = "";
-void WebBuildGpioObserved(String &html){
- if (NB_ELEMENTS(gpioObserved) > 0){
+void WebBuildGpioObserved(String &html) {
+ if (NB_ELEMENTS(gpioObserved) > 0) {
html += "
" + gpioControlHTML + gpioObserved + pwmControlHTML + ""
""
""
"
"
@@ -185,23 +187,24 @@ void WebHandleSave() {
}
productConfig newConf = {BOOTMODE_NORMAL, strdup(server.arg("ssid").c_str()), strdup(server.arg("password").c_str()),
- strdup(server.arg("host").c_str()), strdup(server.arg("mqttServer").c_str()), strdup(server.arg("mqttUser").c_str()),
- strdup(server.arg("mqttPasswd").c_str()), server.arg("mqttPort").toInt(),
- server.arg("ip_config").toInt(), static_cast(ip), static_cast(gw),
- static_cast(mask), static_cast(dns), static_cast(dns2), server.arg("channel").toInt(), strdup(server.arg("bssid").c_str())};
+ strdup(server.arg("host").c_str()), strdup(server.arg("mqttServer").c_str()), strdup(server.arg("mqttUser").c_str()),
+ strdup(server.arg("mqttPasswd").c_str()), server.arg("mqttPort").toInt(),
+ server.arg("ip_config").toInt(), static_cast(ip), static_cast(gw),
+ static_cast(mask), static_cast(dns), static_cast(dns2), server.arg("channel").toInt(), strdup(server.arg("bssid").c_str())
+ };
if (EepromSaveConfig(newConf) < 0) {
WebSendError("Cannot Save Credentials (Too long ?Contains \";\"?)\r\n");
return;
}
- if(WiFi.softAPIP() != IPAddress((uint32_t)0)){
+ if (WiFi.softAPIP() != IPAddress((uint32_t)0)) {
//In STA mode, we can test the AP connection
WiFi.begin(server.arg("ssid").c_str(), server.arg("password").c_str());
server.send(200, "text/html", "Configuration Saved
"
- "Check Wifi Configuration
"
- "Reboot
");
- }else{
+ "Check Wifi Configuration
"
+ "Reboot
");
+ } else {
server.send(200, "text/html", "Configuration Saved
"
- "Reboot
");
+ "Reboot
");
}
}
@@ -235,7 +238,7 @@ void WebHandleReboot() {
}
String statusToString(wl_status_t status) {
- switch(status){
+ switch (status) {
case WL_IDLE_STATUS: return String("Idle");
case WL_NO_SSID_AVAIL: return String("Wifi not found");
case WL_CONNECTED: return String("Connected");
@@ -249,7 +252,7 @@ String statusToString(wl_status_t status) {
void WebHandleWifiStatus() {
String message;
- if(WiFi.status() == WL_DISCONNECTED)
+ if (WiFi.status() == WL_DISCONNECTED)
message += "";
message += "Wifi Connection Status
";
message += "Connection to ";
@@ -257,21 +260,21 @@ void WebHandleWifiStatus() {
message += ":
";
message += statusToString(WiFi.status());
message += "
";
- if(mode == BOOTMODE_SETUP && WiFi.status() == WL_CONNECTED){
+ if (mode == BOOTMODE_SETUP && WiFi.status() == WL_CONNECTED) {
message += "Wifi correctly setup! You can reboot now
";
message += "Reboot
";
}
- if(WiFi.status() == WL_CONNECT_FAILED || WiFi.status() == WL_NO_SSID_AVAIL){
+ if (WiFi.status() == WL_CONNECT_FAILED || WiFi.status() == WL_NO_SSID_AVAIL) {
message += "Try to reconfigure you WiFi details
";
message += "Enter Setup
";
}
server.send(200, "text/html", message);
}
-void WebBuildGpioControl(){
- if (NB_ELEMENTS(gpioControlled) > 0){
+void WebBuildGpioControl() {
+ if (NB_ELEMENTS(gpioControlled) > 0) {
gpioControlHTML += "