@@ -43,9 +43,11 @@ static void sensor_detect(void)
4343 search_result = onewire_device_iter_get_next (iter , & next_onewire_device );
4444 if (search_result == ESP_OK ) { // found a new device, let's check if we can upgrade it to a DS18B20
4545 ds18b20_config_t ds_cfg = {};
46+ onewire_device_address_t address ;
4647 // check if the device is a DS18B20, if so, return the ds18b20 handle
4748 if (ds18b20_new_device (& next_onewire_device , & ds_cfg , & s_ds18b20s [s_ds18b20_device_num ]) == ESP_OK ) {
48- ESP_LOGI (TAG , "Found a DS18B20[%d], address: %016llX" , s_ds18b20_device_num , next_onewire_device .address );
49+ ds18b20_get_device_address (s_ds18b20s [s_ds18b20_device_num ], & address );
50+ ESP_LOGI (TAG , "Found a DS18B20[%d], address: %016llX" , s_ds18b20_device_num , address );
4951 s_ds18b20_device_num ++ ;
5052 } else {
5153 ESP_LOGI (TAG , "Found an unknown device, address: %016llX" , next_onewire_device .address );
@@ -58,10 +60,10 @@ static void sensor_detect(void)
5860
5961void sensor_read (void )
6062{
61- for (int i = 0 ; i < s_ds18b20_device_num ; i ++ ) {
63+ for (int i = 0 ; i < s_ds18b20_device_num ; i ++ ) {
6264 ESP_ERROR_CHECK (ds18b20_trigger_temperature_conversion (s_ds18b20s [i ]));
6365 ESP_ERROR_CHECK (ds18b20_get_temperature (s_ds18b20s [i ], & s_temperature ));
64- ESP_LOGI (TAG , "temperature read from DS18B20[%d]: %.2fC" , i , s_temperature );
66+ ESP_LOGI (TAG , "Temperature read from DS18B20[%d]: %.2fC" , i , s_temperature );
6567 }
6668}
6769
0 commit comments