correct double variable declaration and use arduino json implicit cast

This commit is contained in:
Florian authored and GitHub committed 2018-11-09 22:40:53 +01:00
1 parent a74eb76931
commit ae3bbb7321
1 file changed
+10 -10
+10 -10
View File
@@ -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
{
trc(F("Storing signal"));
unsigned long data = 0;
#ifdef jsonPublishing
trc(F("Creating Json buffer"));
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
JsonObject& jsondata = jsonBuffer.parseObject(datacallback);
unsigned long data = strtoul(jsondata["value"], NULL, 10); // we will not be able to pass values > 4294967295
storeValue(data);
trc(F("Data from JSON stored"));
trc(F("Creating Json buffer"));
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
JsonObject& jsondata = jsonBuffer.parseObject(datacallback);
if (jsondata.success()) data = jsondata["value"];
#endif
#ifdef simplePublishing
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
storeValue(data);
trc(F("Data stored"));
data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
#endif
if (data != 0) {
storeValue(data);
trc(F("Data from JSON stored"));
}
}
//YELLOW ON
digitalWrite(led_send, LOW);