NTP, send Voltage to Frontend
This commit is contained in:
@@ -8,12 +8,14 @@
|
||||
|
||||
#include "licenceing.h"
|
||||
#include "master.h"
|
||||
#include "timesync.h"
|
||||
|
||||
String uniqueSSID;
|
||||
|
||||
PrettyOTA OTAUpdates;
|
||||
|
||||
String getUniqueSSID();
|
||||
bool isInternetAvailable();
|
||||
|
||||
// Initialisiert das WLAN als Access Point oder Station und startet mDNS/OTA.
|
||||
void setupWifi() {
|
||||
@@ -48,6 +50,9 @@ void setupWifi() {
|
||||
Serial.println("Erfolgreich mit WLAN verbunden!");
|
||||
Serial.print("IP Adresse: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
if (isInternetAvailable) {
|
||||
syncTimeWithNTP();
|
||||
} // Synchronisiere Zeit mit NTP
|
||||
}
|
||||
|
||||
// Only wait for connection if ssidSTA and passwordSTA are set
|
||||
@@ -95,4 +100,9 @@ String getUniqueSSID() {
|
||||
return String("AquaCross-") + String(uniqueId);
|
||||
}
|
||||
|
||||
// WiFi als Access Point
|
||||
// Prüft, ob das Internet erreichbar ist (z.B. durch Ping auf 8.8.8.8)
|
||||
bool isInternetAvailable() {
|
||||
WiFiClient client;
|
||||
// Versuche, eine Verbindung zu Googles DNS auf Port 53 herzustellen
|
||||
return client.connect("8.8.8.8", 53);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user