Description
I’m recreating a VFD display on a LCD using LVGL.
The object is based on an lv_scale that is cleared entirely of all it’s visible parts, and the needle is set to use an image.
I’ve set everything up and for some reason, the needle image is slightly rotated at an angle, even though the original image is dead center.
What MCU/Processor/Board and compiler are you using?
Teensy 4.0
What LVGL version are you using?
9.2.2
What have you tried so far?
I’ve tried to rotate the image using the image rotate function but it has no affect.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
void createVFD(){
LV_IMAGE_DECLARE(Background_320px);
LV_IMAGE_DECLARE(CDJ_CUE_MEMORY_320px);
LV_IMAGE_DECLARE(CDJ_TOUCH_INDICATOR_320px);
LV_IMAGE_DECLARE(CDJ_VINYL_INDICATOR_320px);
LV_IMAGE_DECLARE(CDJ_POS_MARKER_160px);
lv_obj_t * VDF_BG = lv_image_create(screen);
lv_image_set_src(VDF_BG, &Background_320px);
lv_obj_align(VDF_BG, LV_ALIGN_CENTER, 0, 0);
lv_obj_t * VDF_CUE_MEM = lv_image_create(VDF_BG);
lv_image_set_src(VDF_CUE_MEM, &CDJ_CUE_MEMORY_320px);
lv_obj_align(VDF_CUE_MEM, LV_ALIGN_CENTER, 0, 0);
lv_obj_t * VDF_TOUCH_IND = lv_image_create(VDF_BG);
lv_image_set_src(VDF_TOUCH_IND, &CDJ_TOUCH_INDICATOR_320px);
lv_obj_align(VDF_TOUCH_IND, LV_ALIGN_CENTER, 0, 0);
lv_obj_t * VDF_VINYL_IND = lv_image_create(VDF_BG);
lv_image_set_src(VDF_VINYL_IND, &CDJ_VINYL_INDICATOR_320px);
lv_obj_align(VDF_VINYL_IND, LV_ALIGN_CENTER, 0, 0);
vfd_scale = lv_scale_create(VDF_BG);
lv_obj_set_align(vfd_scale, LV_ALIGN_CENTER);
lv_obj_set_size(vfd_scale, 320, 320);
lv_scale_set_mode(vfd_scale, LV_SCALE_MODE_ROUND_INNER);
lv_obj_set_style_bg_opa(vfd_scale, LV_OPA_COVER, 0);
lv_obj_set_style_bg_color(vfd_scale, lv_palette_lighten(LV_PALETTE_RED, 5), 0);
lv_obj_set_style_radius(vfd_scale, LV_RADIUS_CIRCLE, 0);
lv_obj_set_style_clip_corner(vfd_scale, true, 0);
lv_scale_set_label_show(vfd_scale, false);
lv_obj_set_style_length(vfd_scale, 0, LV_PART_ITEMS);
lv_obj_set_style_length(vfd_scale, 0, LV_PART_INDICATOR);
lv_scale_set_range(vfd_scale, 0, 135);
lv_scale_set_angle_range(vfd_scale, 360);
lv_scale_set_rotation(vfd_scale, -90);
lv_obj_set_style_bg_opa(vfd_scale, LV_OPA_0, 0);
play_pos_obj = lv_image_create(vfd_scale);
lv_image_set_src(play_pos_obj, &CDJ_POS_MARKER_160px);
lv_obj_set_pos(play_pos_obj, 160, 160);
lv_image_set_pivot(play_pos_obj, 0, 0);
lv_scale_set_image_needle_value(vfd_scale, play_pos_obj, 0);
}
Screenshot and/or video
The “needle” is rotated on it’s axis
The background and needle overlayed in Photopea (as you’d expect it to look on LVGL)
The original needle image used for LVGL