mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-30 00:47:17 +02:00
Delete local storage function
This commit is contained in:
@ -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)) {
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user