snapshot
This commit is contained in:
@@ -31,7 +31,8 @@
|
|||||||
struct WiFiCred { const char *ssid; const char *pass; };
|
struct WiFiCred { const char *ssid; const char *pass; };
|
||||||
WiFiCred wifiNetworks[] = {
|
WiFiCred wifiNetworks[] = {
|
||||||
{ "Dobro Veče", "goodnight" },
|
{ "Dobro Veče", "goodnight" },
|
||||||
{ "iot-2GHz", "lesson-greater" },
|
{ "berylpunk", "dhgwilliam" },
|
||||||
|
// { "iot-2GHz", "lesson-greater" },
|
||||||
};
|
};
|
||||||
const int NUM_WIFI = sizeof(wifiNetworks) / sizeof(wifiNetworks[0]);
|
const int NUM_WIFI = sizeof(wifiNetworks) / sizeof(wifiNetworks[0]);
|
||||||
WiFiMulti wifiMulti;
|
WiFiMulti wifiMulti;
|
||||||
@@ -447,23 +448,45 @@ void parseMessages(String &response, const char *topicName,
|
|||||||
bool networkOK = false;
|
bool networkOK = false;
|
||||||
|
|
||||||
void checkNetwork() {
|
void checkNetwork() {
|
||||||
Serial.printf("[NET] WiFi: %s RSSI: %d IP: %s GW: %s DNS: %s\n",
|
Serial.printf("[NET] WiFi: %s RSSI: %d IP: %s\n",
|
||||||
WiFi.SSID().c_str(),
|
WiFi.SSID().c_str(), WiFi.RSSI(), WiFi.localIP().toString().c_str());
|
||||||
WiFi.RSSI(),
|
Serial.printf("[NET] GW: %s DNS: %s\n",
|
||||||
WiFi.localIP().toString().c_str(),
|
WiFi.gatewayIP().toString().c_str(), WiFi.dnsIP().toString().c_str());
|
||||||
WiFi.gatewayIP().toString().c_str(),
|
|
||||||
WiFi.dnsIP().toString().c_str());
|
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
|
||||||
// Test DNS resolution
|
// Test DNS
|
||||||
IPAddress ip;
|
IPAddress ip;
|
||||||
if (WiFi.hostByName("ntfy.sh", ip)) {
|
if (!WiFi.hostByName("ntfy.sh", ip)) {
|
||||||
Serial.printf("[NET] ntfy.sh resolved to %s\n", ip.toString().c_str());
|
Serial.println("[NET] *** DNS FAILED ***");
|
||||||
|
networkOK = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Serial.printf("[NET] ntfy.sh -> %s\n", ip.toString().c_str());
|
||||||
|
|
||||||
|
// Test TCP connectivity on port 80
|
||||||
|
WiFiClient testClient;
|
||||||
|
Serial.println("[NET] Testing TCP to ntfy.sh:80...");
|
||||||
|
Serial.flush();
|
||||||
|
if (testClient.connect("ntfy.sh", 80, 5000)) {
|
||||||
|
Serial.println("[NET] TCP port 80 OK!");
|
||||||
|
testClient.stop();
|
||||||
networkOK = true;
|
networkOK = true;
|
||||||
} else {
|
} else {
|
||||||
Serial.println("[NET] *** DNS FAILED for ntfy.sh ***");
|
Serial.println("[NET] *** TCP port 80 BLOCKED ***");
|
||||||
networkOK = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test TCP connectivity on port 443
|
||||||
|
WiFiClient testClient2;
|
||||||
|
Serial.println("[NET] Testing TCP to ntfy.sh:443...");
|
||||||
|
Serial.flush();
|
||||||
|
if (testClient2.connect("ntfy.sh", 443, 5000)) {
|
||||||
|
Serial.println("[NET] TCP port 443 OK!");
|
||||||
|
testClient2.stop();
|
||||||
|
networkOK = true;
|
||||||
|
} else {
|
||||||
|
Serial.println("[NET] *** TCP port 443 BLOCKED ***");
|
||||||
|
}
|
||||||
|
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user