correct double variable declaration and use arduino json implicit cast
This commit is contained in:
1 parent
a74eb76931
commit
ae3bbb7321
1 file changed
+7
-7
+7
-7
@@ -830,22 +830,22 @@ void receivingMQTT(char * topicOri, char * datacallback) {
|
|||||||
if (strstr(topicOri, subjectMultiGTWKey) != NULL) // storing received value so as to avoid publishing this value if it has been already sent by this or another OpenMQTTGateway
|
if (strstr(topicOri, subjectMultiGTWKey) != NULL) // storing received value so as to avoid publishing this value if it has been already sent by this or another OpenMQTTGateway
|
||||||
{
|
{
|
||||||
trc(F("Storing signal"));
|
trc(F("Storing signal"));
|
||||||
|
unsigned long data = 0;
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonPublishing
|
||||||
trc(F("Creating Json buffer"));
|
trc(F("Creating Json buffer"));
|
||||||
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
|
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
|
||||||
JsonObject& jsondata = jsonBuffer.parseObject(datacallback);
|
JsonObject& jsondata = jsonBuffer.parseObject(datacallback);
|
||||||
unsigned long data = strtoul(jsondata["value"], NULL, 10); // we will not be able to pass values > 4294967295
|
if (jsondata.success()) data = jsondata["value"];
|
||||||
storeValue(data);
|
|
||||||
trc(F("Data from JSON stored"));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simplePublishing
|
||||||
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
||||||
storeValue(data);
|
|
||||||
trc(F("Data stored"));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (data != 0) {
|
||||||
|
storeValue(data);
|
||||||
|
trc(F("Data from JSON stored"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//YELLOW ON
|
//YELLOW ON
|
||||||
digitalWrite(led_send, LOW);
|
digitalWrite(led_send, LOW);
|
||||||
|
|||||||
Reference in new issue
Block a user