Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Dallas Temp failure to compile

Dallas Temp failure to compile

Scheduled Pinned Locked Moved Troubleshooting
23 Posts 11 Posters 7.9k Views 10 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NickBuilderN Offline
    NickBuilderN Offline
    NickBuilder
    wrote on last edited by
    #4

    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!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Justin Rich
      wrote on last edited by
      #5

      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

      1 Reply Last reply
      0
      • tlpeterT Offline
        tlpeterT Offline
        tlpeter
        wrote on last edited by tlpeter
        #6

        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);```
        Nca78N HonkH Boots33B 3 Replies Last reply
        0
        • tlpeterT tlpeter

          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);```
          Nca78N Offline
          Nca78N Offline
          Nca78
          Hardware Contributor
          wrote on last edited by
          #7

          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.

          1 Reply Last reply
          0
          • tlpeterT tlpeter

            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);```
            HonkH Offline
            HonkH Offline
            Honk
            wrote on last edited by
            #8

            @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
            alt text
            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;
                }
              }
            
            tlpeterT 1 Reply Last reply
            0
            • tlpeterT Offline
              tlpeterT Offline
              tlpeter
              wrote on last edited by
              #9

              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.
              
              1 Reply Last reply
              0
              • HonkH Honk

                @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
                alt text
                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;
                    }
                  }
                
                tlpeterT Offline
                tlpeterT Offline
                tlpeter
                wrote on last edited by
                #10

                @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
                alt text
                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.

                1 Reply Last reply
                0
                • tlpeterT tlpeter

                  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);```
                  Boots33B Offline
                  Boots33B Offline
                  Boots33
                  Hero Member
                  wrote on last edited by Boots33
                  #11

                  @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

                  0_1470911411126_DallasTemperature.zip

                  1 Reply Last reply
                  0
                  • Nca78N Offline
                    Nca78N Offline
                    Nca78
                    Hardware Contributor
                    wrote on last edited by
                    #12
                    error: 'int16_t DallasTemperature::millisToWaitForConversion(uint8_t)' is private
                    

                    You 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.

                    1 Reply Last reply
                    0
                    • tlpeterT Offline
                      tlpeterT Offline
                      tlpeter
                      wrote on last edited by
                      #13

                      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?

                      Nca78N 1 Reply Last reply
                      0
                      • tbowmoT Offline
                        tbowmoT Offline
                        tbowmo
                        Admin
                        wrote on last edited by
                        #14

                        It's not related to mysensors core library.

                        Also, as mentioned before in this thread, the Dallas library that is in the arduino examples repository, is working.

                        Are you sure that you are using the right libraries?

                        1 Reply Last reply
                        0
                        • tlpeterT Offline
                          tlpeterT Offline
                          tlpeter
                          wrote on last edited by tlpeter
                          #15

                          I tihnk so, i used libraries that i was pointed too as they are moved.
                          All other sensors i have been playing with are working fine.

                          1 Reply Last reply
                          0
                          • tlpeterT tlpeter

                            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?

                            Nca78N Offline
                            Nca78N Offline
                            Nca78
                            Hardware Contributor
                            wrote on last edited by
                            #16

                            @tlpeter it is because now the libraries which are not managed by MySensors project were moved to another repository. It means if you only updated MySensors, you kept the old libraries.

                            1 Reply Last reply
                            0
                            • tlpeterT Offline
                              tlpeterT Offline
                              tlpeter
                              wrote on last edited by
                              #17

                              I removed everything and started from scratch and after that i copied the mysensors-master library.

                              Nca78N 1 Reply Last reply
                              0
                              • tlpeterT tlpeter

                                I removed everything and started from scratch and after that i copied the mysensors-master library.

                                Nca78N Offline
                                Nca78N Offline
                                Nca78
                                Hardware Contributor
                                wrote on last edited by
                                #18

                                @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

                                1 Reply Last reply
                                0
                                • tlpeterT Offline
                                  tlpeterT Offline
                                  tlpeter
                                  wrote on last edited by
                                  #19

                                  I uninstalled that too.
                                  I really removed everything.
                                  Uninstalled arduino and removed the folders in the program files folder and the my documents folder too.

                                  1 Reply Last reply
                                  0
                                  • HonkH Offline
                                    HonkH Offline
                                    Honk
                                    wrote on last edited by
                                    #20

                                    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;
                                        }
                                    }
                                    
                                    1 Reply Last reply
                                    0
                                    • tbowmoT Offline
                                      tbowmoT Offline
                                      tbowmo
                                      Admin
                                      wrote on last edited by
                                      #21

                                      @tlpeter

                                      Ok, so you are using a newer version of the DallasTemperature library, than the one that we have supplied in our MySensorsArduinoExamples. And yes, it seems that they have made millisToWaitForConversion() a private function there. Or someone has changed the library we included in our repository at some point in time, so it is made public.

                                      There are 2 options, as I see it :)

                                      1. Use the library that we have supplied in MySensorsArduinoExamples
                                      2. Make a PR against the original library, found here, and make the millisToWaitForConversion() public, and get them to release a new version of the library.

                                      :)

                                      mfalkviddM 1 Reply Last reply
                                      0
                                      • tbowmoT tbowmo

                                        @tlpeter

                                        Ok, so you are using a newer version of the DallasTemperature library, than the one that we have supplied in our MySensorsArduinoExamples. And yes, it seems that they have made millisToWaitForConversion() a private function there. Or someone has changed the library we included in our repository at some point in time, so it is made public.

                                        There are 2 options, as I see it :)

                                        1. Use the library that we have supplied in MySensorsArduinoExamples
                                        2. Make a PR against the original library, found here, and make the millisToWaitForConversion() public, and get them to release a new version of the library.

                                        :)

                                        mfalkviddM Offline
                                        mfalkviddM Offline
                                        mfalkvidd
                                        Mod
                                        wrote on last edited by
                                        #22

                                        The millisToWaitForConversion has always been private in milesburton's library, so the answer is the latter: someone has changed the library we included in our repository at some point in time.

                                        I found the answer in git:

                                        commit e47e596075282b122ac5d266ec6ad5c60ca8c978
                                        Author: Robo Print <roboprint@users.noreply.github.com>
                                        Date:   Sat Jun 27 23:00:37 2015 +0200
                                        
                                            Make DallasTemperature::millisToWaitForConversion() publicly available
                                        

                                        I agree with tbowmo's options.

                                        1 Reply Last reply
                                        0
                                        • R Offline
                                          R Offline
                                          robosensor
                                          wrote on last edited by
                                          #23

                                          It's my code :scream:

                                          I changed this method from private to public, this function is used to determine wait time needed for right non-blocking wait call. Seems like I should make PR to original library instead of modifying MYS copy.

                                          1 Reply Last reply
                                          4
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          13

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular