Lines Matching refs:arc
40 static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_part_t part);
44 static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob…
45 static void value_update(lv_obj_t * arc);
91 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_start_angle() local
95 int16_t old_delta = arc->indic_angle_end - arc->indic_angle_start; in lv_arc_set_start_angle()
96 int16_t new_delta = arc->indic_angle_end - start; in lv_arc_set_start_angle()
102 …else if(new_delta < old_delta) inv_arc_area(obj, arc->indic_angle_start, start, LV_PART_INDICATOR); in lv_arc_set_start_angle()
103 …else if(old_delta < new_delta) inv_arc_area(obj, start, arc->indic_angle_start, LV_PART_INDICATOR); in lv_arc_set_start_angle()
107 arc->indic_angle_start = start; in lv_arc_set_start_angle()
115 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_end_angle() local
118 int16_t old_delta = arc->indic_angle_end - arc->indic_angle_start; in lv_arc_set_end_angle()
119 int16_t new_delta = end - arc->indic_angle_start; in lv_arc_set_end_angle()
125 else if(new_delta < old_delta) inv_arc_area(obj, end, arc->indic_angle_end, LV_PART_INDICATOR); in lv_arc_set_end_angle()
126 else if(old_delta < new_delta) inv_arc_area(obj, arc->indic_angle_end, end, LV_PART_INDICATOR); in lv_arc_set_end_angle()
130 arc->indic_angle_end = end; in lv_arc_set_end_angle()
144 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_bg_start_angle() local
148 int16_t old_delta = arc->bg_angle_end - arc->bg_angle_start; in lv_arc_set_bg_start_angle()
149 int16_t new_delta = arc->bg_angle_end - start; in lv_arc_set_bg_start_angle()
155 else if(new_delta < old_delta) inv_arc_area(obj, arc->bg_angle_start, start, LV_PART_MAIN); in lv_arc_set_bg_start_angle()
156 else if(old_delta < new_delta) inv_arc_area(obj, start, arc->bg_angle_start, LV_PART_MAIN); in lv_arc_set_bg_start_angle()
158 arc->bg_angle_start = start; in lv_arc_set_bg_start_angle()
166 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_bg_end_angle() local
170 int16_t old_delta = arc->bg_angle_end - arc->bg_angle_start; in lv_arc_set_bg_end_angle()
171 int16_t new_delta = end - arc->bg_angle_start; in lv_arc_set_bg_end_angle()
177 else if(new_delta < old_delta) inv_arc_area(obj, end, arc->bg_angle_end, LV_PART_MAIN); in lv_arc_set_bg_end_angle()
178 else if(old_delta < new_delta) inv_arc_area(obj, arc->bg_angle_end, end, LV_PART_MAIN); in lv_arc_set_bg_end_angle()
180 arc->bg_angle_end = end; in lv_arc_set_bg_end_angle()
194 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_rotation() local
196 arc->rotation = rotation; in lv_arc_set_rotation()
204 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_mode() local
206 int16_t val = arc->value; in lv_arc_set_mode()
208 arc->type = type; in lv_arc_set_mode()
209 arc->value = -1; /** Force set_value handling*/ in lv_arc_set_mode()
211 int16_t bg_midpoint, bg_end = arc->bg_angle_end; in lv_arc_set_mode()
212 if(arc->bg_angle_end < arc->bg_angle_start) bg_end = arc->bg_angle_end + 360; in lv_arc_set_mode()
214 switch(arc->type) { in lv_arc_set_mode()
216 bg_midpoint = (arc->bg_angle_start + bg_end) / 2; in lv_arc_set_mode()
221 lv_arc_set_end_angle(obj, arc->bg_angle_end); in lv_arc_set_mode()
224 lv_arc_set_start_angle(obj, arc->bg_angle_start); in lv_arc_set_mode()
233 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_value() local
235 if(arc->value == value) return; in lv_arc_set_value()
238 new_value = value > arc->max_value ? arc->max_value : value; in lv_arc_set_value()
239 new_value = new_value < arc->min_value ? arc->min_value : new_value; in lv_arc_set_value()
241 if(arc->value == new_value) return; in lv_arc_set_value()
242 arc->value = new_value; in lv_arc_set_value()
250 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_range() local
252 if(arc->min_value == min && arc->max_value == max) return; in lv_arc_set_range()
254 arc->min_value = min; in lv_arc_set_range()
255 arc->max_value = max; in lv_arc_set_range()
257 if(arc->value < min) { in lv_arc_set_range()
258 arc->value = min; in lv_arc_set_range()
260 if(arc->value > max) { in lv_arc_set_range()
261 arc->value = max; in lv_arc_set_range()
270 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_set_change_rate() local
272 arc->chg_rate = rate; in lv_arc_set_change_rate()
388 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_constructor() local
391 arc->rotation = 0; in lv_arc_constructor()
392 arc->bg_angle_start = 135; in lv_arc_constructor()
393 arc->bg_angle_end = 45; in lv_arc_constructor()
394 arc->indic_angle_start = 135; in lv_arc_constructor()
395 arc->indic_angle_end = 270; in lv_arc_constructor()
396 arc->type = LV_ARC_MODE_NORMAL; in lv_arc_constructor()
397 arc->value = VALUE_UNSET; in lv_arc_constructor()
398 arc->min_close = 1; in lv_arc_constructor()
399 arc->min_value = 0; in lv_arc_constructor()
400 arc->max_value = 100; in lv_arc_constructor()
401 arc->dragging = false; in lv_arc_constructor()
402 arc->chg_rate = 720; in lv_arc_constructor()
403 arc->last_tick = lv_tick_get(); in lv_arc_constructor()
404 arc->last_angle = arc->indic_angle_end; in lv_arc_constructor()
405 arc->in_out = CLICK_OUTSIDE_BG_ANGLES; in lv_arc_constructor()
426 lv_arc_t * arc = (lv_arc_t *)lv_event_get_target(e); in lv_arc_event() local
447 if(arc->dragging == false) { in lv_arc_event()
462 arc->dragging = true; in lv_arc_event()
463 arc->last_tick = lv_tick_get(); /*Capture timestamp at dragging start*/ in lv_arc_event()
468 if(arc->dragging == false) return; in lv_arc_event()
475 int16_t bg_end = arc->bg_angle_end; in lv_arc_event()
476 if(arc->bg_angle_end < arc->bg_angle_start) { in lv_arc_event()
477 bg_end = arc->bg_angle_end + 360; in lv_arc_event()
481 angle -= arc->rotation; in lv_arc_event()
482 angle -= arc->bg_angle_start; /*Make the angle relative to the start angle*/ in lv_arc_event()
489 const uint32_t min_close_prev = (uint32_t) arc->min_close; in lv_arc_event()
496 int16_t deg_range = bg_end - arc->bg_angle_start; in lv_arc_event()
497 int16_t last_angle_rel = arc->last_angle - arc->bg_angle_start; in lv_arc_event()
504 if(arc->min_close) angle = 0; in lv_arc_event()
508 else if(CLICK_OUTSIDE_BG_ANGLES == arc->in_out) { in lv_arc_event()
509 if(arc->min_close) angle = -deg_range; in lv_arc_event()
516 … if(((min_close_prev == CLICK_CLOSER_TO_MIN_END) && (arc->min_close == CLICK_CLOSER_TO_MAX_END)) in lv_arc_event()
517 && ((CLICK_OUTSIDE_BG_ANGLES == arc->in_out) && (LV_ABS(delta_angle) > 280))) { in lv_arc_event()
520 …else if(((min_close_prev == CLICK_CLOSER_TO_MAX_END) && (arc->min_close == CLICK_CLOSER_TO_MIN_END… in lv_arc_event()
521 && (CLICK_OUTSIDE_BG_ANGLES == arc->in_out)) { in lv_arc_event()
529 uint32_t delta_tick = lv_tick_elaps(arc->last_tick); in lv_arc_event()
531 const uint16_t delta_angle_max = (arc->chg_rate * delta_tick) / 1000; in lv_arc_event()
544 int32_t round = ((bg_end - arc->bg_angle_start) * 8) / (arc->max_value - arc->min_value); in lv_arc_event()
548 angle += arc->bg_angle_start; /*Make the angle absolute again*/ in lv_arc_event()
551 int16_t old_value = arc->value; in lv_arc_event()
552 … int16_t new_value = lv_map(angle, arc->bg_angle_start, bg_end, arc->min_value, arc->max_value); in lv_arc_event()
554 arc->last_tick = lv_tick_get(); /*Cache timestamp for the next iteration*/ in lv_arc_event()
563 if(new_value == arc->min_value || new_value == arc->max_value) { in lv_arc_event()
564 arc->last_tick = lv_tick_get(); /*Cache timestamp for the next iteration*/ in lv_arc_event()
568 arc->dragging = false; in lv_arc_event()
582 int16_t old_value = arc->value; in lv_arc_event()
590 if(old_value != arc->value) { in lv_arc_event()
647 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_draw() local
672 …lv_draw_arc(draw_ctx, &arc_dsc, ¢er, part_draw_dsc.radius, arc->bg_angle_start + arc->rotation, in lv_arc_draw()
673 arc->bg_angle_end + arc->rotation); in lv_arc_draw()
698 …lv_draw_arc(draw_ctx, &arc_dsc, ¢er, part_draw_dsc.radius, arc->indic_angle_start + arc->rotat… in lv_arc_draw()
699 arc->indic_angle_end + arc->rotation); in lv_arc_draw()
730 lv_arc_t * arc = (lv_arc_t *)obj; in inv_arc_area() local
737 start_angle += arc->rotation; in inv_arc_area()
738 end_angle += arc->rotation; in inv_arc_area()
792 lv_arc_t * arc = (lv_arc_t *)obj; in get_angle() local
793 uint16_t angle = arc->rotation; in get_angle()
794 if(arc->type == LV_ARC_MODE_NORMAL) { in get_angle()
795 angle += arc->indic_angle_end; in get_angle()
797 else if(arc->type == LV_ARC_MODE_REVERSE) { in get_angle()
798 angle += arc->indic_angle_start; in get_angle()
800 else if(arc->type == LV_ARC_MODE_SYMMETRICAL) { in get_angle()
801 int16_t bg_end = arc->bg_angle_end; in get_angle()
802 if(arc->bg_angle_end < arc->bg_angle_start) bg_end = arc->bg_angle_end + 360; in get_angle()
803 int16_t indic_end = arc->indic_angle_end; in get_angle()
804 if(arc->indic_angle_end < arc->indic_angle_start) indic_end = arc->indic_angle_end + 360; in get_angle()
806 int32_t angle_midpoint = (int32_t)(arc->bg_angle_start + bg_end) / 2; in get_angle()
807 if(arc->indic_angle_start < angle_midpoint) angle += arc->indic_angle_start; in get_angle()
808 else if(indic_end > angle_midpoint) angle += arc->indic_angle_end; in get_angle()
843 lv_arc_t * arc = (lv_arc_t *)obj; in value_update() local
846 if(arc->value == VALUE_UNSET) return; in value_update()
848 int16_t bg_midpoint, range_midpoint, bg_end = arc->bg_angle_end; in value_update()
849 if(arc->bg_angle_end < arc->bg_angle_start) bg_end = arc->bg_angle_end + 360; in value_update()
852 switch(arc->type) { in value_update()
854 bg_midpoint = (arc->bg_angle_start + bg_end) / 2; in value_update()
855 range_midpoint = (int32_t)(arc->min_value + arc->max_value) / 2; in value_update()
857 if(arc->value < range_midpoint) { in value_update()
858 … angle = lv_map(arc->value, arc->min_value, range_midpoint, arc->bg_angle_start, bg_midpoint); in value_update()
863 angle = lv_map(arc->value, range_midpoint, arc->max_value, bg_midpoint, bg_end); in value_update()
869 angle = lv_map(arc->value, arc->min_value, arc->max_value, bg_end, arc->bg_angle_start); in value_update()
870 lv_arc_set_angles(obj, angle, arc->bg_angle_end); in value_update()
873 angle = lv_map(arc->value, arc->min_value, arc->max_value, arc->bg_angle_start, bg_end); in value_update()
874 lv_arc_set_angles(obj, arc->bg_angle_start, angle); in value_update()
878 LV_LOG_WARN("Invalid mode: %d", arc->type); in value_update()
881 arc->last_angle = angle; /*Cache angle for slew rate limiting*/ in value_update()
924 lv_arc_t * arc = (lv_arc_t *)obj; in lv_arc_angle_within_bg_bounds() local
930 if(arc->bg_angle_start < arc->bg_angle_end) { in lv_arc_angle_within_bg_bounds()
931 bigger_angle = arc->bg_angle_end; in lv_arc_angle_within_bg_bounds()
932 smaller_angle = arc->bg_angle_start; in lv_arc_angle_within_bg_bounds()
935 bigger_angle = (360 - arc->bg_angle_start) + arc->bg_angle_end; in lv_arc_angle_within_bg_bounds()
943 arc->min_close = 1; in lv_arc_angle_within_bg_bounds()
946 arc->min_close = 0; in lv_arc_angle_within_bg_bounds()
949 arc->in_out = CLICK_INSIDE_BG_ANGLES; in lv_arc_angle_within_bg_bounds()
958 arc->min_close = 1; in lv_arc_angle_within_bg_bounds()
959 arc->in_out = CLICK_INSIDE_BG_ANGLES; in lv_arc_angle_within_bg_bounds()
977 arc->min_close = 1; in lv_arc_angle_within_bg_bounds()
978 arc->in_out = CLICK_OUTSIDE_BG_ANGLES; in lv_arc_angle_within_bg_bounds()
986 arc->min_close = 1; in lv_arc_angle_within_bg_bounds()
987 arc->in_out = CLICK_OUTSIDE_BG_ANGLES; in lv_arc_angle_within_bg_bounds()
996 arc->min_close = 0; in lv_arc_angle_within_bg_bounds()
997 arc->in_out = CLICK_OUTSIDE_BG_ANGLES; in lv_arc_angle_within_bg_bounds()
1005 arc->min_close = 0; in lv_arc_angle_within_bg_bounds()
1006 arc->in_out = CLICK_OUTSIDE_BG_ANGLES; in lv_arc_angle_within_bg_bounds()