MCPcopy Create free account
hub / github.com/OpenEPaperLink/OpenEPaperLink / wsSendSysteminfo

Function wsSendSysteminfo

ESP32_AP-Flasher/src/web.cpp:107–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void wsSendSysteminfo() {
108 JsonDocument doc;
109 JsonObject sys = doc["sys"].to<JsonObject>();
110 time_t now;
111 time(&now);
112 static int freeSpaceLastRun = 0;
113 static size_t tagDBsize = 0;
114 static uint64_t freeSpace = Storage.freeSpace();
115
116 sys["currtime"] = now;
117 sys["heap"] = ESP.getFreeHeap();
118 sys["recordcount"] = tagDBsize;
119 sys["dbsize"] = dbSize();
120
121 if (millis() - freeSpaceLastRun > 30000 || freeSpaceLastRun == 0) {
122 freeSpace = Storage.freeSpace();
123 tagDBsize = tagDB.size();
124 freeSpaceLastRun = millis();
125 }
126 sys["littlefsfree"] = freeSpace;
127
128#if BOARD_HAS_PSRAM
129 sys["psfree"] = ESP.getFreePsram();
130#endif
131
132 sys["apstate"] = apInfo.state;
133 sys["runstate"] = config.runStatus;
134 sys["rssi"] = WiFi.RSSI();
135 sys["wifistatus"] = WiFi.status();
136 sys["wifissid"] = WiFi.SSID();
137 sys["uptime"] = esp_timer_get_time() / 1000000;
138
139 static uint8_t day = 0;
140 struct tm timeinfo;
141 localtime_r(&now, &timeinfo);
142
143 if (day != timeinfo.tm_mday) {
144 day = timeinfo.tm_mday;
145 char timeBuffer[80];
146 strftime(timeBuffer, sizeof(timeBuffer), languageDateFormat[0].c_str(), &timeinfo);
147 setVarDB("ap_date", timeBuffer);
148 }
149 setVarDB("ap_ip", wm.localIP().toString());
150
151#ifdef HAS_SUBGHZ
152 String ApChanString = String(apInfo.channel);
153 if(apInfo.hasSubGhz) {
154 ApChanString += ", SubGhz ";
155 if(apInfo.SubGhzChannel == 0) {
156 ApChanString += "disabled";
157 }
158 else {
159 ApChanString += String(apInfo.SubGhzChannel);
160 }
161 }
162 setVarDB("ap_ch", ApChanString);
163#else
164 setVarDB("ap_ch", String(apInfo.channel));

Callers 4

init_webFunction · 0.85
setAPstateFunction · 0.85
setupFunction · 0.85
loopFunction · 0.85

Calls 12

dbSizeFunction · 0.85
setVarDBFunction · 0.85
logLineFunction · 0.85
wsErrFunction · 0.85
refreshAllPendingFunction · 0.85
saveDBFunction · 0.85
getTagCountFunction · 0.85
localIPMethod · 0.80
delayFunction · 0.50
freeSpaceMethod · 0.45
sizeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected