Update cast in msg.set (#1130)

A while ago, MySensors changed to use int32_t
instead of long int (and similar for other data
types). This change was not applied to all examples,
causing some examples to fail compilation for
ESP8266 with the following message:

call of overloaded 'set(long int)' is ambiguous

This update changes the casts to match the new style.
This fixes
https://github.com/mysensors/MySensors/issues/1129
Thanks to https://github.com/henfri for reporting.
This commit is contained in:
Mikael Falkvidd
2018-05-14 21:32:11 +02:00
committed by Patrick Fallberg
parent f5ed26c778
commit 0b9af6d713
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ void loop()
long co2ppm = 2 * ((duration/1000) - 2);
//Serial.print(co2ppm);
if ((co2ppm != lastAIQ)&&(abs(co2ppm-lastAIQ)>=10)) {
send(msg.set((long)ceil(co2ppm)));
send(msg.set((int32_t)ceil(co2ppm)));
lastAIQ = ceil(co2ppm);
}
+2 -2
View File
@@ -95,7 +95,7 @@ void loop()
Serial.print("\n");
if ((concentrationPM25 != lastDUSTPM25)&&(concentrationPM25>0)) {
send(dustMsgPM25.set((long)ceil(concentrationPM25)));
send(dustMsgPM25.set((int32_t)ceil(concentrationPM25)));
lastDUSTPM25 = ceil(concentrationPM25);
}
@@ -110,7 +110,7 @@ void loop()
long ppmv=(concentrationPM10*0.0283168/100/1000) * (0.08205*temp)/0.01;
if ((ceil(concentrationPM10) != lastDUSTPM10)&&((long)concentrationPM10>0)) {
send(dustMsgPM10.set((long)ppmv));
send(dustMsgPM10.set((int32_t)ppmv));
lastDUSTPM10 = ceil(concentrationPM10);
}
+1 -1
View File
@@ -138,7 +138,7 @@ void loop()
Serial.println ();
//send back the values
send(msg.set((long int)ceil(sensor1)));
send(msg.set((int32_t)ceil(sensor1)));
// delay until next measurement (msec)
sleep(SLEEP_TIME);
}