File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ DallasTemperature sensors(&oneWire);
1414DeviceAddress insideThermometer, outsideThermometer;
1515
1616// function that will be called when an alarm condition exists during DallasTemperatures::processAlarms();
17- void newAlarmHandler (uint8_t * deviceAddress)
17+ void newAlarmHandler (const uint8_t * deviceAddress)
1818{
1919 Serial.println (" Alarm Handler Start" );
2020 printAlarmInfo (deviceAddress);
@@ -30,7 +30,7 @@ void printCurrentTemp(DeviceAddress deviceAddress)
3030 Serial.println ();
3131}
3232
33- void printAddress (DeviceAddress deviceAddress)
33+ void printAddress (const DeviceAddress deviceAddress)
3434{
3535 Serial.print (" Address: " );
3636 for (uint8_t i = 0 ; i < 8 ; i++)
@@ -41,7 +41,7 @@ void printAddress(DeviceAddress deviceAddress)
4141 Serial.print (" " );
4242}
4343
44- void printTemp (DeviceAddress deviceAddress)
44+ void printTemp (const DeviceAddress deviceAddress)
4545{
4646 float tempC = sensors.getTempC (deviceAddress);
4747 if (tempC != DEVICE_DISCONNECTED_C)
@@ -53,7 +53,7 @@ void printTemp(DeviceAddress deviceAddress)
5353 Serial.print (" " );
5454}
5555
56- void printAlarmInfo (DeviceAddress deviceAddress)
56+ void printAlarmInfo (const DeviceAddress deviceAddress)
5757{
5858 char temp;
5959 printAddress (deviceAddress);
Original file line number Diff line number Diff line change 11//
22// FILE: Timing.ino
33// AUTHOR: Rob Tillaart
4- // VERSION: 0.0.2
4+ // VERSION: 0.0.3
55// PURPOSE: show performance of DallasTemperature lib
66// compared to datasheet times per resolution
77//
88// HISTORY:
9- // 0.0.1 = 2017-07-25 initial version
10- // 0.0.2 = 2020-02-13 updates to work with current lib version
9+ // 0.0.1 2017-07-25 initial version
10+ // 0.0.2 2020-02-13 updates to work with current lib version
11+ // 0.0.3 2020-02-20 added timing measurement of setResolution
1112
1213#include < OneWire.h>
1314#include < DallasTemperature.h>
@@ -39,7 +40,13 @@ void loop()
3940 Serial.println (" RES\t TIME\t ACTUAL\t GAIN" );
4041 for (int r = 9 ; r < 13 ; r++)
4142 {
43+ start = micros ();
4244 sensor.setResolution (r);
45+ Serial.println (micros () - start);
46+
47+ start = micros ();
48+ sensor.setResolution (r);
49+ Serial.println (micros () - start);
4350
4451 uint32_t duration = run (20 );
4552 float avgDuration = duration / 20.0 ;
You can’t perform that action at this time.
0 commit comments