improve response time on poor wifi connection; Fix NTP time sync.

This commit is contained in:
Moirtz Wagner 2026-01-22 18:54:40 +01:00
parent 9a193e837f
commit e9b307343d

View File

@ -121,7 +121,7 @@ String getLogMessagesAsHtml() {
String getTimestampString(){
struct tm timeinfo;
if(!getLocalTime(&timeinfo)){
if(!getLocalTime(&timeinfo, 1000)){
Serial.println("Failed to obtain time");
return "no time";
}
@ -270,7 +270,7 @@ bool initWifi() {
Serial.println("Connected!");
setenv("TZ", TZ_INFO, 1); // Zeitzone muss nach dem reset neu eingestellt werden
tzset();
configTzTime(TZ_INFO, settingsManager.getAppSettings().ntpServer.c_str(), "pool.ntp.org"); // ESP32 Systemzeit mit NTP Synchronisieren
configTzTime(TZ_INFO, settingsManager.getAppSettings().ntpServer.c_str(),"nas.local","fritz.box"); // ESP32 Systemzeit mit NTP Synchronisieren
// Print ESP32 Local IP Address
Serial.println(WiFi.localIP());
@ -719,7 +719,6 @@ void doScan()
}
break;
case ScanResult::matchFound:
notifyClients( String("Match Found: ") + match.matchId + " - " + match.matchName + " with confidence of " + match.matchConfidence );
if (match.scanResult != lastMatch.scanResult) {
if (checkPairingValid()) {
openDoor(match);
@ -727,14 +726,15 @@ void doScan()
notifyClients("Security issue! Match was not sent by MQTT because of invalid sensor pairing! This could potentially be an attack! If the sensor is new or has been replaced by you do a (re)pairing in settings page.");
}
}
notifyClients( String("Match Found: ") + match.matchId + " - " + match.matchName + " with confidence of " + match.matchConfidence );
break;
case ScanResult::noMatchFound:
notifyClients(String("No Match Found (Code ") + match.returnCode + ")");
if (match.scanResult != lastMatch.scanResult) {
ringBell();
} else {
setCooldown(5000); // wait some time before next scan to let the LED blink
}
notifyClients(String("No Match Found (Code ") + match.returnCode + ")");
break;
case ScanResult::error:
notifyClients(String("ScanResult Error (Code ") + match.returnCode + ")");