Skip to content

Commit d90e2d9

Browse files
committed
Update DallasTemperatureSensor.ino
Updated version number to 1.1 since minor changes...
1 parent 8d7d63d commit d90e2d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include <DallasTemperature.h>
3030
#include <OneWire.h>
3131

32+
#define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
33+
3234
#define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
3335
#define MAX_ATTACHED_DS18B20 16
3436
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
@@ -51,7 +53,7 @@ void setup()
5153
gw.begin();
5254

5355
// Send the sketch version information to the gateway and Controller
54-
gw.sendSketchInfo("Temperature Sensor", "1.0");
56+
gw.sendSketchInfo("Temperature Sensor", "1.1");
5557

5658
// Fetch the number of attached temperature sensors
5759
numSensors = sensors.getDeviceCount();
@@ -78,7 +80,11 @@ void loop()
7880
float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
7981

8082
// Only send data if temperature has changed and no error
83+
#if COMPARE_TEMP == 1
8184
if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
85+
#else
86+
if (temperature != -127.00 && temperature != 85.00) {
87+
#endif
8288

8389
// Send in the new temperature
8490
gw.send(msg.setSensor(i).set(temperature,1));

0 commit comments

Comments
 (0)