Skip to content

Commit

Permalink
bugfix ap info screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nlimper committed Aug 12, 2023
1 parent 56e1e9e commit 98baa02
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
14 changes: 6 additions & 8 deletions ESP32_AP-Flasher/src/contentmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
17 changes: 10 additions & 7 deletions ESP32_AP-Flasher/src/tag_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ESP32_AP-Flasher/src/web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 98baa02

Please sign in to comment.