From 312c959bfe4f18316f4ea221b8ed21821a06ed38 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 11 Nov 2020 13:21:19 +0100 Subject: [PATCH] Move pause and resume to bottom of stack --- main.c | 4 ++-- nanovna.h | 1 + plot.c | 12 ++++++++++++ sa_cmd.c | 6 +++++- sa_core.c | 6 ++++-- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index dfabd45..c6f25a9 100644 --- a/main.c +++ b/main.c @@ -2369,8 +2369,8 @@ static const VNAShellCommand commands[] = {"test" , cmd_test , 0}, {"touchcal" , cmd_touchcal , CMD_WAIT_MUTEX}, {"touchtest" , cmd_touchtest , CMD_WAIT_MUTEX}, - {"pause" , cmd_pause , 0}, - {"resume" , cmd_resume , 0}, + {"pause" , cmd_pause , CMD_WAIT_MUTEX}, + {"resume" , cmd_resume , CMD_WAIT_MUTEX}, {"caloutput" , cmd_caloutput , 0}, #ifdef __VNA__ {"cal" , cmd_cal , CMD_WAIT_MUTEX}, diff --git a/nanovna.h b/nanovna.h index 625bb3b..2ea2a09 100644 --- a/nanovna.h +++ b/nanovna.h @@ -214,6 +214,7 @@ void set_clear_storage(void); void set_subtract_storage(void); void toggle_normalize(void); void toggle_waterfall(void); +void disable_waterfall(void); void set_mode(int); int GetMode(void); void set_reflevel(float); diff --git a/plot.c b/plot.c index 6f24ebf..2e6fb6c 100644 --- a/plot.c +++ b/plot.c @@ -2477,6 +2477,18 @@ toggle_waterfall(void) ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom, 0); request_to_redraw_grid(); } + +void +disable_waterfall(void) +{ + graph_bottom = NO_WATERFALL; + waterfall = W_OFF; + _grid_y = graph_bottom / NGRIDY; + ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom, 0); + request_to_redraw_grid(); +} + + void plot_init(void) { diff --git a/sa_cmd.c b/sa_cmd.c index 3e1def5..f2f9644 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -592,13 +592,17 @@ VNA_SHELL_FUNCTION(cmd_scanraw) if (argc == 3) { points = my_atoi(argv[2]); } + +// if (get_waterfall()) +// disable_waterfall(); // display dma hangs when waterfall is enabled + uint32_t old_step = setting.frequency_step; float f_step = (stop-start)/ points; setting.frequency_step = (uint32_t)f_step; streamPut(shell_stream, '{'); static uint32_t old_start=0, old_stop=0, old_points=0; - if (old_start != start || old_stop != stop || old_points != points) { + if (old_start != start || old_stop != stop || old_points != points) { // To prevent dirty for every sweep dirty = true; old_start = start; old_stop = stop; diff --git a/sa_core.c b/sa_core.c index e911fa7..45e370e 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1331,7 +1331,7 @@ int binary_search_frequency(int f) // Search which index in the frequency t return -1; } -uint32_t interpolate_maximum(int m) +void interpolate_maximum(int m) { const int idx = markers[m].index; markers[m].frequency = frequencies[idx]; @@ -2177,6 +2177,9 @@ sweep_again: // stay in sweep loop when output mo } // scandirty = true; // To show trigger happened } + if (setting.actual_sweep_time_us > ONE_SECOND_TIME && MODE_INPUT(setting.mode)) + ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1, 0); // Erase progress bar before updating actual_sweep_time + // ---------------------- process measured actual sweep time ----------------- // For CW mode value calculated in SI4432_Fill @@ -2559,7 +2562,6 @@ sweep_again: // stay in sweep loop when output mo // redraw_marker(peak_marker, FALSE); // STOP_PROFILE; - ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1, 0); palSetPad(GPIOB, GPIOB_LED); return true;