Skip to content

Commit 0b9af6d

Browse files
mfalkviddfallberg
authored andcommitted
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 #1129 Thanks to https://github.com/henfri for reporting.
1 parent f5ed26c commit 0b9af6d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/CO2Sensor/CO2Sensor.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void loop()
9595
long co2ppm = 2 * ((duration/1000) - 2);
9696
//Serial.print(co2ppm);
9797
if ((co2ppm != lastAIQ)&&(abs(co2ppm-lastAIQ)>=10)) {
98-
send(msg.set((long)ceil(co2ppm)));
98+
send(msg.set((int32_t)ceil(co2ppm)));
9999
lastAIQ = ceil(co2ppm);
100100
}
101101

examples/DustSensorDSM/DustSensorDSM.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void loop()
9595
Serial.print("\n");
9696

9797
if ((concentrationPM25 != lastDUSTPM25)&&(concentrationPM25>0)) {
98-
send(dustMsgPM25.set((long)ceil(concentrationPM25)));
98+
send(dustMsgPM25.set((int32_t)ceil(concentrationPM25)));
9999
lastDUSTPM25 = ceil(concentrationPM25);
100100
}
101101

@@ -110,7 +110,7 @@ void loop()
110110
long ppmv=(concentrationPM10*0.0283168/100/1000) * (0.08205*temp)/0.01;
111111

112112
if ((ceil(concentrationPM10) != lastDUSTPM10)&&((long)concentrationPM10>0)) {
113-
send(dustMsgPM10.set((long)ppmv));
113+
send(dustMsgPM10.set((int32_t)ppmv));
114114
lastDUSTPM10 = ceil(concentrationPM10);
115115
}
116116

examples/SoilMoistSensor/SoilMoistSensor.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void loop()
138138
Serial.println ();
139139

140140
//send back the values
141-
send(msg.set((long int)ceil(sensor1)));
141+
send(msg.set((int32_t)ceil(sensor1)));
142142
// delay until next measurement (msec)
143143
sleep(SLEEP_TIME);
144144
}

0 commit comments

Comments
 (0)