mirror of https://github.com/arendst/Tasmota.git
Berry ctypes small optimization
This commit is contained in:
parent
79b2ff4093
commit
af41d81c5a
|
@ -193,6 +193,7 @@ be_extern_native_class(md5);
|
||||||
be_extern_native_class(udp);
|
be_extern_native_class(udp);
|
||||||
be_extern_native_class(webclient);
|
be_extern_native_class(webclient);
|
||||||
be_extern_native_class(tcpclient);
|
be_extern_native_class(tcpclient);
|
||||||
|
be_extern_native_class(energy_struct);
|
||||||
// BLE
|
// BLE
|
||||||
be_extern_native_class(MI32);
|
be_extern_native_class(MI32);
|
||||||
be_extern_native_class(BLE);
|
be_extern_native_class(BLE);
|
||||||
|
@ -244,6 +245,9 @@ BERRY_LOCAL bclass_array be_class_table = {
|
||||||
&be_native_class(Leds),
|
&be_native_class(Leds),
|
||||||
&be_native_class(Leds_animator),
|
&be_native_class(Leds_animator),
|
||||||
#endif // USE_WS2812
|
#endif // USE_WS2812
|
||||||
|
#ifdef USE_ENERGY_SENSOR
|
||||||
|
&be_native_class(energy_struct),
|
||||||
|
#endif // USE_ENERGY_SENSOR
|
||||||
|
|
||||||
#ifdef USE_LVGL
|
#ifdef USE_LVGL
|
||||||
&be_native_class(LVGL_glob),
|
&be_native_class(LVGL_glob),
|
||||||
|
@ -291,7 +295,4 @@ BERRY_API void be_load_custom_libs(bvm *vm)
|
||||||
#if !BE_USE_PRECOMPILED_OBJECT
|
#if !BE_USE_PRECOMPILED_OBJECT
|
||||||
/* be_load_xxxlib(vm); */
|
/* be_load_xxxlib(vm); */
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_ENERGY_SENSOR
|
|
||||||
be_load_ctypes_energy_definitions_lib(vm); // ctype class
|
|
||||||
#endif // USE_ENERGY_SENSOR
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ typedef struct be_ctypes_classes_t {
|
||||||
|
|
||||||
BE_EXPORT_VARIABLE const bclass be_class_ctypes_bytes;
|
BE_EXPORT_VARIABLE const bclass be_class_ctypes_bytes;
|
||||||
|
|
||||||
static void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes_structure_t * definitions) {
|
static void ctypes_register_class(bvm *vm, const bclass * ctypes_class) {
|
||||||
be_pushntvclass(vm, ctypes_class);
|
be_pushntvclass(vm, ctypes_class);
|
||||||
be_setglobal(vm, str(ctypes_class->name));
|
be_setglobal(vm, str(ctypes_class->name));
|
||||||
be_pop(vm, 1);
|
be_pop(vm, 1);
|
||||||
|
|
|
@ -107,11 +107,6 @@ static const char * be_ctypes_instance_mappings[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static be_define_ctypes_class(energy_struct, &be_energy_struct, &be_class_ctypes_bytes, "energy_struct");
|
be_define_ctypes_class(energy_struct, &be_energy_struct, &be_class_ctypes_bytes, "energy_struct");
|
||||||
|
|
||||||
void be_load_ctypes_energy_definitions_lib(bvm *vm) {
|
|
||||||
ctypes_register_class(vm, &be_class_energy_struct, &be_energy_struct);
|
|
||||||
}
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
#endif // USE_ENERGY_SENSOR
|
#endif // USE_ENERGY_SENSOR
|
|
@ -742,50 +742,50 @@ static be_define_ctypes_class(lv_timer, &be_lv_timer, &be_class_ctypes_bytes, "l
|
||||||
static be_define_ctypes_class(lv_ts_calibration, &be_lv_ts_calibration, &be_class_ctypes_bytes, "lv_ts_calibration");
|
static be_define_ctypes_class(lv_ts_calibration, &be_lv_ts_calibration, &be_class_ctypes_bytes, "lv_ts_calibration");
|
||||||
|
|
||||||
void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
void be_load_ctypes_lvgl_definitions_lib(bvm *vm) {
|
||||||
ctypes_register_class(vm, &be_class_lv_area, &be_lv_area);
|
ctypes_register_class(vm, &be_class_lv_area);
|
||||||
ctypes_register_class(vm, &be_class_lv_chart_cursor, &be_lv_chart_cursor);
|
ctypes_register_class(vm, &be_class_lv_chart_cursor);
|
||||||
ctypes_register_class(vm, &be_class_lv_chart_series, &be_lv_chart_series);
|
ctypes_register_class(vm, &be_class_lv_chart_series);
|
||||||
ctypes_register_class(vm, &be_class_lv_chart_tick_dsc, &be_lv_chart_tick_dsc);
|
ctypes_register_class(vm, &be_class_lv_chart_tick_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_color_filter_dsc, &be_lv_color_filter_dsc);
|
ctypes_register_class(vm, &be_class_lv_color_filter_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_coord, &be_lv_coord);
|
ctypes_register_class(vm, &be_class_lv_coord);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_arc_dsc, &be_lv_draw_arc_dsc);
|
ctypes_register_class(vm, &be_class_lv_draw_arc_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_ctx, &be_lv_draw_ctx);
|
ctypes_register_class(vm, &be_class_lv_draw_ctx);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_img_dsc, &be_lv_draw_img_dsc);
|
ctypes_register_class(vm, &be_class_lv_draw_img_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_line_dsc, &be_lv_draw_line_dsc);
|
ctypes_register_class(vm, &be_class_lv_draw_line_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param, &be_lv_draw_mask_line_param);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param, &be_lv_draw_mask_map_param);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_polygon_param, &be_lv_draw_mask_polygon_param);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_polygon_param);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_polygon_param_cfg, &be_lv_draw_mask_polygon_param_cfg);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_polygon_param_cfg);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_circle_dsc, &be_lv_draw_mask_radius_circle_dsc);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_circle_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_mask_saved, &be_lv_draw_mask_saved);
|
ctypes_register_class(vm, &be_class_lv_draw_mask_saved);
|
||||||
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc, &be_lv_draw_rect_dsc);
|
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_event, &be_lv_event);
|
ctypes_register_class(vm, &be_class_lv_event);
|
||||||
ctypes_register_class(vm, &be_class_lv_grad_dsc, &be_lv_grad_dsc);
|
ctypes_register_class(vm, &be_class_lv_grad_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_gradient_stop, &be_lv_gradient_stop);
|
ctypes_register_class(vm, &be_class_lv_gradient_stop);
|
||||||
ctypes_register_class(vm, &be_class_lv_img_dsc, &be_lv_img_dsc);
|
ctypes_register_class(vm, &be_class_lv_img_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_img_header, &be_lv_img_header);
|
ctypes_register_class(vm, &be_class_lv_img_header);
|
||||||
ctypes_register_class(vm, &be_class_lv_meter_indicator, &be_lv_meter_indicator);
|
ctypes_register_class(vm, &be_class_lv_meter_indicator);
|
||||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_arc, &be_lv_meter_indicator_arc);
|
ctypes_register_class(vm, &be_class_lv_meter_indicator_arc);
|
||||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_img, &be_lv_meter_indicator_needle_img);
|
ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_img);
|
||||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_line, &be_lv_meter_indicator_needle_line);
|
ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_line);
|
||||||
ctypes_register_class(vm, &be_class_lv_meter_indicator_scale_lines, &be_lv_meter_indicator_scale_lines);
|
ctypes_register_class(vm, &be_class_lv_meter_indicator_scale_lines);
|
||||||
ctypes_register_class(vm, &be_class_lv_meter_scale, &be_lv_meter_scale);
|
ctypes_register_class(vm, &be_class_lv_meter_scale);
|
||||||
ctypes_register_class(vm, &be_class_lv_obj_class, &be_lv_obj_class);
|
ctypes_register_class(vm, &be_class_lv_obj_class);
|
||||||
ctypes_register_class(vm, &be_class_lv_obj_draw_part_dsc, &be_lv_obj_draw_part_dsc);
|
ctypes_register_class(vm, &be_class_lv_obj_draw_part_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_point, &be_lv_point);
|
ctypes_register_class(vm, &be_class_lv_point);
|
||||||
ctypes_register_class(vm, &be_class_lv_sqrt_res, &be_lv_sqrt_res);
|
ctypes_register_class(vm, &be_class_lv_sqrt_res);
|
||||||
ctypes_register_class(vm, &be_class_lv_style_transition_dsc, &be_lv_style_transition_dsc);
|
ctypes_register_class(vm, &be_class_lv_style_transition_dsc);
|
||||||
ctypes_register_class(vm, &be_class_lv_timer, &be_lv_timer);
|
ctypes_register_class(vm, &be_class_lv_timer);
|
||||||
ctypes_register_class(vm, &be_class_lv_ts_calibration, &be_lv_ts_calibration);
|
ctypes_register_class(vm, &be_class_lv_ts_calibration);
|
||||||
}
|
}
|
||||||
|
|
||||||
be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = {
|
||||||
|
|
|
@ -231,7 +231,7 @@ ctypes.print_classes = def (module_name)
|
||||||
print()
|
print()
|
||||||
print(string.format("void be_load_ctypes_%s_definitions_lib(bvm *vm) {", module_name))
|
print(string.format("void be_load_ctypes_%s_definitions_lib(bvm *vm) {", module_name))
|
||||||
for elt:global_classes
|
for elt:global_classes
|
||||||
print(string.format(" ctypes_register_class(vm, &be_class_%s, &be_%s);", elt, elt))
|
print(string.format(" ctypes_register_class(vm, &be_class_%s);", elt))
|
||||||
end
|
end
|
||||||
print("}")
|
print("}")
|
||||||
print()
|
print()
|
||||||
|
|
|
@ -231,7 +231,7 @@ ctypes.print_classes = def (module_name)
|
||||||
print()
|
print()
|
||||||
print(string.format("void be_load_ctypes_%s_definitions_lib(bvm *vm) {", module_name))
|
print(string.format("void be_load_ctypes_%s_definitions_lib(bvm *vm) {", module_name))
|
||||||
for elt:global_classes
|
for elt:global_classes
|
||||||
print(string.format(" ctypes_register_class(vm, &be_class_%s, &be_%s);", elt, elt))
|
print(string.format(" ctypes_register_class(vm, &be_class_%s);", elt))
|
||||||
end
|
end
|
||||||
print("}")
|
print("}")
|
||||||
print()
|
print()
|
||||||
|
|
Loading…
Reference in New Issue