I wanted to do an effect similar to a car dashboard that needed to implement a pointer rotation.My pointer is an img image.After consulting the documentation, I found that I can use the canvas to rotate the image, but the rotation speed is relatively slow. What can I do to make him go faster? like a car dashboard.
You would need to change the default refresh rate from 3s milliseconds to something smaller. You can also optionally use an animated GIF to do it as well.
You do not need to use canvas to rotate an image, it can be done using an lv_img widget as well. You would need to to use the
lv_obj_set_style_transform_angle(struct _lv_obj_t *obj, lv_coord_t value, lv_style_selector_t selector) function to rotate an
lv_img widget. The “value” parameter of the function is 0 - 360 * 10 for the range of values. so 180° rotation would be 1800 and a 90° rotation would be 900. The setting is absolute from it’s originally rotated position and not relative to it’s current rotation.
The big thing with mimicking what you would see in a vehicle dashboard is going to be using a super fast MCU with the attached display at a minimum using a 24 lane I8080 interface depending on the size of the display even using an I8080 interface would be too slow. You are also going to need to lower the default refresh rate to something like 5 milliseconds or maybe even lower. You will have to force LVGL to refresh the display after each and every single time you move the needle.
You want to do something like this.
It is custom drawn not a rendered image.