mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем функцию сохранения состояния элементов на flash
This commit is contained in:
26
src/Main.cpp
26
src/Main.cpp
@@ -149,6 +149,14 @@ void loop() {
|
||||
loopPeriod = millis() - st;
|
||||
if (loopPeriod > 2) Serial.println(loopPeriod);
|
||||
#endif
|
||||
|
||||
// сохраняем значения IoTItems в файл каждую секунду, если были изменения (установлены маркеры на сохранение)
|
||||
if (needSaveValues && millis()%1000 == 0) {
|
||||
syncValuesFlashJson();
|
||||
needSaveValues = false;
|
||||
delay(1);
|
||||
Serial.println("syncValuesFlashJson()");
|
||||
}
|
||||
}
|
||||
|
||||
//отправка json
|
||||
@@ -162,24 +170,6 @@ void loop() {
|
||||
// delay(1);
|
||||
// }
|
||||
|
||||
// сохраняем значения IoTItems в файл каждую секунду, если были изменения (установлены маркеры на сохранение)
|
||||
// currentMillis = millis();
|
||||
// if (currentMillis - prevMillis >= 1000) {
|
||||
// prevMillis = millis();
|
||||
// volStrForSave = "";
|
||||
// for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
// if ((*it)->needSave) {
|
||||
// (*it)->needSave = false;
|
||||
// volStrForSave = volStrForSave + (*it)->getID() + "=" + (*it)->getValue() + ";";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (volStrForSave != "") {
|
||||
// Serial.print("volStrForSave: ");
|
||||
// Serial.println(volStrForSave.c_str());
|
||||
// }
|
||||
//}
|
||||
|
||||
// File dir = FileFS.open("/", "r");
|
||||
// String out;
|
||||
// printDirectory(dir, out);
|
||||
|
||||
Reference in New Issue
Block a user