From 1fa14790ba8ebc2928cbc550c2d228575e882f30 Mon Sep 17 00:00:00 2001 From: liamHowatt Date: Wed, 28 Aug 2024 00:10:26 -0400 Subject: [PATCH] check structs for alternative name --- gen/gen_mpy.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gen/gen_mpy.py b/gen/gen_mpy.py index 0470caa92..0b8437e27 100644 --- a/gen/gen_mpy.py +++ b/gen/gen_mpy.py @@ -1871,6 +1871,12 @@ def get_user_data(func, func_name = None, containing_struct = None, containing_s # print('/* --> callback: user_data=%s user_data_found=%s containing_struct=%s */' % (user_data, user_data_found, containing_struct)) if not user_data_found and lvgl_json is not None: containing_struct_j = next((struct for struct in lvgl_json["structures"] if struct["name"] == struct_arg_type_name), None) + if (containing_struct_j is None + and struct_arg_type_name.startswith("lv_") + and None is not next((fwd_decl for fwd_decl in lvgl_json["forward_decls"] if fwd_decl["name"] == struct_arg_type_name), None) + ): + struct_arg_type_name_with_underscore = "_" + struct_arg_type_name + containing_struct_j = next((struct for struct in lvgl_json["structures"] if struct["name"] == struct_arg_type_name_with_underscore), None) if containing_struct_j is not None: user_data_found = any(user_data == field["name"] for field in containing_struct_j["fields"]) return (user_data if user_data_found else None), *get_user_data_accessors(containing_struct, containing_struct_name)