chart log data wip

This commit is contained in:
DeltaLima 2025-04-08 22:21:47 +02:00
parent 1e30589b5c
commit 094ca906dc

View file

@ -780,40 +780,7 @@ void LFS_Chart_Log_Data(const byte chartId) {
}
file.println(tmp_message);
file.close();
//#ifdef ESP8266
///* create directory */
//LittleFS.mkdir(fullpath);
///* build full path with filename to write in */
//snprintf(fullpath, sizeof(fullpath), "/chart/%d/%s", chartId, Char_Timestamp_yyyymmdd(timeNow));
//File file = LittleFS.open(fullpath, "a");
//#endif
//#ifdef ESP32
//fs::FS &fs = LittleFS;
///* create directory */
//fs.mkdir(fullpath);
///* build full path with filename to write in */
//snprintf(fullpath, sizeof(fullpath), "/chart/%d/%s", chartId, Char_Timestamp_yyyymmdd(timeNow));
//snprintf(fullpath, sizeof(fullpath), "/%s",Char_Timestamp_yyyymmdd(timeNow));
//File file = fs.open(fullpath, FILE_WRITE);
//#endif
//if (!file) {
//Log.error(F("%s Failed to open file for appending %s" CR), LogLoc, fullpath);
//return;
//}
//if (file.print(tmp_message)) {
//#ifdef DEBUG
//Log.notice(F("%s File appended %s" CR), LogLoc, fullpath);
//#endif
//} else {
//Log.error(F("%s Failed to append file %s" CR), LogLoc, fullpath);
//}
//file.close();
}
/* Function to List Chart dirs, for debugging purposes mainly */
@ -824,26 +791,10 @@ void LFS_Chart_Dirlist_Data(const byte chartId) {
//snprintf(path, sizeof(path), "/chart/%d", chartId);
snprintf(chartDirPath, sizeof(chartDirPath), "%s%d", CHART_BASE_PATH, chartId);
/* FS Implementation of ESP8266 Core and ESP32 Arduino core is different, so it needs to be seperated completely :( */
//#ifdef ESP8266
//Dir root = LittleFS.openDir(chartDirPath);
//while (root.next()) {
//if (root.isFile()) {
//Serial.print(" FILE : ");
//Serial.println(root.fileName());
//}
//if(root.isDirectory()) {
//Serial.print(" DIR: ");
//Serial.print(root.fileName());
//Serial.print("\tSIZE: ");
//}
//}
/* 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) {
//Serial.printf("|__ FILE: %s (%d bytes)\n",file.name(), file.size());
if (!file.isDirectory()) {
Serial.print(" FILE : ");
Serial.print(file.name());
@ -851,37 +802,7 @@ void LFS_Chart_Dirlist_Data(const byte chartId) {
Serial.println(file.size());
}
file = root.openNextFile();
}
//#endif
//#ifdef ESP32
//fs::FS &fs = LittleFS;
//File root = fs.open(chartDirPath);
//if (!root) {
//Serial.println("- failed to open directory");
//}
//if (!root.isDirectory()) {
//Serial.println(" - not a directory");
//}
//File file = root.openNextFile();
//while (file) {
//if (file.isDirectory()) {
//Serial.print(" DIR : ");
//Serial.println(file.name());
//} else {
//Serial.print(" FILE: ");
//Serial.print(file.name());
//Serial.print("\tSIZE: ");
//Serial.println(file.size());
//}
//file = root.openNextFile();
//}
//#endif
}
}
/* Rotate Chart data files */