mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-28 07:02:17 +03:00
Save date to flash added
This commit is contained in:
@@ -5,13 +5,13 @@
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "BufferExecute.h"
|
||||
|
||||
//this class save date to flash
|
||||
ButtonOut::ButtonOut(unsigned int pin, boolean inv, String key) {
|
||||
_pin = pin;
|
||||
_inv = inv;
|
||||
_key = key;
|
||||
pinMode(_pin, OUTPUT);
|
||||
int state = jsonReadInt(configLiveJson, key);
|
||||
int state = jsonReadInt(configStoreJson, key);
|
||||
this->execute(String(state));
|
||||
}
|
||||
ButtonOut::~ButtonOut() {}
|
||||
@@ -30,8 +30,8 @@ void ButtonOut::execute(String state) {
|
||||
}
|
||||
}
|
||||
eventGen2(_key, state);
|
||||
jsonWriteInt(configLiveJson, _key, state.toInt());
|
||||
saveLive();
|
||||
jsonWriteInt(configStoreJson, _key, state.toInt());
|
||||
saveStore();
|
||||
publishStatus(_key, state);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "BufferExecute.h"
|
||||
|
||||
//this class save date to flash
|
||||
Input::Input(String key, String widget) {
|
||||
_key = key;
|
||||
String value = jsonReadStr(configLiveJson, key);
|
||||
String value = jsonReadStr(configStoreJson, key);
|
||||
|
||||
if (value == "") {
|
||||
if (widget.indexOf("Digit") != -1) {
|
||||
@@ -25,8 +25,8 @@ Input::~Input() {}
|
||||
|
||||
void Input::execute(String value) {
|
||||
eventGen2(_key, value);
|
||||
jsonWriteStr(configLiveJson, _key, value);
|
||||
saveLive();
|
||||
jsonWriteStr(configStoreJson, _key, value);
|
||||
saveStore();
|
||||
publishStatus(_key, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ void cleanLogAndData() {
|
||||
SerialPrint("I", "System", fname);
|
||||
removeFile("logs/" + fname);
|
||||
}
|
||||
removeFile("live.json");
|
||||
configLiveJson = "";
|
||||
#endif
|
||||
removeFile("store.json");
|
||||
configStoreJson = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user