|
@ -87,34 +87,34 @@ void wifiConfigure() { |
|
|
void wifiStatus() { |
|
|
void wifiStatus() { |
|
|
|
|
|
|
|
|
if (WiFi.getMode() == WIFI_AP_STA) { |
|
|
if (WiFi.getMode() == WIFI_AP_STA) { |
|
|
DEBUG_MSG("[WIFI] MODE AP + STA --------------------------------\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MODE AP + STA --------------------------------\n")); |
|
|
} else if (WiFi.getMode() == WIFI_AP) { |
|
|
} else if (WiFi.getMode() == WIFI_AP) { |
|
|
DEBUG_MSG("[WIFI] MODE AP --------------------------------------\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MODE AP --------------------------------------\n")); |
|
|
} else if (WiFi.getMode() == WIFI_STA) { |
|
|
} else if (WiFi.getMode() == WIFI_STA) { |
|
|
DEBUG_MSG("[WIFI] MODE STA -------------------------------------\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MODE STA -------------------------------------\n")); |
|
|
} else { |
|
|
} else { |
|
|
DEBUG_MSG("[WIFI] MODE OFF -------------------------------------\n"); |
|
|
|
|
|
DEBUG_MSG("[WIFI] No connection\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MODE OFF -------------------------------------\n")); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] No connection\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ((WiFi.getMode() & WIFI_AP) == WIFI_AP) { |
|
|
if ((WiFi.getMode() & WIFI_AP) == WIFI_AP) { |
|
|
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_P(PSTR("[WIFI] SSID %s\n"), jw.getAPSSID().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] PASS %s\n"), getSetting("adminPass", ADMIN_PASS).c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] IP %s\n"), WiFi.softAPIP().toString().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MAC %s\n"), WiFi.softAPmacAddress().c_str()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ((WiFi.getMode() & WIFI_STA) == WIFI_STA) { |
|
|
if ((WiFi.getMode() & WIFI_STA) == WIFI_STA) { |
|
|
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_P(PSTR("[WIFI] SSID %s\n"), WiFi.SSID().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] IP %s\n"), WiFi.localIP().toString().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MAC %s\n"), WiFi.macAddress().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] GW %s\n"), WiFi.gatewayIP().toString().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] DNS %s\n"), WiFi.dnsIP().toString().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] MASK %s\n"), WiFi.subnetMask().toString().c_str()); |
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] HOST %s\n"), WiFi.hostname().c_str()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DEBUG_MSG("[WIFI] ----------------------------------------------\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] ----------------------------------------------\n")); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -128,27 +128,27 @@ void wifiSetup() { |
|
|
#ifdef DEBUG_PORT
|
|
|
#ifdef DEBUG_PORT
|
|
|
|
|
|
|
|
|
if (code == MESSAGE_SCANNING) { |
|
|
if (code == MESSAGE_SCANNING) { |
|
|
DEBUG_MSG("[WIFI] Scanning\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Scanning\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_SCAN_FAILED) { |
|
|
if (code == MESSAGE_SCAN_FAILED) { |
|
|
DEBUG_MSG("[WIFI] Scan failed\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Scan failed\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_NO_NETWORKS) { |
|
|
if (code == MESSAGE_NO_NETWORKS) { |
|
|
DEBUG_MSG("[WIFI] No networks found\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] No networks found\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_NO_KNOWN_NETWORKS) { |
|
|
if (code == MESSAGE_NO_KNOWN_NETWORKS) { |
|
|
DEBUG_MSG("[WIFI] No known networks found\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] No known networks found\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_FOUND_NETWORK) { |
|
|
if (code == MESSAGE_FOUND_NETWORK) { |
|
|
DEBUG_MSG("[WIFI] %s\n", parameter); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] %s\n"), parameter); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_CONNECTING) { |
|
|
if (code == MESSAGE_CONNECTING) { |
|
|
DEBUG_MSG("[WIFI] Connecting to %s\n", parameter); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Connecting to %s\n"), parameter); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_CONNECT_WAITING) { |
|
|
if (code == MESSAGE_CONNECT_WAITING) { |
|
@ -156,7 +156,7 @@ void wifiSetup() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_CONNECT_FAILED) { |
|
|
if (code == MESSAGE_CONNECT_FAILED) { |
|
|
DEBUG_MSG("[WIFI] Could not connect to %s\n", parameter); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Could not connect to %s\n"), parameter); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_CONNECTED) { |
|
|
if (code == MESSAGE_CONNECTED) { |
|
@ -168,15 +168,15 @@ void wifiSetup() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_DISCONNECTED) { |
|
|
if (code == MESSAGE_DISCONNECTED) { |
|
|
DEBUG_MSG("[WIFI] Disconnected\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Disconnected\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_ACCESSPOINT_CREATING) { |
|
|
if (code == MESSAGE_ACCESSPOINT_CREATING) { |
|
|
DEBUG_MSG("[WIFI] Creating access point\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Creating access point\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (code == MESSAGE_ACCESSPOINT_FAILED) { |
|
|
if (code == MESSAGE_ACCESSPOINT_FAILED) { |
|
|
DEBUG_MSG("[WIFI] Could not create access point\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[WIFI] Could not create access point\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif
|
|
|
#endif
|
|
@ -185,9 +185,9 @@ void wifiSetup() { |
|
|
if (code == MESSAGE_CONNECTED) { |
|
|
if (code == MESSAGE_CONNECTED) { |
|
|
if (MDNS.begin((char *) WiFi.hostname().c_str())) { |
|
|
if (MDNS.begin((char *) WiFi.hostname().c_str())) { |
|
|
MDNS.addService("http", "tcp", 80); |
|
|
MDNS.addService("http", "tcp", 80); |
|
|
DEBUG_MSG("[MDNS] OK\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[MDNS] OK\n")); |
|
|
} else { |
|
|
} else { |
|
|
DEBUG_MSG("[MDNS] FAIL\n"); |
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[MDNS] FAIL\n")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|