sensor_ds18b20: fix set precision for single device
This commit is contained in:
parent
58ef5f3d1b
commit
c085f2d292
|
@ -109,8 +109,14 @@ float sensor_ds18b20_temperature(uint64_t code)
|
|||
}
|
||||
|
||||
// send ROM command to select slave
|
||||
if (!onewire_master_rom_match(code)) { // select specific slave
|
||||
return NAN; // ROM command failed
|
||||
if (0 == code) { // broadcast convert
|
||||
if (!onewire_master_rom_skip()) { // select all slaves
|
||||
return false; // ROM command failed
|
||||
}
|
||||
} else {
|
||||
if (!onewire_master_rom_match(code)) { // select specific slave
|
||||
return false; // ROM command failed
|
||||
}
|
||||
}
|
||||
|
||||
// read scratchpad to get temperature (on byte 0 and 1)
|
||||
|
|
|
@ -36,7 +36,7 @@ bool sensor_ds18b20_convert(uint64_t code);
|
|||
*/
|
||||
float sensor_ds18b20_temperature(uint64_t code);
|
||||
/** set conversion precision
|
||||
* @param[in] code ROM code of sensor to start conversion on (0 for all, if only DS18B20 sensors are on the bus)
|
||||
* @param[in] code ROM code of sensor to start conversion on (0 for single DS18B20 sensor are on the bus)
|
||||
* @param[in] precision precision in bits (9-12)
|
||||
* @return if operation succeeded
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue