diff --git a/src/AgValue.cpp b/src/AgValue.cpp index b25fc1f..a18aac3 100644 --- a/src/AgValue.cpp +++ b/src/AgValue.cpp @@ -1068,6 +1068,15 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem void Measurements::setDebug(bool debug) { _debug = debug; } +bool Measurements::resetLocalStorage() { + if (!SPIFFS.remove(FILE_PATH)) { + Serial.println("Failed reset local storage"); + return false; + } + + return true; +} + void Measurements::saveLocalStorage(AirGradient &ag) { File file; if (!SPIFFS.exists(FILE_PATH)) { diff --git a/src/AgValue.h b/src/AgValue.h index c7182e3..e50b750 100644 --- a/src/AgValue.h +++ b/src/AgValue.h @@ -142,6 +142,7 @@ public: String toString(bool localServer, AgFirmwareMode fwMode, int rssi, AirGradient &ag, Configuration &config); + bool resetLocalStorage(); void saveLocalStorage(AirGradient &ag); char *getLocalStorage(); @@ -176,7 +177,7 @@ private: IntegerValue _pm_10_pc[2]; // particle count 10 bool _debug = false; - const char *FILE_PATH = "/measurement.csv"; // Local storage file path + const char *FILE_PATH = "/measurements.csv"; // Local storage file path /** * @brief Get PMS5003 firmware version string