SPIFFS mount sometimes fail

This commit is contained in:
Emanuele Trabattoni
2026-04-07 17:33:08 +02:00
parent 877236ee4e
commit 7c96101cdd
6 changed files with 42 additions and 890 deletions

View File

@@ -12,12 +12,12 @@
#include "isr.h"
#include "psvector.h"
const uint32_t max_history = 1024;
const uint32_t max_history = 256;
const bool SAVE_HISTORY_TO_SPIFFS = true; // Set to true to enable saving history to SPIFFS, false to disable
struct dataSaveParams
{
PSRAMVector<ignitionBoxStatus> *history;
const PSRAMVector<ignitionBoxStatus> *history;
const std::filesystem::path file_path;
};
@@ -25,15 +25,14 @@ void save_history(const PSRAMVector<ignitionBoxStatus> &history, const std::file
static void saveHistoryTask(void *pvParameters)
{
auto *params = static_cast<dataSaveParams *>(pvParameters);
auto &history = *params->history;
auto &file_path = params->file_path;
const auto *params = static_cast<dataSaveParams *>(pvParameters);
const auto &history = *params->history;
const auto &file_path = params->file_path;
if (!params) {
LOG_ERROR("Invalid parameters for saveHistoryTask");
return;
}
LOG_INFO("Starting saving: ", file_path.c_str());
save_history(history, file_path);
history.reserve(max_history); // ensure writable buffer has the correct size
vTaskDelete(NULL);
//vTaskDelete(NULL);
}