mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
Every message sent through send_message or the entity paths needed a proto_encode_msg<T> thunk (17 bytes on xtensa) and, for entity state and info messages, a calc_size<T> thunk, because the generated encode and calculate_size were member functions and the connection code wants plain function pointers over const void *. The generator now emits the bodies as static encode_msg(const void *) and calc_size_msg(const void *) functions, so &T::encode_msg is already a MessageEncodeFn and the thunks disappear. The member encode() and calculate_size() remain as inline forwarders for direct callers. ProtoMessage carries the same static defaults for messages without fields, which also removes the separate no-op encode thunk.