| 101 | } |
| 102 | |
| 103 | void checkVars() { |
| 104 | JsonDocument cfgobj; |
| 105 | for (tagRecord *tag : tagDB) { |
| 106 | if (tag->contentMode == 19) { |
| 107 | deserializeJson(cfgobj, tag->modeConfigJson); |
| 108 | const String jsonfile = cfgobj["filename"].as<String>(); |
| 109 | if (!util::isEmptyOrNull(jsonfile)) { |
| 110 | File file = contentFS->open(jsonfile, "r"); |
| 111 | if (file) { |
| 112 | const size_t fileSize = file.size(); |
| 113 | std::unique_ptr<char[]> fileContent(new char[fileSize + 1]); |
| 114 | file.readBytes(fileContent.get(), fileSize); |
| 115 | file.close(); |
| 116 | fileContent[fileSize] = '\0'; |
| 117 | const char *contentPtr = fileContent.get(); |
| 118 | for (const auto &entry : varDB) { |
| 119 | if (entry.second.changed && strstr(contentPtr, entry.first.c_str()) != nullptr) { |
| 120 | Serial.println("updating " + jsonfile + " because of var " + entry.first.c_str()); |
| 121 | tag->nextupdate = 0; |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | file.close(); |
| 126 | } |
| 127 | } |
| 128 | if (tag->contentMode == 21) { |
| 129 | if (varDB["ap_tagcount"].changed || varDB["ap_ip"].changed || varDB["ap_ch"].changed) { |
| 130 | tag->nextupdate = 0; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | for (const auto &entry : varDB) { |
| 135 | if (entry.second.changed) varDB[entry.first].changed = false; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | /// @brief Draw a counter |
| 140 | /// @param mac Destination mac |