milesburton / Arduino-Temperature-Control-Library

Arduino Temperature Library

Home Page:https://www.milesburton.com/w/index.php/Dallas_Temperature_Control_Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultiPin (timing?)-Problem when using setResolution()

stif opened this issue · comments

commented

I am testing with the TwoPin_DS18B20.ino Example and both Sensors are working as expected.

But when i add following code in setup() function after sensor.begin():

if(sensor_inhouse.getAddress(inAdd, 0)) {
    sensor_inhouse.setResolution(inAdd, 12);
  }
  if(sensor_outhouse.getAddress(outAddr, 0)) {
    sensor_outhouse.setResolution(outAddr, 12);
  }

the reading of the first sensor who executes the requestTemperatures function is stuck (i get a response, but always the same value regardless of real temperature). the sensor which executes the requestTemperatures function the line beneath the first one is ok. if i swap these 2 lines it is still the first sensor in code appearance which get stuck. eg.:

sensorX.requestTemperatures(); <- this sensor is stuck
sensorY.requestTemperatures(); <- this one is ok

Also it does not matter if the resolution is set to 9, 10, 11 or 12. If setResolution is executed the first sensor who do a requestTemperatures is stuck. If setResolution is not executed, both sensors work as they should.

Workaround:
Just set the setResolution and upload the sketch. Then comment out the setResolution function and upload again. The Sensor will remember the resolution from previous upload and when the setResolution function is not executed in the actual Sketch both Sensors work as expected with wanted resolution..

PS: I am working with latest PlatformIO and ESP32.