mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 14:43:51 +00:00
Streamline setup() logging (g, h, i) (#8927)
This commit is contained in:
@@ -66,7 +66,7 @@ void InternalTemperatureSensor::update() {
|
||||
esp_err_t result = temperature_sensor_get_celsius(tsensNew, &temperature);
|
||||
success = (result == ESP_OK);
|
||||
if (!success) {
|
||||
ESP_LOGE(TAG, "Failed to get temperature: %d", result);
|
||||
ESP_LOGE(TAG, "Reading failed (%d)", result);
|
||||
}
|
||||
#endif // ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||
#endif // USE_ESP32_VARIANT
|
||||
@@ -103,20 +103,20 @@ void InternalTemperatureSensor::setup() {
|
||||
(defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S2) || \
|
||||
defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32H2) || defined(USE_ESP32_VARIANT_ESP32C2) || \
|
||||
defined(USE_ESP32_VARIANT_ESP32P4))
|
||||
ESP_LOGCONFIG(TAG, "Setting up temperature sensor...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
temperature_sensor_config_t tsens_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(-10, 80);
|
||||
|
||||
esp_err_t result = temperature_sensor_install(&tsens_config, &tsensNew);
|
||||
if (result != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to install temperature sensor: %d", result);
|
||||
ESP_LOGE(TAG, "Install failed (%d)", result);
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
result = temperature_sensor_enable(tsensNew);
|
||||
if (result != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to enable temperature sensor: %d", result);
|
||||
ESP_LOGE(TAG, "Enabling failed (%d)", result);
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user