From fb1bc3d62713288cc23fd0d16e47161b08f78719 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Jun 2025 07:24:09 +0100 Subject: [PATCH] remove broken code --- esphome/components/api/api_connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 70f4fc8628..02ce4e69e4 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -261,7 +261,7 @@ APIConnection::EncodedMessage APIConnection::encode_message_to_buffer(ProtoMessa // Calculate overhead for this message uint16_t overhead = conn->helper_->calculate_packet_overhead(message_type, static_cast(size)); - uint32_t total_size = size + overhead; + uint16_t total_size = static_cast(size) + overhead; // Check if it fits if (total_size > remaining_size) { @@ -274,7 +274,7 @@ APIConnection::EncodedMessage APIConnection::encode_message_to_buffer(ProtoMessa // Encode directly into buffer msg.encode(buffer); - return {static_cast(size), static_cast(total_size)}; + return {static_cast(size), total_size}; } #ifdef USE_BINARY_SENSOR