Description
I’m relatively new to EEZ Studio and lvgl but have a working development system and can built operational UI’s and very pleased to have found both products!
I’m trying to get a working scale and line needle defined in EEZ Studio to operate as a simple meter.
What MCU/Processor/Board and compiler are you using?
I’m using VSCode/PlatformIO on Mac and uploading to Elecrow/CrowPanel 5.0" display.
What LVGL version are you using?
v9 having started with v8 and used meter.
What do you want to achieve?
Initially a simple round scale using a line/needle pointer.
What have you tried so far?
I’ve tried to incorporate the lv_example_scale_6 code into my ecosystem, as a test, with some success (seemed to run into memory problems with layouts?) but I just cannot understand why my needle doesn’t work based on the EEZ generated code.
On the display I see the line as initially placed in EEZStudio but on first call to update it jumps to the top left of the scale box and never moves.
Code to reproduce
This is the code snippet generated by EEZ Studio to build the scale and line on the screen
// TestScale
lv_obj_t *obj = lv_scale_create(parent_obj);
objects.test_scale = obj;
lv_obj_set_pos(obj, 50, 36);
lv_obj_set_size(obj, 240, 240);
lv_scale_set_mode(obj, LV_SCALE_MODE_ROUND_INNER);
lv_scale_set_range(obj, 0, 60);
lv_scale_set_total_tick_count(obj, 61);
lv_scale_set_major_tick_every(obj, 5);
lv_scale_set_label_show(obj, true);
lv_obj_set_style_length(obj, 5, LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_length(obj, 10, LV_PART_INDICATOR | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// TestNeedle
lv_obj_t *obj = lv_line_create(parent_obj);
objects.test_needle = obj;
lv_obj_set_pos(obj, 120, 120);
lv_obj_set_size(obj, 75, 5);
lv_obj_set_style_line_width(obj, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xffe10b0b), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff35c408), LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
and then I’m calling this to update the needle
int32_t sTickValue;
...
lv_scale_set_line_needle_value(objects.test_scale, objects.test_needle, 75, sTickValue);
I feel stuck on what to try next.