From eca14f8e3cd7a36b8ca332541a4102e8ee248d62 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Tue, 30 Jun 2020 19:38:56 +0300 Subject: [PATCH] Small code optimization (less size) in marker move from leveler Now step increase every 4 step on one --- ui.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/ui.c b/ui.c index 0f49589..8483d3a 100644 --- a/ui.c +++ b/ui.c @@ -1907,29 +1907,22 @@ ui_mode_normal(void) static void lever_move_marker(int status) { - int step = 1; - int count = 0; + uint16_t step = 1<<2; do { if (active_marker >= 0 && markers[active_marker].enabled) { - if ((status & EVT_DOWN) && markers[active_marker].index > 0) { - markers[active_marker].index -= step; + if (status & EVT_DOWN) { + markers[active_marker].index -= step>>2; if (markers[active_marker].index < 0) markers[active_marker].index = 0 ; - markers[active_marker].frequency = frequencies[markers[active_marker].index]; - redraw_marker(active_marker); } - if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) { - markers[active_marker].index += step; + if (status & EVT_UP) { + markers[active_marker].index += step>>2; if (markers[active_marker].index > sweep_points-1) markers[active_marker].index = sweep_points-1 ; - markers[active_marker].frequency = frequencies[markers[active_marker].index]; - redraw_marker(active_marker); - } - count++; - if (count > 10) { - step *= 2; - count = 0; } + markers[active_marker].frequency = frequencies[markers[active_marker].index]; + redraw_marker(active_marker); + step++; } status = btn_wait_release(); } while (status != 0);