From 02dc8f292d3602d930c20e77846c78a78e7fb0fe Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Sat, 16 Feb 2019 01:50:11 +0900 Subject: [PATCH] Improved code readability --- examples/mqttRSSI/mqttRSSI.ino | 22 +++++++++++----------- examples/mqttRSSI_FS/mqttRSSI_FS.ino | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/mqttRSSI/mqttRSSI.ino b/examples/mqttRSSI/mqttRSSI.ino index 94ba6c2..01cf4ff 100644 --- a/examples/mqttRSSI/mqttRSSI.ino +++ b/examples/mqttRSSI/mqttRSSI.ino @@ -315,8 +315,8 @@ void handleRoot() { "" ""; - WiFiWebServer& server = portal.host(); - server.send(200, "text/html", content); + WiFiWebServer& webServer = portal.host(); + webServer.send(200, "text/html", content); } // Clear channel using ThingSpeak's API. @@ -339,11 +339,11 @@ void handleClearChannel() { Serial.println(" failed"); // Returns the redirect response. - WiFiWebServer& server = portal.host(); - server.sendHeader("Location", String("http://") + server.client().localIP().toString() + String("/")); - server.send(302, "text/plain", ""); - server.client().flush(); - server.client().stop(); + WiFiWebServer& webServer = portal.host(); + webServer.sendHeader("Location", String("http://") + webServer.client().localIP().toString() + String("/")); + webServer.send(302, "text/plain", ""); + webServer.client().flush(); + webServer.client().stop(); } void setup() { @@ -387,12 +387,13 @@ void setup() { } } - WiFiWebServer& server = portal.host(); - server.on("/", handleRoot); - server.on(AUX_CLEAR_URI, handleClearChannel); + WiFiWebServer& webServer = portal.host(); + webServer.on("/", handleRoot); + webServer.on(AUX_CLEAR_URI, handleClearChannel); } void loop() { + portal.handleClient(); if (updateInterval > 0) { if (millis() - lastPub > updateInterval) { if (!mqttClient.connected()) { @@ -404,5 +405,4 @@ void loop() { lastPub = millis(); } } - portal.handleClient(); } diff --git a/examples/mqttRSSI_FS/mqttRSSI_FS.ino b/examples/mqttRSSI_FS/mqttRSSI_FS.ino index a0c2ed0..e61ff17 100644 --- a/examples/mqttRSSI_FS/mqttRSSI_FS.ino +++ b/examples/mqttRSSI_FS/mqttRSSI_FS.ino @@ -173,8 +173,8 @@ void handleRoot() { "" ""; - WiFiWebServer& server = portal.host(); - server.send(200, "text/html", content); + WiFiWebServer& webServer = portal.host(); + webServer.send(200, "text/html", content); } // Clear channel using Thingspeak's API. @@ -198,11 +198,11 @@ void handleClearChannel() { // Returns the redirect response. The page is reloaded and its contents // are updated to the state after deletion. - WiFiWebServer& server = portal.host(); - server.sendHeader("Location", String("http://") + server.client().localIP().toString() + String("/")); - server.send(302, "text/plain", ""); - server.client().flush(); - server.client().stop(); + WiFiWebServer& webServer = portal.host(); + webServer.sendHeader("Location", String("http://") + webServer.client().localIP().toString() + String("/")); + webServer.send(302, "text/plain", ""); + webServer.client().flush(); + webServer.client().stop(); } // Load AutoConnectAux JSON from SPIFFS. @@ -264,12 +264,13 @@ void setup() { } } - WiFiWebServer& server = portal.host(); - server.on("/", handleRoot); - server.on(AUX_MQTTCLEAR, handleClearChannel); + WiFiWebServer& webServer = portal.host(); + webServer.on("/", handleRoot); + webServer.on(AUX_MQTTCLEAR, handleClearChannel); } void loop() { + portal.handleClient(); if (updateInterval > 0) { if (millis() - lastPub > updateInterval) { if (!mqttClient.connected()) { @@ -281,5 +282,4 @@ void loop() { lastPub = millis(); } } - portal.handleClient(); }