Browse Source

Move WIFI status code to its own routine

fastled
Xose Pérez 7 years ago
parent
commit
35c1b9a338
1 changed files with 35 additions and 15 deletions
  1. +35
    -15
      code/espurna/wifi.ino

+ 35
- 15
code/espurna/wifi.ino View File

@ -80,6 +80,39 @@ void wifiConfigure() {
} }
void wifiStatus() {
if ((WiFi.getMode() == WIFI_AP) || (WiFi.getMode() == WIFI_AP_STA)) {
DEBUG_MSG("[WIFI] MODE AP --------------------------------------\n");
DEBUG_MSG("[WIFI] SSID %s\n", jw.getAPSSID().c_str());
DEBUG_MSG("[WIFI] PASS %s\n", getSetting("adminPass", ADMIN_PASS).c_str());
DEBUG_MSG("[WIFI] IP %s\n", WiFi.softAPIP().toString().c_str());
DEBUG_MSG("[WIFI] MAC %s\n", WiFi.softAPmacAddress().c_str());
DEBUG_MSG("[WIFI] ----------------------------------------------\n");
}
if ((WiFi.getMode() == WIFI_STA) || (WiFi.getMode() == WIFI_AP_STA)) {
DEBUG_MSG("[WIFI] MODE STA -------------------------------------\n");
DEBUG_MSG("[WIFI] SSID %s\n", WiFi.SSID().c_str());
DEBUG_MSG("[WIFI] IP %s\n", WiFi.localIP().toString().c_str());
DEBUG_MSG("[WIFI] MAC %s\n", WiFi.macAddress().c_str());
DEBUG_MSG("[WIFI] GW %s\n", WiFi.gatewayIP().toString().c_str());
DEBUG_MSG("[WIFI] MASK %s\n", WiFi.subnetMask().toString().c_str());
DEBUG_MSG("[WIFI] DNS %s\n", WiFi.dnsIP().toString().c_str());
DEBUG_MSG("[WIFI] HOST %s\n", WiFi.hostname().c_str());
DEBUG_MSG("[WIFI] ----------------------------------------------\n");
}
if (WiFi.getMode() == WIFI_OFF) {
DEBUG_MSG("[WIFI] No connection\n");
}
}
void wifiSetup() { void wifiSetup() {
wifiConfigure(); wifiConfigure();
@ -122,24 +155,11 @@ void wifiSetup() {
} }
if (code == MESSAGE_CONNECTED) { if (code == MESSAGE_CONNECTED) {
DEBUG_MSG("[WIFI] MODE STA -------------------------------------\n");
DEBUG_MSG("[WIFI] SSID %s\n", WiFi.SSID().c_str());
DEBUG_MSG("[WIFI] IP %s\n", WiFi.localIP().toString().c_str());
DEBUG_MSG("[WIFI] MAC %s\n", WiFi.macAddress().c_str());
DEBUG_MSG("[WIFI] GW %s\n", WiFi.gatewayIP().toString().c_str());
DEBUG_MSG("[WIFI] MASK %s\n", WiFi.subnetMask().toString().c_str());
DEBUG_MSG("[WIFI] DNS %s\n", WiFi.dnsIP().toString().c_str());
DEBUG_MSG("[WIFI] HOST %s\n", WiFi.hostname().c_str());
DEBUG_MSG("[WIFI] ----------------------------------------------\n");
wifiStatus();
} }
if (code == MESSAGE_ACCESSPOINT_CREATED) { if (code == MESSAGE_ACCESSPOINT_CREATED) {
DEBUG_MSG("[WIFI] MODE AP --------------------------------------\n");
DEBUG_MSG("[WIFI] SSID %s\n", jw.getAPSSID().c_str());
DEBUG_MSG("[WIFI] PASS %s\n", getSetting("adminPass", ADMIN_PASS).c_str());
DEBUG_MSG("[WIFI] IP %s\n", WiFi.softAPIP().toString().c_str());
DEBUG_MSG("[WIFI] MAC %s\n", WiFi.softAPmacAddress().c_str());
DEBUG_MSG("[WIFI] ----------------------------------------------\n");
wifiStatus();
} }
if (code == MESSAGE_DISCONNECTED) { if (code == MESSAGE_DISCONNECTED) {


Loading…
Cancel
Save