From 421ebcc8b2467f1603bdde9a280559c484157037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 10 Apr 2023 23:20:02 +0100 Subject: [PATCH 1/3] use PRIx macros for printing u32/i32 ints (#4671) This fix compilation issues with the latest esp-idf. --- esphome/components/api/api_connection.cpp | 3 ++- esphome/components/api/proto.cpp | 19 ++++++++++--------- esphome/components/esp32/gpio.cpp | 3 ++- esphome/components/esp32/preferences.cpp | 3 ++- esphome/components/i2c/i2c_bus_esp_idf.cpp | 3 ++- esphome/components/logger/logger.cpp | 3 ++- esphome/components/wifi/wifi_component.cpp | 3 ++- .../wifi/wifi_component_esp_idf.cpp | 3 ++- esphome/core/scheduler.cpp | 5 +++-- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 77ba96291a..104560771e 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1,5 +1,6 @@ #include "api_connection.h" #include +#include #include "esphome/components/network/util.h" #include "esphome/core/entity_base.h" #include "esphome/core/hal.h" @@ -911,7 +912,7 @@ HelloResponse APIConnection::hello(const HelloRequest &msg) { this->helper_->set_log_info(client_info_); this->client_api_version_major_ = msg.api_version_major; this->client_api_version_minor_ = msg.api_version_minor; - ESP_LOGV(TAG, "Hello from client: '%s' | API Version %d.%d", this->client_info_.c_str(), + ESP_LOGV(TAG, "Hello from client: '%s' | API Version %" PRIu32 ".%" PRIu32, this->client_info_.c_str(), this->client_api_version_major_, this->client_api_version_minor_); HelloResponse resp; diff --git a/esphome/components/api/proto.cpp b/esphome/components/api/proto.cpp index ca7a4c0887..7af2e92534 100644 --- a/esphome/components/api/proto.cpp +++ b/esphome/components/api/proto.cpp @@ -1,4 +1,5 @@ #include "proto.h" +#include #include "esphome/core/log.h" namespace esphome { @@ -13,7 +14,7 @@ void ProtoMessage::decode(const uint8_t *buffer, size_t length) { uint32_t consumed; auto res = ProtoVarInt::parse(&buffer[i], length - i, &consumed); if (!res.has_value()) { - ESP_LOGV(TAG, "Invalid field start at %u", i); + ESP_LOGV(TAG, "Invalid field start at %" PRIu32, i); break; } @@ -25,12 +26,12 @@ void ProtoMessage::decode(const uint8_t *buffer, size_t length) { case 0: { // VarInt res = ProtoVarInt::parse(&buffer[i], length - i, &consumed); if (!res.has_value()) { - ESP_LOGV(TAG, "Invalid VarInt at %u", i); + ESP_LOGV(TAG, "Invalid VarInt at %" PRIu32, i); error = true; break; } if (!this->decode_varint(field_id, *res)) { - ESP_LOGV(TAG, "Cannot decode VarInt field %u with value %u!", field_id, res->as_uint32()); + ESP_LOGV(TAG, "Cannot decode VarInt field %" PRIu32 " with value %" PRIu32 "!", field_id, res->as_uint32()); } i += consumed; break; @@ -38,38 +39,38 @@ void ProtoMessage::decode(const uint8_t *buffer, size_t length) { case 2: { // Length-delimited res = ProtoVarInt::parse(&buffer[i], length - i, &consumed); if (!res.has_value()) { - ESP_LOGV(TAG, "Invalid Length Delimited at %u", i); + ESP_LOGV(TAG, "Invalid Length Delimited at %" PRIu32, i); error = true; break; } uint32_t field_length = res->as_uint32(); i += consumed; if (field_length > length - i) { - ESP_LOGV(TAG, "Out-of-bounds Length Delimited at %u", i); + ESP_LOGV(TAG, "Out-of-bounds Length Delimited at %" PRIu32, i); error = true; break; } if (!this->decode_length(field_id, ProtoLengthDelimited(&buffer[i], field_length))) { - ESP_LOGV(TAG, "Cannot decode Length Delimited field %u!", field_id); + ESP_LOGV(TAG, "Cannot decode Length Delimited field %" PRIu32 "!", field_id); } i += field_length; break; } case 5: { // 32-bit if (length - i < 4) { - ESP_LOGV(TAG, "Out-of-bounds Fixed32-bit at %u", i); + ESP_LOGV(TAG, "Out-of-bounds Fixed32-bit at %" PRIu32, i); error = true; break; } uint32_t val = encode_uint32(buffer[i + 3], buffer[i + 2], buffer[i + 1], buffer[i]); if (!this->decode_32bit(field_id, Proto32Bit(val))) { - ESP_LOGV(TAG, "Cannot decode 32-bit field %u with value %u!", field_id, val); + ESP_LOGV(TAG, "Cannot decode 32-bit field %" PRIu32 " with value %" PRIu32 "!", field_id, val); } i += 4; break; } default: - ESP_LOGV(TAG, "Invalid field type at %u", i); + ESP_LOGV(TAG, "Invalid field type at %" PRIu32, i); error = true; break; } diff --git a/esphome/components/esp32/gpio.cpp b/esphome/components/esp32/gpio.cpp index aafdf80726..7896597d3e 100644 --- a/esphome/components/esp32/gpio.cpp +++ b/esphome/components/esp32/gpio.cpp @@ -2,6 +2,7 @@ #include "gpio.h" #include "esphome/core/log.h" +#include namespace esphome { namespace esp32 { @@ -74,7 +75,7 @@ void ESP32InternalGPIOPin::attach_interrupt(void (*func)(void *), void *arg, gpi std::string ESP32InternalGPIOPin::dump_summary() const { char buffer[32]; - snprintf(buffer, sizeof(buffer), "GPIO%u", static_cast(pin_)); + snprintf(buffer, sizeof(buffer), "GPIO%" PRIu32, static_cast(pin_)); return buffer; } diff --git a/esphome/components/esp32/preferences.cpp b/esphome/components/esp32/preferences.cpp index 6a6305cf87..f90b8a4603 100644 --- a/esphome/components/esp32/preferences.cpp +++ b/esphome/components/esp32/preferences.cpp @@ -5,6 +5,7 @@ #include "esphome/core/log.h" #include #include +#include #include #include @@ -101,7 +102,7 @@ class ESP32Preferences : public ESPPreferences { pref->nvs_handle = nvs_handle; uint32_t keyval = type; - pref->key = str_sprintf("%u", keyval); + pref->key = str_sprintf("%" PRIu32, keyval); return ESPPreferenceObject(pref); } diff --git a/esphome/components/i2c/i2c_bus_esp_idf.cpp b/esphome/components/i2c/i2c_bus_esp_idf.cpp index 1e2a7304f2..5178f6d4f2 100644 --- a/esphome/components/i2c/i2c_bus_esp_idf.cpp +++ b/esphome/components/i2c/i2c_bus_esp_idf.cpp @@ -5,6 +5,7 @@ #include "esphome/core/log.h" #include "esphome/core/helpers.h" #include +#include namespace esphome { namespace i2c { @@ -47,7 +48,7 @@ void IDFI2CBus::dump_config() { ESP_LOGCONFIG(TAG, "I2C Bus:"); ESP_LOGCONFIG(TAG, " SDA Pin: GPIO%u", this->sda_pin_); ESP_LOGCONFIG(TAG, " SCL Pin: GPIO%u", this->scl_pin_); - ESP_LOGCONFIG(TAG, " Frequency: %u Hz", this->frequency_); + ESP_LOGCONFIG(TAG, " Frequency: %" PRIu32 " Hz", this->frequency_); switch (this->recovery_result_) { case RECOVERY_COMPLETED: ESP_LOGCONFIG(TAG, " Recovery: bus successfully recovered"); diff --git a/esphome/components/logger/logger.cpp b/esphome/components/logger/logger.cpp index 8a3c6a951d..c77e280711 100644 --- a/esphome/components/logger/logger.cpp +++ b/esphome/components/logger/logger.cpp @@ -1,4 +1,5 @@ #include "logger.h" +#include #ifdef USE_ESP_IDF #include @@ -292,7 +293,7 @@ const char *const UART_SELECTIONS[] = {"UART0", "UART1", "USB_CDC"}; void Logger::dump_config() { ESP_LOGCONFIG(TAG, "Logger:"); ESP_LOGCONFIG(TAG, " Level: %s", LOG_LEVELS[ESPHOME_LOG_LEVEL]); - ESP_LOGCONFIG(TAG, " Log Baud Rate: %u", this->baud_rate_); + ESP_LOGCONFIG(TAG, " Log Baud Rate: %" PRIu32, this->baud_rate_); ESP_LOGCONFIG(TAG, " Hardware UART: %s", UART_SELECTIONS[this->uart_]); for (auto &it : this->log_levels_) { ESP_LOGCONFIG(TAG, " Level for '%s': %s", it.tag.c_str(), LOG_LEVELS[it.level]); diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index d4636c81cd..efb1af171d 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -1,4 +1,5 @@ #include "wifi_component.h" +#include #if defined(USE_ESP32) || defined(USE_ESP_IDF) #include @@ -370,7 +371,7 @@ void WiFiComponent::print_connect_params_() { if (this->selected_ap_.get_bssid().has_value()) { ESP_LOGV(TAG, " Priority: %.1f", this->get_sta_priority(*this->selected_ap_.get_bssid())); } - ESP_LOGCONFIG(TAG, " Channel: %d", wifi_channel_()); + ESP_LOGCONFIG(TAG, " Channel: %" PRId32, wifi_channel_()); ESP_LOGCONFIG(TAG, " Subnet: %s", wifi_subnet_mask_().str().c_str()); ESP_LOGCONFIG(TAG, " Gateway: %s", wifi_gateway_ip_().str().c_str()); ESP_LOGCONFIG(TAG, " DNS1: %s", wifi_dns_ip_(0).str().c_str()); diff --git a/esphome/components/wifi/wifi_component_esp_idf.cpp b/esphome/components/wifi/wifi_component_esp_idf.cpp index 0f3c3a0ca8..1edde74743 100644 --- a/esphome/components/wifi/wifi_component_esp_idf.cpp +++ b/esphome/components/wifi/wifi_component_esp_idf.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #ifdef USE_WIFI_WPA2_EAP @@ -666,7 +667,7 @@ void WiFiComponent::wifi_process_event_(IDFWiFiEvent *data) { } else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_SCAN_DONE) { const auto &it = data->data.sta_scan_done; - ESP_LOGV(TAG, "Event: WiFi Scan Done status=%u number=%u scan_id=%u", it.status, it.number, it.scan_id); + ESP_LOGV(TAG, "Event: WiFi Scan Done status=%" PRIu32 " number=%u scan_id=%u", it.status, it.number, it.scan_id); scan_result_.clear(); this->scan_done_ = true; diff --git a/esphome/core/scheduler.cpp b/esphome/core/scheduler.cpp index 0cb148ec13..7c76c8490b 100644 --- a/esphome/core/scheduler.cpp +++ b/esphome/core/scheduler.cpp @@ -3,6 +3,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/hal.h" #include +#include namespace esphome { @@ -194,8 +195,8 @@ void HOT Scheduler::call() { // The following should not happen unless I'm missing something if (to_remove_ != 0) { - ESP_LOGW(TAG, "to_remove_ was %u now: %u items where %zu now %zu. Please report this", to_remove_was, to_remove_, - items_was, items_.size()); + ESP_LOGW(TAG, "to_remove_ was %" PRIu32 " now: %" PRIu32 " items where %zu now %zu. Please report this", + to_remove_was, to_remove_, items_was, items_.size()); to_remove_ = 0; } } From 888ac2e1802165965d99e9bb7537b772bb8c4a98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:29:22 +1200 Subject: [PATCH 2/3] Bump zeroconf from 0.47.4 to 0.56.0 (#4674) Bumps [zeroconf](https://github.com/python-zeroconf/python-zeroconf) from 0.47.4 to 0.56.0. - [Release notes](https://github.com/python-zeroconf/python-zeroconf/releases) - [Changelog](https://github.com/python-zeroconf/python-zeroconf/blob/master/CHANGELOG.md) - [Commits](https://github.com/python-zeroconf/python-zeroconf/compare/0.47.4...0.56.0) --- updated-dependencies: - dependency-name: zeroconf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5b37be15ae..5a57342189 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ esptool==4.5.1 click==8.1.3 esphome-dashboard==20230214.0 aioesphomeapi==13.5.1 -zeroconf==0.47.4 +zeroconf==0.56.0 # esp-idf requires this, but doesn't bundle it by default # https://github.com/espressif/esp-idf/blob/220590d599e134d7a5e7f1e683cc4550349ffbf8/requirements.txt#L24 From 80bc567c31f0b2e71e4b8750143e05d1a41de568 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 22:29:40 +0000 Subject: [PATCH 3/3] Bump pytest from 7.2.2 to 7.3.0 (#4673) Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.0) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index cbd0a75d8f..b063dd2797 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,7 +5,7 @@ pyupgrade==3.3.1 # also change in .pre-commit-config.yaml when updating pre-commit # Unit tests -pytest==7.2.2 +pytest==7.3.0 pytest-cov==4.0.0 pytest-mock==3.10.0 pytest-asyncio==0.21.0