Merge branch 'development02' into asyncWeb02

This commit is contained in:
lumapu 2022-08-30 21:43:20 +02:00
commit b871ed06d2
7 changed files with 36 additions and 14 deletions

View file

@ -54,14 +54,18 @@ void app::loop(void) {
mWebInst->loop();
if(checkTicker(&mUptimeTicker, mUptimeInterval)) {
mUptimeSecs++;
if(0 != mTimestamp)
mTimestamp++;
else {
if(!apActive) {
mTimestamp = mWifi->getNtpTime();
DPRINTLN(DBG_INFO, "[NTP]: " + getDateTimeStr(mTimestamp));
}
if(millis() - mPrevMillis >= 1000) {
mPrevMillis += 1000;
mUptimeSecs++;
if(0 != mTimestamp)
mTimestamp++;
}
}
if(checkTicker(&mNtpRefreshTicker, mNtpRefreshInterval)) {
if(!apActive) {
mTimestamp = mWifi->getNtpTime();
DPRINTLN(DBG_INFO, "[NTP]: " + getDateTimeStr(mTimestamp));
}
}
@ -661,7 +665,11 @@ const char* app::getFieldStateClass(uint8_t fieldId) {
void app::resetSystem(void) {
mUptimeSecs = 0;
mUptimeTicker = 0xffffffff;
mUptimeInterval = 1000;
mUptimeInterval = 500; // [ms]
mPrevMillis = 0;
mNtpRefreshTicker = 0;
mNtpRefreshInterval = NTP_REFRESH_INTERVAL; // [ms]
#ifdef AP_ONLY
mTimestamp = 1;