From 363d811cc1f9818c394f3b5f3b8db74699042dea Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 3 Apr 2026 12:27:55 -1000 Subject: [PATCH] [api] Use _get_simple_size_calculation for FixedArrayBytesType fallback Replace inline calc_length/calc_length_force formatting with the existing helper method. --- script/api_protobuf/api_protobuf.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/script/api_protobuf/api_protobuf.py b/script/api_protobuf/api_protobuf.py index 66e3182375b..4012db336e2 100755 --- a/script/api_protobuf/api_protobuf.py +++ b/script/api_protobuf/api_protobuf.py @@ -1270,12 +1270,7 @@ class FixedArrayBytesType(TypeInfo): length_field, force, extra_expr=length_field ) - field_id_size = self.calculate_field_id_size() - if force: - # For repeated fields, always calculate size (no zero check) - return f"size += ProtoSize::calc_length_force({field_id_size}, {length_field});" - # For non-repeated fields, length already checks for zero - return f"size += ProtoSize::calc_length({field_id_size}, {length_field});" + return self._get_simple_size_calculation(length_field, force, "length") def get_estimated_size(self) -> int: # Estimate based on typical BLE advertisement size