diff --git a/ESP32_AP-Flasher/src/contentmanager.cpp b/ESP32_AP-Flasher/src/contentmanager.cpp index 5740895f..954717c5 100644 --- a/ESP32_AP-Flasher/src/contentmanager.cpp +++ b/ESP32_AP-Flasher/src/contentmanager.cpp @@ -94,6 +94,11 @@ void checkVars() { file.close(); } } + if (tag->contentMode == 21) { + if (varDB["ap_tagcount"].changed || varDB["ap_ip"].changed || varDB["ap_ch"].changed) { + tag->nextupdate = 0; + } + } } for (const auto &entry : varDB) { if (entry.second.changed) varDB[entry.first].changed = false; @@ -356,15 +361,8 @@ void drawNew(uint8_t mac[8], bool buttonPressed, tagRecord *&taginfo) { case 21: // ap info drawAPinfo(filename, cfgobj, taginfo, imageParams); - /* - if (imageParams.bpp == 16) { - taginfo->nextupdate = now + 60; - } else { - taginfo->nextupdate = now + 600; - } - */ - taginfo->nextupdate = 3216153600; updateTagImage(filename, mac, 0, taginfo, imageParams); + taginfo->nextupdate = 3216153600; break; } diff --git a/ESP32_AP-Flasher/src/tag_db.cpp b/ESP32_AP-Flasher/src/tag_db.cpp index 66b8cfa3..f98d64de 100644 --- a/ESP32_AP-Flasher/src/tag_db.cpp +++ b/ESP32_AP-Flasher/src/tag_db.cpp @@ -264,17 +264,20 @@ uint32_t getTagCount(uint32_t& timeoutcount) { uint32_t tagcount = 0; time_t now; time(&now); - // Serial.printf("now: %d\n", now); for (uint32_t c = 0; c < tagDB.size(); c++) { tagRecord* taginfo = nullptr; taginfo = tagDB.at(c); if (taginfo->isExternal == false) tagcount++; - int32_t timeout1 = now - taginfo->lastseen; - int32_t timeout2 = taginfo->lastseen - taginfo->expectedNextCheckin; - // Serial.printf("%d expected: %d lastseen: %d -> %d %d\n", c, taginfo->expectedNextCheckin, timeout1, timeout2); - if (((taginfo->expectedNextCheckin < 3600 && timeout1 > 3600) || - (taginfo->expectedNextCheckin > 3600 && timeout2 > 600)) && - now > 3600 && millis() > 60000) timeoutcount++; + int32_t timeout = now - taginfo->lastseen; + if (taginfo->expectedNextCheckin < 3600) { + // not initialised, timeout if not seen last 10 minutes + if (timeout > 600) timeoutcount++; + } else { + if (now - taginfo->expectedNextCheckin > 600) { + //expected checkin is behind, timeout if not seen last 10 minutes + if (timeout > 600) timeoutcount++; + } + } } return tagcount; } diff --git a/ESP32_AP-Flasher/src/web.cpp b/ESP32_AP-Flasher/src/web.cpp index f76b6b27..a1b92e88 100644 --- a/ESP32_AP-Flasher/src/web.cpp +++ b/ESP32_AP-Flasher/src/web.cpp @@ -93,7 +93,7 @@ void wsSendSysteminfo() { uint32_t tagcount = getTagCount(timeoutcount); char result[40]; if (timeoutcount > 0) { - snprintf(result, sizeof(result), "%lu / %lu, %lu timeout", tagcount, tagDB.size(), timeoutcount); + snprintf(result, sizeof(result), "%lu / %lu, %lu timed out", tagcount, tagDB.size(), timeoutcount); } else { snprintf(result, sizeof(result), "%lu / %lu", tagcount, tagDB.size()); }