From dfaabfc98aa66ca2dd217cdd9d5bb6adc03b02fa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 31 Jan 2026 18:59:43 -0600 Subject: [PATCH] _strtod_l --- esphome/components/esphome/ota/ota_esphome.cpp | 2 +- esphome/components/http_request/ota/ota_http_request.cpp | 4 ++-- esphome/components/sensor/sensor.cpp | 2 +- esphome/components/web_server/ota/ota_web_server.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index df2ea98f2c8..ed21ed5cf30 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -331,7 +331,7 @@ void ESPHomeOTAComponent::handle_data_() { if (now - last_progress > 1000) { last_progress = now; float percentage = (total * 100.0f) / ota_size; - ESP_LOGD(TAG, "Progress: %0.1f%%", percentage); + ESP_LOGD(TAG, "Progress: %s%d.%d%%", DECIMAL_1(percentage)); #ifdef USE_OTA_STATE_LISTENER this->notify_state_(ota::OTA_IN_PROGRESS, percentage, 0); #endif diff --git a/esphome/components/http_request/ota/ota_http_request.cpp b/esphome/components/http_request/ota/ota_http_request.cpp index 8f4ecfab2db..ca88175cbd8 100644 --- a/esphome/components/http_request/ota/ota_http_request.cpp +++ b/esphome/components/http_request/ota/ota_http_request.cpp @@ -169,14 +169,14 @@ uint8_t OtaHttpRequestComponent::do_ota_() { if ((now - last_progress > 1000) or (container->get_bytes_read() == container->content_length)) { last_progress = now; float percentage = container->get_bytes_read() * 100.0f / container->content_length; - ESP_LOGD(TAG, "Progress: %0.1f%%", percentage); + ESP_LOGD(TAG, "Progress: %s%d.%d%%", DECIMAL_1(percentage)); #ifdef USE_OTA_STATE_LISTENER this->notify_state_(ota::OTA_IN_PROGRESS, percentage, 0); #endif } } // while - ESP_LOGI(TAG, "Done in %.0f seconds", float(millis() - update_start_time) / 1000); + ESP_LOGI(TAG, "Done in %d seconds", (int) (float(millis() - update_start_time) / 1000)); // verify MD5 is as expected and act accordingly md5_receive.calculate(); diff --git a/esphome/components/sensor/sensor.cpp b/esphome/components/sensor/sensor.cpp index ae2ee3e3d10..99e00f26b7e 100644 --- a/esphome/components/sensor/sensor.cpp +++ b/esphome/components/sensor/sensor.cpp @@ -66,7 +66,7 @@ void Sensor::publish_state(float state) { this->raw_state = state; this->raw_callback_.call(state); - ESP_LOGV(TAG, "'%s': Received new state %f", this->name_.c_str(), state); + ESP_LOGV(TAG, "'%s': Received new state %s%d.%02d", this->name_.c_str(), DECIMAL_2(state)); if (this->filter_list_ == nullptr) { this->internal_send_state_to_frontend(state); diff --git a/esphome/components/web_server/ota/ota_web_server.cpp b/esphome/components/web_server/ota/ota_web_server.cpp index 4be162ccd32..5c6b2c1c4fe 100644 --- a/esphome/components/web_server/ota/ota_web_server.cpp +++ b/esphome/components/web_server/ota/ota_web_server.cpp @@ -84,7 +84,7 @@ void OTARequestHandler::report_ota_progress_(AsyncWebServerRequest *request) { // access to the actual firmware size until the upload is complete. This is intentional // as it still gives the user a reasonable progress indication. percentage = (this->ota_read_length_ * 100.0f) / request->contentLength(); - ESP_LOGD(TAG, "OTA in progress: %0.1f%%", percentage); + ESP_LOGD(TAG, "OTA in progress: %s%d.%d%%", DECIMAL_1(percentage)); } else { ESP_LOGD(TAG, "OTA in progress: %" PRIu32 " bytes read", this->ota_read_length_); }