1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00

Make ProtoSize an object

This commit is contained in:
J. Nick Koston
2025-07-26 14:09:17 -10:00
parent 1032e5c220
commit 33ec5e195f

View File

@@ -290,8 +290,9 @@ uint16_t APIConnection::encode_message_to_buffer(ProtoMessage &msg, uint8_t mess
#endif
// Calculate size
uint32_t calculated_size = 0;
msg.calculate_size(calculated_size);
ProtoSize size_calc;
msg.calculate_size(size_calc);
uint32_t calculated_size = size_calc.get_size();
// Cache frame sizes to avoid repeated virtual calls
const uint8_t header_padding = conn->helper_->frame_header_padding();