From 03080b1d7dabceafd754240d2a0f11dc127832f8 Mon Sep 17 00:00:00 2001 From: lumapu Date: Thu, 15 Dec 2022 21:32:16 +0100 Subject: [PATCH] implemented fixes of #483 --- src/web/html/index.html | 5 ++--- src/wifi/ahoywifi.cpp | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/web/html/index.html b/src/web/html/index.html index 22d7650b..54f99e48 100644 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -191,10 +191,9 @@ } function tick() { - ++tickCnt; if(0 != ts) - document.getElementById("date").innerHTML = (new Date((ts+tickCnt) * 1000)).toLocaleString('de-DE'); - if(tickCnt >= 10) { + document.getElementById("date").innerHTML = (new Date((++ts) * 1000)).toLocaleString('de-DE'); + if(++tickCnt >= 10) { tickCnt = 0; getAjax('/api/index', parse); } diff --git a/src/wifi/ahoywifi.cpp b/src/wifi/ahoywifi.cpp index a002ac78..eb7cb1e5 100644 --- a/src/wifi/ahoywifi.cpp +++ b/src/wifi/ahoywifi.cpp @@ -221,6 +221,7 @@ void ahoywifi::sendNTPpacket(IPAddress& address) { if(mConnected) { mConnected = false; mReconnect = true; + mCnt = 0; DPRINTLN(DBG_INFO, "[WiFi] Connection Lost"); } } @@ -239,13 +240,15 @@ void ahoywifi::sendNTPpacket(IPAddress& address) { WiFi.begin(); DBGPRINTLN(F("[WiFi] AP disabled")); mDns.stop(); - + mReconnect = false; } break; case SYSTEM_EVENT_STA_DISCONNECTED: if(mConnected) { mConnected = false; + mReconnect = true; + mCnt = 0; DPRINTLN(DBG_INFO, "[WiFi] Connection Lost"); } break;