mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 20:09:14 +03:00
Меняем unsigned long на long для _interval, для использования
отрицательных значений.
This commit is contained in:
@@ -139,7 +139,7 @@ extern Time_t _time_local;
|
|||||||
extern Time_t _time_utc;
|
extern Time_t _time_utc;
|
||||||
extern bool _time_isTrust;
|
extern bool _time_isTrust;
|
||||||
|
|
||||||
extern unsigned long loopPeriod;
|
//extern unsigned long loopPeriod;
|
||||||
|
|
||||||
// extern DynamicJsonDocument settingsFlashJsonDoc;
|
// extern DynamicJsonDocument settingsFlashJsonDoc;
|
||||||
// extern DynamicJsonDocument paramsFlashJsonDoc;
|
// extern DynamicJsonDocument paramsFlashJsonDoc;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ extern String jsonWriteInt(String& json, String name, int value, bool e = true);
|
|||||||
extern String jsonWriteFloat(String& json, String name, float value, bool e = true);
|
extern String jsonWriteFloat(String& json, String name, float value, bool e = true);
|
||||||
extern String jsonWriteBool(String& json, String name, boolean value, bool e = true);
|
extern String jsonWriteBool(String& json, String name, boolean value, bool e = true);
|
||||||
|
|
||||||
extern bool jsonRead(const String& json, String key, unsigned long& value, bool e = true);
|
extern bool jsonRead(const String& json, String key, long& value, bool e = true);
|
||||||
extern bool jsonRead(const String& json, String key, float& value, bool e = true);
|
extern bool jsonRead(const String& json, String key, float& value, bool e = true);
|
||||||
extern bool jsonRead(const String& json, String key, String& value, bool e = true);
|
extern bool jsonRead(const String& json, String key, String& value, bool e = true);
|
||||||
extern bool jsonRead(const String& json, String key, bool& value, bool e = true);
|
extern bool jsonRead(const String& json, String key, bool& value, bool e = true);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ String mqttRootDevice = "";
|
|||||||
unsigned long unixTime = 0;
|
unsigned long unixTime = 0;
|
||||||
unsigned long unixTimeShort = 0;
|
unsigned long unixTimeShort = 0;
|
||||||
|
|
||||||
unsigned long loopPeriod;
|
//unsigned long loopPeriod;
|
||||||
|
|
||||||
bool isTimeSynch = false;
|
bool isTimeSynch = false;
|
||||||
Time_t _time_local;
|
Time_t _time_local;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ButtonIn : public IoTItem {
|
|||||||
String _pinMode;
|
String _pinMode;
|
||||||
int _lastButtonState = LOW;
|
int _lastButtonState = LOW;
|
||||||
unsigned long _lastDebounceTime = 0;
|
unsigned long _lastDebounceTime = 0;
|
||||||
unsigned long _debounceDelay = 50;
|
long _debounceDelay = 50;
|
||||||
int _buttonState;
|
int _buttonState;
|
||||||
int _reading;
|
int _reading;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Loging : public IoTItem {
|
|||||||
String prevDate = "";
|
String prevDate = "";
|
||||||
bool firstTimeDate = true;
|
bool firstTimeDate = true;
|
||||||
|
|
||||||
unsigned long interval;
|
long interval;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Loging(String parameters) : IoTItem(parameters) {
|
Loging(String parameters) : IoTItem(parameters) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class LogingDaily : public IoTItem {
|
|||||||
String prevDate = "";
|
String prevDate = "";
|
||||||
bool firstTimeDate = true;
|
bool firstTimeDate = true;
|
||||||
|
|
||||||
unsigned long interval;
|
long interval;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LogingDaily(String parameters) : IoTItem(parameters) {
|
LogingDaily(String parameters) : IoTItem(parameters) {
|
||||||
|
|||||||
@@ -11,21 +11,23 @@ void jsonWriteStrDoc(DynamicJsonDocument& doc, String name, String value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new==============================================================================
|
// new==============================================================================
|
||||||
bool jsonRead(const String& json, String key, unsigned long& value, bool e) {
|
bool jsonRead(const String& json, String key, long& value, bool e) {
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
if (e) {
|
||||||
jsonErrorDetected();
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
|
jsonErrorDetected();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (!doc.containsKey(key)) {
|
} else if (!doc.containsKey(key)) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), key + " missing");
|
SerialPrint("E", F("jsonRead"), key + " missing");
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
value = doc[key].as<unsigned long>();
|
value = doc[key].as<long>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,12 +35,14 @@ bool jsonRead(const String& json, String key, float& value, bool e) {
|
|||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
if (e) {
|
||||||
jsonErrorDetected();
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
|
jsonErrorDetected();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (!doc.containsKey(key)) {
|
} else if (!doc.containsKey(key)) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), key + " missing");
|
SerialPrint("E", F("jsonRead"), key + " missing");
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -51,12 +55,14 @@ bool jsonRead(const String& json, String key, String& value, bool e) {
|
|||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
if (e) {
|
||||||
jsonErrorDetected();
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
|
jsonErrorDetected();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (!doc.containsKey(key)) {
|
} else if (!doc.containsKey(key)) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), key + " missing");
|
SerialPrint("E", F("jsonRead"), key + " missing");
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -76,12 +82,14 @@ bool jsonRead(const String& json, String key, int& value, bool e) {
|
|||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
if (e) {
|
||||||
jsonErrorDetected();
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
|
jsonErrorDetected();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (!doc.containsKey(key)) {
|
} else if (!doc.containsKey(key)) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), key + " missing");
|
SerialPrint("E", F("jsonRead"), key + " missing");
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -97,7 +105,7 @@ bool jsonWriteStr_(String& json, const String& key, const String& value, bool e)
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
ret = false;
|
ret = false;
|
||||||
@@ -114,7 +122,7 @@ bool jsonWriteBool_(String& json, const String& key, bool value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
ret = false;
|
ret = false;
|
||||||
@@ -131,7 +139,7 @@ bool jsonWriteInt_(String& json, const String& key, int value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
ret = false;
|
ret = false;
|
||||||
@@ -148,7 +156,7 @@ bool jsonWriteFloat_(String& json, const String &key, float value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
ret = false;
|
ret = false;
|
||||||
@@ -177,7 +185,7 @@ bool jsonMergeObjects(String& json1, String& json2, bool e) {
|
|||||||
jsonMergeDocs(doc1.as<JsonObject>(), doc2.as<JsonObject>());
|
jsonMergeDocs(doc1.as<JsonObject>(), doc2.as<JsonObject>());
|
||||||
if (error1 || error2) {
|
if (error1 || error2) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("json"), "jsonMergeObjects error");
|
SerialPrint("E", F("json"), "jsonMergeObjects error");
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
ret = false;
|
ret = false;
|
||||||
@@ -199,7 +207,7 @@ String jsonReadStr(const String& json, String name, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,7 +219,7 @@ boolean jsonReadBool(const String& json, String name, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +231,7 @@ int jsonReadInt(const String& json, String name, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonRead"), error.f_str());
|
SerialPrint("E", F("jsonRead"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,7 +244,7 @@ String jsonWriteStr(String& json, String name, String value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,7 +259,7 @@ String jsonWriteBool(String& json, String name, boolean value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +274,7 @@ String jsonWriteInt(String& json, String name, int value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,7 +289,7 @@ String jsonWriteFloat(String& json, String name, float value, bool e) {
|
|||||||
DeserializationError error = deserializeJson(doc, json);
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (e) {
|
if (e) {
|
||||||
SerialPrint("EE", F("jsonWrite"), error.f_str());
|
SerialPrint("E", F("jsonWrite"), error.f_str());
|
||||||
jsonErrorDetected();
|
jsonErrorDetected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void hex2string(byte array[], unsigned int len, char buffer[]) {
|
|||||||
buffer[len * 2] = '\0';
|
buffer[len * 2] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char ChartoHex(char ch) {
|
unsigned char ChartoHex(char ch) {
|
||||||
return ((ch >= 'A') ? (ch - 'A' + 0xA) : (ch - '0')) & 0x0F;
|
return ((ch >= 'A') ? (ch - 'A' + 0xA) : (ch - '0')) & 0x0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user