Merge pull request #8 from crankyoldgit/patch-1

Use strtoul() instead of custom code.
This commit is contained in:
1technophile authored and GitHub committed 2017-01-09 18:53:16 +01:00
commit ce9f99f3f6
1 file changed
+1 -10
+1 -10
View File
@@ -300,7 +300,7 @@ void receivingMQTT(String topicNameRec, String callbackstring) {
client.publish("home/ack", DataAck);
callbackstring.toCharArray(datacallback,32);
trc(datacallback);
unsigned long data = char2Ulong(datacallback); // we will not be able to pass value > 4294967295
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass value > 4294967295
trc(String(data));
if (topicNameRec == subjectMQTTto433){
@@ -332,15 +332,6 @@ void receivingMQTT(String topicNameRec, String callbackstring) {
irsend.sendSAMSUNG(data, 32);
}
unsigned long char2Ulong(char *str)
{
unsigned long result = 0; // Initialize result
// Iterate through all characters of input string and update result
for (int i = 0; str[i] != '\0'; ++i)
result = result*10 + str[i] - '0';
return result;
}
//send MQTT data dataStr to topic topicNameSend
void sendMQTT(String topicNameSend, String dataStr){