Description
I want to draw ‘Marker’ points on top of the Arc control. My initial idea was to simply draw a 1 degree arc at the points where I want the markers. Unfortunately this doesn’t give very consistent markers as they vary in width due to the 360 resolution of the arc.
In this image at the bottom of this post both the green and white markers are just 1 degree, but as you can see they are very different in appearance!
Any ideas how to achieve better markers?
Maybe a solution is to draw a line along a given angle much like the ‘gauge’ widget. Is this possible?
What MCU/Processor/Board and compiler are you using?
Simulation (Visual Studio)
What do you want to achieve?
Better ‘Marker’ points on top of the arc.
What have you tried so far?
Using 1 degree arcs as mentioned above.
Code to reproduce
This is the code that creates the 1 degree makers
/****************************************************************/
/* Green Marker*/
static lv_style_t style_eco;
lv_style_copy(&style_eco, &lv_style_plain);
style_eco.line.color = lv_color_hex(COLOUR_MARKER_ECO);
style_eco.line.width = MARKER_THICKNESS;
lv_obj_t* arc4 = lv_arc_create(parent, NULL);
volatile uint16_t temp1 = eco_angle - MARKER_SIZE;
lv_arc_set_angles(arc4, eco_angle - MARKER_SIZE, eco_angle);
lv_arc_set_style(arc4, LV_ARC_STYLE_MAIN, &style_eco);
lv_obj_set_size(arc4, size, size);
lv_obj_align(arc4, NULL, LV_ALIGN_CENTER, 0, 0);
/****************************************************************/
/* WhiteMarker*/
static lv_style_t style_sp;
lv_style_copy(&style_sp, &lv_style_plain);
style_sp.line.color = lv_color_hex(COLOUR_MARKER_PV);
style_sp.line.width = MARKER_THICKNESS;
lv_obj_t* arc5 = lv_arc_create(parent, NULL);
volatile uint16_t temp2 = sp_angle - MARKER_SIZE;
lv_arc_set_angles(arc5, sp_angle - MARKER_SIZE, sp_angle);
lv_arc_set_style(arc5, LV_ARC_STYLE_MAIN, &style_sp);
lv_obj_set_size(arc5, size, size);
lv_obj_align(arc5, NULL, LV_ALIGN_CENTER, 0, 0);