Temperature sensor issu ( Maybe something with 2.0 vs 2.1.1 library)



  • Hi, I try to compile the code i fond here : Temperature Sensor

    but the arduin does not seam to be able to talk with my gateway ...

    first i tought it was an issue with the radio but i try the same thing on another sensor i made 3 mounth ago and it was fine ...

    I compile the code with the 2.1.1 library because 2.0 gave me some error ... is it possible that why it can talk to the gateway ?

    I don't want to update my gateway is it possible to compile it with 2.0 library ?

    this is the error i got in 2.0

    Arduino:1.8.3 (Windows 10), Carte : "Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"
    
    C:\Users\dbonneau\Documents\Arduino\libraries\DallasTemperature\examples\DallasTemperatureSensor\DallasTemperatureSensor.ino: In function 'void loop()':
    
    DallasTemperatureSensor:94: error: 'getControllerConfig' was not declared in this scope
    
         float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
                                                                                      ^
    
    exit status 1
    'getControllerConfig' was not declared in this scope
    

    and this is the log on 2.1.1

    10033 TSM:FAIL:RE-INIT
    10035 TSM:INIT
    10041 !TSM:INIT:TSP FAIL
    10043 TSM:FAIL:CNT=2
    10047 TSM:FAIL:PDT
    20051 TSM:FAIL:RE-INIT
    20054 TSM:INIT
    20060 !TSM:INIT:TSP FAIL
    20062 TSM:FAIL:CNT=3
    20066 TSM:FAIL:PDT
    30070 TSM:FAIL:RE-INIT
    30072 TSM:INIT
    30078 !TSM:INIT:TSP FAIL
    30083 TSM:FAIL:CNT=4
    30085 TSM:FAIL:PDT
    40089 TSM:FAIL:RE-INIT
    40091 TSM:INIT
    40097 !TSM:INIT:TSP FAIL
    40099 TSM:FAIL:CNT=5
    40103 TSM:FAIL:PDT
    


  • @Dominic-Bonneau In 2.0 it was just called getConfig. Change this

        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
    

    to this

        float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
    

    and you shouldn't get that error. Can't say for sure you wont get others though.


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 1
  • 2
  • 5
  • 1

66
Online

11.4k
Users

11.1k
Topics

112.7k
Posts