chart data draw root page wip

This commit is contained in:
DeltaLima 2025-04-09 01:52:11 +02:00
parent a3f99e83bf
commit 4a7e08a58e
4 changed files with 41 additions and 4 deletions

View file

@ -799,7 +799,7 @@ void LFS_Chart_Dirlist_Data(const byte chartId) {
#endif
}
file = root.openNextFile();
}
}
}
/* Rotate Chart data files */

View file

@ -61,6 +61,6 @@ void TimeR_Init() {
timer.setInterval(1000, Timer_Output);
timer.setInterval(1000, Timer_Sensor);
timer.setInterval(100, Timer_Control);
timer.setInterval(15000, Timer_3s);
timer.setInterval(30000, Timer_3s);
}

View file

@ -149,8 +149,41 @@ String Proc_WebPage_root(const String& var) {
return html;
//return String("Nice");
} else if(var == "LOL") {
return String("Jojoojo :)");
} else if(var == "CHART") {
String html;
if(config.grow.dashboard.chartConfigured[0] == true) {
char chartDirPath[10];
snprintf(chartDirPath, sizeof(chartDirPath), "%s%d", CHART_BASE_PATH, 0);
/* https://github.com/cotestatnt/async-esp-fs-webserver/blob/master/src/AsyncFsWebServer.cpp */
File root = LittleFS.open(chartDirPath, "r");
File file = root.openNextFile();
while (file) {
if (!file.isDirectory()) {
//#ifdef DEBUG
//Log.verbose(F("%s PATH: %s \tFILE: %s \tSIZE: %d" CR), LogLoc, chartDirPath, file.name(), file.size());
//#endif
/* absolute path to the file we want to read */
char chartFilePath[32];
snprintf(chartFilePath, sizeof(chartFilePath), "%s/%s", chartDirPath, file.name());
Serial.println(chartFilePath);
/* the actual file we are reading */
File fileRead = LittleFS.open(chartFilePath, "r");
while(fileRead.available()) {
html += fileRead.readStringUntil(';');
html += "-lol-";
html += fileRead.readStringUntil('\n').toFloat();
}
fileRead.close();
}
file = root.openNextFile();
}
}
return html;
} else {
return String();
}

View file

@ -13,4 +13,8 @@ const char Page_root_HTML[] PROGMEM = R"EOF(%HEADER%
%GAUGE%
<br>
%CHART%
%FOOTER% )EOF";