From f7f63c9da1405024710e98c0927863aeddf454c7 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Sun, 29 Oct 2023 00:49:19 -0500 Subject: [PATCH] IDF 5 fixes for various components from test4.yaml (#5622) --- .../esp32_camera_web_server/camera_web_server.cpp | 6 +++--- .../components/esp32_camera_web_server/camera_web_server.h | 1 + esphome/components/tuya/tuya.cpp | 6 +++--- esphome/components/tuya/tuya.h | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/esphome/components/esp32_camera_web_server/camera_web_server.cpp b/esphome/components/esp32_camera_web_server/camera_web_server.cpp index 3210989ff5..7ca0c56d23 100644 --- a/esphome/components/esp32_camera_web_server/camera_web_server.cpp +++ b/esphome/components/esp32_camera_web_server/camera_web_server.cpp @@ -194,8 +194,8 @@ esp_err_t CameraWebServer::streaming_handler_(struct httpd_req *req) { int64_t frame_time = millis() - last_frame; last_frame = millis(); - ESP_LOGD(TAG, "MJPG: %uB %ums (%.1ffps)", (uint32_t) image->get_data_length(), (uint32_t) frame_time, - 1000.0 / (uint32_t) frame_time); + ESP_LOGD(TAG, "MJPG: %" PRIu32 "B %" PRIu32 "ms (%.1ffps)", (uint32_t) image->get_data_length(), + (uint32_t) frame_time, 1000.0 / (uint32_t) frame_time); } } @@ -205,7 +205,7 @@ esp_err_t CameraWebServer::streaming_handler_(struct httpd_req *req) { esp32_camera::global_esp32_camera->stop_stream(esphome::esp32_camera::WEB_REQUESTER); - ESP_LOGI(TAG, "STREAM: closed. Frames: %u", frames); + ESP_LOGI(TAG, "STREAM: closed. Frames: %" PRIu32, frames); return res; } diff --git a/esphome/components/esp32_camera_web_server/camera_web_server.h b/esphome/components/esp32_camera_web_server/camera_web_server.h index 509ca81592..f65625554c 100644 --- a/esphome/components/esp32_camera_web_server/camera_web_server.h +++ b/esphome/components/esp32_camera_web_server/camera_web_server.h @@ -2,6 +2,7 @@ #ifdef USE_ESP32 +#include #include #include diff --git a/esphome/components/tuya/tuya.cpp b/esphome/components/tuya/tuya.cpp index daf5080e7a..da03e3faad 100644 --- a/esphome/components/tuya/tuya.cpp +++ b/esphome/components/tuya/tuya.cpp @@ -61,7 +61,7 @@ void Tuya::dump_config() { } else if (info.type == TuyaDatapointType::ENUM) { ESP_LOGCONFIG(TAG, " Datapoint %u: enum (value: %d)", info.id, info.value_enum); } else if (info.type == TuyaDatapointType::BITMASK) { - ESP_LOGCONFIG(TAG, " Datapoint %u: bitmask (value: %x)", info.id, info.value_bitmask); + ESP_LOGCONFIG(TAG, " Datapoint %u: bitmask (value: %" PRIx32 ")", info.id, info.value_bitmask); } else { ESP_LOGCONFIG(TAG, " Datapoint %u: unknown", info.id); } @@ -342,7 +342,7 @@ void Tuya::handle_datapoints_(const uint8_t *buffer, size_t len) { ESP_LOGW(TAG, "Datapoint %u has bad bitmask len %zu", datapoint.id, data_size); return; } - ESP_LOGD(TAG, "Datapoint %u update to %#08X", datapoint.id, datapoint.value_bitmask); + ESP_LOGD(TAG, "Datapoint %u update to %#08" PRIX32, datapoint.id, datapoint.value_bitmask); break; default: ESP_LOGW(TAG, "Datapoint %u has unknown type %#02hhX", datapoint.id, static_cast(datapoint.type)); @@ -594,7 +594,7 @@ optional Tuya::get_datapoint_(uint8_t datapoint_id) { void Tuya::set_numeric_datapoint_value_(uint8_t datapoint_id, TuyaDatapointType datapoint_type, const uint32_t value, uint8_t length, bool forced) { - ESP_LOGD(TAG, "Setting datapoint %u to %u", datapoint_id, value); + ESP_LOGD(TAG, "Setting datapoint %u to %" PRIu32, datapoint_id, value); optional datapoint = this->get_datapoint_(datapoint_id); if (!datapoint.has_value()) { ESP_LOGW(TAG, "Setting unknown datapoint %u", datapoint_id); diff --git a/esphome/components/tuya/tuya.h b/esphome/components/tuya/tuya.h index 26f6f65912..27a97c3dc9 100644 --- a/esphome/components/tuya/tuya.h +++ b/esphome/components/tuya/tuya.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "esphome/core/component.h" #include "esphome/core/defines.h" #include "esphome/core/helpers.h" @@ -10,8 +13,6 @@ #include "esphome/core/time.h" #endif -#include - namespace esphome { namespace tuya {