Dallas Temp failure to compile
-
Im trying to build my first sensor and im getting the following error.
C:\Users\jrich\OneDrive\Documents\Arduino\libraries\DallasTemperature/DallasTemperature.h:249:13: error: 'int16_t DallasTemperature::millisToWaitForConversion(uint8_t)' is private int16_t millisToWaitForConversion(uint8_t); ^ DallasTemperatureSensor:79: error: within this context int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); ^ exit status 1 within this contextI just downloaded and installed the libraries (i think successfully) but I noticed that towards the top where the libraries are defined the <MySensor.h> is all standard black text where as the <OneWire.h> has OneWire in orange (i assume this is ok, has to do with types of libraries?)
also the error states that the function is private, which means im not allowed to call it?
Arduino told me to update some libraries, one of them being the Dallas stuff, but it seems like this is an error with the sensors library not defining the millisToWaitForConversion as a public function?
hope this is something simple im doing wrong, pretty new to all of this
-
I created an issue on this - https://github.com/mysensors/Arduino/issues/297
-
I'm also having this problem. Doesn't matter if I downgrade to a previous version of DallasTemperature.
Any progress on this or advice on how to solve this?
The issue seems to be closed, strange...
Thanks!
-
I was having way too many problems with the radios and code so I gave up and started to use beagle bone and just use domoticz api
-
Is there any resolution for this?
I am facing the same problem and i do not know how to fix this.Edit, i found something.
You need to comment out these lines:Only this way it compiles and sensors do work.
I don't know what happens so maybe somebody with knowledge can explain this?//int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) //sleep(conversionTime);``` -
Is there any resolution for this?
I am facing the same problem and i do not know how to fix this.Edit, i found something.
You need to comment out these lines:Only this way it compiles and sensors do work.
I don't know what happens so maybe somebody with knowledge can explain this?//int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) //sleep(conversionTime);```Edit, i found something.
You need to comment out these lines:If you do that you don't leave enough time for your sensor to compute the temperature, your readings will be wrong.
There is no problem with MySensors 2, and examples + libraries downloaded from MySensors' GitHub, I just tried and it builds.
Go there: https://github.com/mysensors/
Then select "MySensorsArduinoExamples" and download. Then you can copy the libraries directory in your arduino directory (you can override existing files), and the examples directory in [Arduino directory]\libraries\MySensors\ it will override old examples if they are already here. -
Is there any resolution for this?
I am facing the same problem and i do not know how to fix this.Edit, i found something.
You need to comment out these lines:Only this way it compiles and sensors do work.
I don't know what happens so maybe somebody with knowledge can explain this?//int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) //sleep(conversionTime);```@tlpeter
This is my function to read all Sensors. You have to give the Sensor time to do the measuring and make the result available.
I've commented everything out to get the min wait time. It is defined in the Datasheet of the Sensor

If you wait or sleep for 750ms you are save. Depending on the resultion of the sensor you can wait a bit less.void readDallasSensors() { // Fetch temperatures from Dallas sensors TempSensors.requestTemperatures(); // query conversion time and sleep until conversion completed //int16_t conversionTime = TempSensors.millisToWaitForConversion(TempSensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(750); // Read temperatures and send them to controller for (int i = 0; i < numTempSensors && i < MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = TempSensors.getTempCByIndex(i); #ifdef DEBUG SPrint(Temperature: ); Serial.println(temperature, 1); #endif // Only send data if temperature has changed and no error if (abs(lastTemperature[i] - temperature) >= 0.1 && temperature != -127.00 && temperature != 85.00) { // Send in the new temperature send(msg.setSensor(i).set(temperature, 1)); // Save new temperatures for next compare lastTemperature[i] = temperature; } } -
It does not compile an di am not the only one saying that.
See this error:Arduino: 1.6.9 (Windows 10), Board: "Arduino/Genuino Uno" In file included from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_224748\DallasTemperatureSensor.ino:37:0: C:\Users\Peter\Documents\Arduino\libraries\DallasTemperature/DallasTemperature.h: In function 'void loop()': C:\Users\Peter\Documents\Arduino\libraries\DallasTemperature/DallasTemperature.h:252:13: error: 'int16_t DallasTemperature::millisToWaitForConversion(uint8_t)' is private int16_t millisToWaitForConversion(uint8_t); ^ DallasTemperatureSensor:81: error: within this context int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); ^ exit status 1 within this context This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. -
@tlpeter
This is my function to read all Sensors. You have to give the Sensor time to do the measuring and make the result available.
I've commented everything out to get the min wait time. It is defined in the Datasheet of the Sensor

