milesburton / Arduino-Temperature-Control-Library

Arduino Temperature Library
https://www.milesburton.com/w/index.php/Dallas_Temperature_Control_Library
974 stars 486 forks source link

invalid conversion in AlarmHandler.pde exemple #156

Closed stef-ladefense closed 4 years ago

stef-ladefense commented 4 years ago

the exemple AlarmHandler.pde is very old and not compile

C:\Users\stephane\Documents\Arduino\sketch_mar07a\sketch_mar07a.ino: In function 'void setup()':

sketch_mar07a:113:43: error: invalid conversion from 'void ()(uint8_t) {aka void ()(unsigned char)}' to 'void ()(const uint8_t) {aka void ()(const unsigned char)}' [-fpermissive]

sensors.setAlarmHandler(&newAlarmHandler);

                                       ^

In file included from C:\Users\stephane\Documents\Arduino\sketch_mar07a\sketch_mar07a.ino:2:0:

C:\Users\stephane\Documents\Arduino\libraries\Temperature-Control-Library/DallasTemperature.h:181:7: error: initializing argument 1 of 'void DallasTemperature::setAlarmHandler(void ()(const uint8_t))' [-fpermissive]

void setAlarmHandler(const AlarmHandler *);

   ^

exit status 1 invalid conversion from 'void ()(uint8_t) {aka void ()(unsigned char)}' to 'void ()(const uint8_t) {aka void ()(const unsigned char)}' [-fpermissive]

RobTillaart commented 4 years ago

Which platform (UNO ESP, ...) are you using? Which version of the library are you using?

stef-ladefense commented 4 years ago

arduino 1.8.12 ESP8266 2.6.3 3.8.0 for this library

i use this library with ESP8266 for long time, in classic mode, one bus, multiple DS18B20. I need to use the alarms, and cannot compile the exemple sketch.

RobTillaart commented 4 years ago

Have no ESP 8266 installed, which tools path do you use? (I'll try ESP32 in the meantime)

RobTillaart commented 4 years ago

ESP32 ==> same problem

RobTillaart commented 4 years ago

I changed the code so it compiles for ESP32, can you try it for ESP8266?

Mainly it was adding const to address parameter of some functions.

AlarmHandler.ino.zip

RobTillaart commented 4 years ago

Tried to compile all the example sketches for ESP32 and they all succeeded. So alarmHandler.pde was the only with this problem.

stef-ladefense commented 4 years ago

test your ino, compile with ESP8266 2.4.2 and 2.6.3 ok ! very good !

it's ok for me, and just little 'const' before DeviceAddress

RobTillaart commented 4 years ago

@milesburton please close issue