Skip to content

Commit 31292f2

Browse files
Compatibility with recent ArduinoJSON versions
- Patch deprecation of containsKey() function - Ban naked CHAR variable type from parameters
1 parent 919d489 commit 31292f2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/LiveObjectsBase.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ void LiveObjectsBase::paramTyper(const String& name, bool* variable, LiveObjects
3131
else
3232
addTypedParam(name, variable, type, T_BOOL, callback);
3333
}
34-
void LiveObjectsBase::paramTyper(const String& name, char* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback) {
34+
/*void LiveObjectsBase::paramTyper(const String& name, char* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback) {
3535
if (type == IMPLICIT)
3636
addTypedParam(name, variable, INTEGER, T_CHAR, callback);
3737
else
3838
addTypedParam(name, variable, type, T_CHAR, callback);
39-
}
39+
}*/
4040
#if not defined ESP8266 && not defined ESP32 && not defined ARDUINO_AVR_FEATHER32U4
4141
void LiveObjectsBase::paramTyper(const String& name, int* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback) {
4242
if (type == IMPLICIT)
@@ -111,9 +111,9 @@ void LiveObjectsBase::ptrTyper(const LiveObjects_parameter param, const JsonDocu
111111
case T_BOOL:
112112
updateParameter(param, (bool*)param.value, configIn, configOut);
113113
break;
114-
case T_CHAR:
114+
/* case T_CHAR:
115115
updateParameter(param, (char*)param.value, configIn, configOut);
116-
break;
116+
break;*/
117117
#ifndef ESP8266
118118
case T_INT:
119119
updateParameter(param, (int*)param.value, configIn, configOut);
@@ -301,7 +301,7 @@ void LiveObjectsBase::sendData(const String customPayload) {
301301
{
302302
StaticJsonDocument<PAYLOAD_DATA_SIZE> payload;
303303
deserializeJson(payload, customPayload);
304-
if (!payload.containsKey(JSONMODEL)) payload[JSONMODEL] = m_sModel;
304+
if (!payload[JSONMODEL].is<const char*>()) payload[JSONMODEL] = m_sModel;
305305
publishMessage(m_sTopic, payload);
306306
}
307307
else publishMessage(m_sTopic, const_cast<String&>(customPayload));

src/LiveObjectsBase.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class LiveObjectsBase
285285
PARAM TYPERS
286286
******************************************************************************/
287287
void paramTyper(const String& name, bool* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback);
288-
void paramTyper(const String& name, char* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback);
288+
// void paramTyper(const String& name, char* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback);
289289
#if not defined ESP8266 && not defined ESP32 && not defined ARDUINO_AVR_FEATHER32U4
290290
void paramTyper(const String& name, int* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback);
291291
void paramTyper(const String& name, unsigned int* variable, LiveObjects_parameterType type, onParameterUpdateCallback callback);

0 commit comments

Comments
 (0)