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