If you wait or sleep for 750ms you are save. Depending on the resultion of the sensor you can wait a bit less.void readDallasSensors() { // Fetch temperatures from Dallas sensors TempSensors.requestTemperatures(); // query conversion time and sleep until conversion completed //int16_t conversionTime = TempSensors.millisToWaitForConversion(TempSensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(750); // Read temperatures and send them to controller for (int i = 0; i < numTempSensors && i < MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = TempSensors.getTempCByIndex(i); #ifdef DEBUG SPrint(Temperature: ); Serial.println(temperature, 1); #endif // Only send data if temperature has changed and no error if (abs(lastTemperature[i] - temperature) >= 0.1 && temperature != -127.00 && temperature != 85.00) { // Send in the new temperature send(msg.setSensor(i).set(temperature, 1)); // Save new temperatures for next compare lastTemperature[i] = temperature; } }@Hermann-Kaiser said:
@tlpeter
This is my function to read all Sensors. You have to give the Sensor time to do the measuring and make the result available.
I've commented everything out to get the min wait time. It is defined in the Datasheet of the Sensor

If you wait or sleep for 750ms you are save. Depending on the resultion of the sensor you can wait a bit less.void readDallasSensors() { // Fetch temperatures from Dallas sensors TempSensors.requestTemperatures(); // query conversion time and sleep until conversion completed //int16_t conversionTime = TempSensors.millisToWaitForConversion(TempSensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(750); // Read temperatures and send them to controller for (int i = 0; i < numTempSensors && i < MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = TempSensors.getTempCByIndex(i); #ifdef DEBUG SPrint(Temperature: ); Serial.println(temperature, 1); #endif // Only send data if temperature has changed and no error if (abs(lastTemperature[i] - temperature) >= 0.1 && temperature != -127.00 && temperature != 85.00) { // Send in the new temperature send(msg.setSensor(i).set(temperature, 1)); // Save new temperatures for next compare lastTemperature[i] = temperature; } }That indeed works but still the example has some kind of an error or is not good enough for beginners like me :-)
Thanks, this works fine. -
Is there any resolution for this?
I am facing the same problem and i do not know how to fix this.Edit, i found something.
You need to comment out these lines:Only this way it compiles and sensors do work.
I don't know what happens so maybe somebody with knowledge can explain this?//int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) //sleep(conversionTime);```@tlpeter yes there seems to be a problem once you update the library. Even if you roll back the problem persists. If you want to use the MySensors Dallas temp sketch as it is then you need to manually replace the library with the older 3.7.2 and then it will work.
I have uploaded the library in zip format. @hek I hope that it is OK to upload zip files
-
error: 'int16_t DallasTemperature::millisToWaitForConversion(uint8_t)' is privateYou are using an old version of the library, if you get the library from MySensors GitHub then the method is not private (like in the current version of the library you use) and it will compile.
-
Thanks, that works fine.
How come that i have an old library? i use the 2.0.0 version
Is this perhaps a known issue which will be fixed soon? -
I removed everything and started from scratch and after that i copied the mysensors-master library.
@tlpeter said:
I removed everything and started from scratch and after that i copied the mysensors-master library.
"removed everything" in MySensors directory ? That's not enough, as the third party libraries are in the libraries directory of Arduino
-
why not put the function millisToWaitForConversion into the example.
I like to have the latest libary available for sensors. It can be loaded with the arduino studio.
Read the min wait time is pretty easy. it is just a switch case based on the datasheet.// returns number of milliseconds to wait till conversion is complete (based on IC datasheet) int16_t DallasTemperature::millisToWaitForConversion(uint8_t bitResolution) { switch (bitResolution) { case 9: return 94; case 10: return 188; case 11: return 375; default: return 750; } }