diff --git a/CMakeLists.txt b/CMakeLists.txt index f19c761..1e87312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,4 +6,4 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp32-ds18b20-example) # Ignore false clang warnings about `struct foo = { 0 }` -target_compile_options(main PRIVATE -Wno-missing-braces -Wmissing-field-initializers) +target_compile_options(${IDF_PROJECT_EXECUTABLE} PRIVATE -Wno-missing-braces -Wmissing-field-initializers) diff --git a/components/esp32-ds18b20 b/components/esp32-ds18b20 index 331cadf..d76b70c 160000 --- a/components/esp32-ds18b20 +++ b/components/esp32-ds18b20 @@ -1 +1 @@ -Subproject commit 331cadf2e25c004b5506d329979ac3f7d4998a5d +Subproject commit d76b70c0a795adbbd1b9d1b3e2789b455cfd945d diff --git a/components/esp32-owb b/components/esp32-owb index de012fd..af25dd3 160000 --- a/components/esp32-owb +++ b/components/esp32-owb @@ -1 +1 @@ -Subproject commit de012fd1deeb9aff194bc8e32e1dee725258c022 +Subproject commit af25dd31dbb1e80364b99fad29815badfab0ceda diff --git a/main/app_main.c b/main/app_main.c index a15ee6a..d0705ec 100644 --- a/main/app_main.c +++ b/main/app_main.c @@ -43,8 +43,9 @@ void app_main() // Override global log level esp_log_level_set("*", ESP_LOG_INFO); - // To debug OWB, use 'make menuconfig' to set default Log level to DEBUG, then uncomment: + // To debug, use 'make menuconfig' to set default Log level to DEBUG, then uncomment: //esp_log_level_set("owb", ESP_LOG_DEBUG); + //esp_log_level_set("ds18b20", ESP_LOG_DEBUG); // Stable readings require a brief period before communication vTaskDelay(2000.0 / portTICK_PERIOD_MS); @@ -133,7 +134,7 @@ void app_main() { ds18b20_init(ds18b20_info, owb, device_rom_codes[i]); // associate with bus and device } - ds18b20_use_crc(ds18b20_info, true); // enable CRC check for temperature readings + ds18b20_use_crc(ds18b20_info, true); // enable CRC check on all reads ds18b20_set_resolution(ds18b20_info, DS18B20_RESOLUTION); } @@ -191,6 +192,10 @@ void app_main() vTaskDelayUntil(&last_wake_time, SAMPLE_PERIOD / portTICK_PERIOD_MS); } } + else + { + printf("\nNo DS18B20 devices detected!\n"); + } // clean up dynamically allocated data for (int i = 0; i < num_devices; ++i)