This commit is contained in:
Dmitry Borisenko
2023-06-25 18:41:46 +02:00
parent 5d9deb8e95
commit 415fe9c5b3
12 changed files with 134 additions and 122 deletions

View File

@@ -7,7 +7,6 @@ void* getAPI_Timer(String subtype, String params);
void* getAPI_Variable(String subtype, String params);
void* getAPI_VariableColor(String subtype, String params);
void* getAPI_VButton(String subtype, String params);
void* getAPI_A02Distance(String subtype, String params);
void* getAPI_Acs712(String subtype, String params);
void* getAPI_AhtXX(String subtype, String params);
void* getAPI_AnalogAdc(String subtype, String params);
@@ -35,7 +34,7 @@ void* getAPI_Mcp23017(String subtype, String params);
void* getAPI_Mp3(String subtype, String params);
void* getAPI_Multitouch(String subtype, String params);
void* getAPI_Pcf8574(String subtype, String params);
void* getAPI_Pwm8266(String subtype, String params);
void* getAPI_Pwm32(String subtype, String params);
void* getAPI_TelegramLT(String subtype, String params);
void* getAPI_Lcd2004(String subtype, String params);
@@ -48,7 +47,6 @@ if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_VariableColor(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_A02Distance(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Acs712(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AhtXX(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI;
@@ -76,7 +74,7 @@ if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Multitouch(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pwm32(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
return nullptr;

View File

@@ -238,6 +238,18 @@ int jsonReadInt(const String& json, String name, bool e) {
return doc[name].as<int>();
}
long int jsonReadLInt(const String& json, String name, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
}
return doc[name].as<long int>();
}
// depricated========================================================================
String jsonWriteStr(String& json, String name, String value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);

View File

@@ -2,7 +2,7 @@
#include "Global.h"
#include "utils/StringUtils.h"
static const char* TIME_FORMAT PROGMEM = "%02d:%02d"; //:%02d";
static const char* TIME_FORMAT PROGMEM = "%02d:%02d:%02d";
static const char* TIME_FORMAT_WITH_DAYS PROGMEM = "%dd %02d:%02d";
const String prettySeconds(unsigned long time_s) {