We need to change lv_calendar_set_highlighted_dates
prototype on lvgl sources.
If instead of lv_calendar_date_t *highlighted
, set_highlighted_dates received lv_calendar_date_t[] highlighted
, then the Micropython Binding would recognize this as an array and allow you use a python list.
This is done, for example, on chart where lv_coord_t y_array[]
is passed as a function argument.
lvgl defines set_points
as:
void lv_chart_set_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y_array[]);
and you can do this in Micropython:
chart.set_points(series1, [10,20,30,20,10,40,50,90,95,90])
Another example is lv_line_set_points
where each element is a lv_point_t
struct.
You can do something like this:
l = lv.line(scr)
l.set_points([{'x':100,'y':100},{'x':150,'y':100},{'x':150,'y':150}],3)
@kisvegabor - Can we change lv_calendar_set_highlighted_dates
prototype to receive an array? Can you think of other examples where we should receive an array instead of a pointer to struct?
The Micropython Binding is scanning the preprocessed lvgl headers.
This means it can’t process any macros, comments, etc.
A workaround for this is to define a function in addition to a macro that wraps the macro.
The function can be static inline
so it wouldn’t cost anything in C, but it would still be visible to the binding script.
I suggest collecting a list of macros which are important to Micropython, and make a PR with corresponding static inline functions to lvgl repo.
Yes, as I mentioned arrays are supported. See this example.
I think the online simulator is based on older code, before arrays support was added.
But you can check this using the unix (linux) port of lv_micropython
.
@embeddedt Could you comment on this? When was the simulator compiled? Could you explain the procedure of creating a new javascript simulator from lv_micropython
sources?
Nice progress! ![:+1: :+1:](https://forum.lvgl.io/images/emoji/twitter/+1.png?v=12)