From a46a56aed56c17257c51b4b6dc171bef075df2af Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 28 Mar 2021 19:29:48 +0200 Subject: [PATCH] Markers on stored trace --- main.c | 2 +- nanovna.h | 2 +- plot.c | 24 ++++++++++++++++++++---- sa_core.c | 4 ++++ ui.c | 2 ++ ui_sa.c | 21 ++++++++++++--------- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index 9664178..f84541c 100644 --- a/main.c +++ b/main.c @@ -1018,7 +1018,7 @@ config_t config = { .correction_frequency = {{ 1000000, 500000000, 1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 10000000000 }, { 1000000, 500000000, 1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 10000000000 }}, .correction_value = {{ 0, +3, +11, +8.5, +2, +3, +10, +15, +12, +4, +0, +18, +22, +30, +30, +30, +30, +30, +30, +30 }, - { 0, 0, +1, +2, +2, +4, +9, +10, +16, +15, +17, +22, +30, +30, +30, +30, +30, +30, +30, +30 }}, + { 0, +3, +11, +8.5, +2, +3, +10, +15, +12, +4, +0, +18, +22, +30, +30, +30, +30, +30, +30, +30 }}, .setting_frequency_30mhz = 30000000, .cor_am = 0, .cor_wfm = 0, diff --git a/nanovna.h b/nanovna.h index 42175f0..e4cf23d 100644 --- a/nanovna.h +++ b/nanovna.h @@ -686,7 +686,7 @@ float groupdelay_from_array(int i, float array[POINTS_COUNT][2]); #endif // marker enum { - M_NORMAL=0,M_REFERENCE=1, M_DELTA=2, M_NOISE=4, M_TRACKING=8, M_DELETE=16 // Tracking must be last. + M_NORMAL=0,M_REFERENCE=1, M_DELTA=2, M_NOISE=4, M_STORED=8, M_TRACKING=16, M_DELETE=32 // Tracking must be last. }; enum { diff --git a/plot.c b/plot.c index 95a730d..ac6fadd 100644 --- a/plot.c +++ b/plot.c @@ -909,18 +909,26 @@ draw_cell(int m, int n) // PULSE; // draw marker symbols on each trace (<10 system ticks for all screen calls) #if 1 - if (trace[TRACE_ACTUAL].enabled) { + for (int t = TRACE_ACTUAL; t <= TRACE_STORED; t++ ) { + if (trace[t].enabled) { for (i = 0; i < MARKERS_MAX; i++) { if (!markers[i].enabled) continue; + if (markers[i].mtype & M_STORED) { + if (t == TRACE_ACTUAL) + continue; + } else { + if (t == TRACE_STORED) + continue; + } int idx = markers[i].index; int x = trace_index_x[idx] - x0 - X_MARKER_OFFSET; - int y = trace_index_y[TRACE_ACTUAL][idx] - y0 - Y_MARKER_OFFSET; + int y = trace_index_y[t][idx] - y0 - Y_MARKER_OFFSET; // Check marker icon on cell if ((uint32_t)(x+MARKER_WIDTH ) < (CELLWIDTH + MARKER_WIDTH ) && (uint32_t)(y+MARKER_HEIGHT) < (CELLHEIGHT + MARKER_HEIGHT)){ // Draw marker plate - ili9341_set_foreground(LCD_TRACE_1_COLOR + TRACE_ACTUAL); + ili9341_set_foreground(LCD_TRACE_1_COLOR + t); cell_blit_bitmap(x, y, MARKER_WIDTH, MARKER_HEIGHT, MARKER_BITMAP(0)); // Draw marker number ili9341_set_foreground(LCD_BG_COLOR); @@ -928,6 +936,7 @@ draw_cell(int m, int n) } } } + } #endif // Draw trace and marker info on the top (50 system ticks for all screen calls) #if 1 @@ -1486,9 +1495,16 @@ static void cell_draw_marker_info(int x0, int y0) #endif if (!markers[i].enabled) continue; - for (t = TRACE_ACTUAL; t <= TRACE_ACTUAL; t++) { // Only show info on actual trace + for (t = TRACE_ACTUAL; t <= TRACE_STORED; t++) { // Only show info on actual trace if (!trace[t].enabled) continue; + if (markers[i].mtype & M_STORED) { + if (t == TRACE_ACTUAL) + continue; + } else { + if (t == TRACE_STORED) + continue; + } uint16_t color; int level = temppeakLevel - get_attenuation() + setting.external_gain; if ((!setting.subtract_stored) && // Disabled when normalized diff --git a/sa_core.c b/sa_core.c index 61ed69e..f49674e 100644 --- a/sa_core.c +++ b/sa_core.c @@ -4498,7 +4498,11 @@ common_silent: #endif case TP_30MHZ: set_mode(M_LOW); +#ifdef TINYSA4 maxFreq = 9900000000ULL; // needed to measure the LPF rejection +#else + maxFreq = 2000000000; // needed to measure the LPF rejection +#endif set_refer_output(0); dirty = true; // set_step_delay(1); // Do not set !!!!! diff --git a/ui.c b/ui.c index c2f1e8b..c6d0a6f 100644 --- a/ui.c +++ b/ui.c @@ -986,6 +986,7 @@ static UI_FUNCTION_CALLBACK(menu_marker_search_cb) // select_lever_mode(LM_SEARCH); // Jump from maximum to maximum } +#if 0 static UI_FUNCTION_ADV_CALLBACK(menu_marker_tracking_acb){ (void)item; (void)data; @@ -996,6 +997,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_marker_tracking_acb){ } markers[active_marker].mtype ^= M_TRACKING; } +#endif #ifdef __VNA__ static void diff --git a/ui_sa.c b/ui_sa.c index a1ad4c2..2b7c456 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1269,21 +1269,24 @@ static UI_FUNCTION_ADV_CALLBACK(menu_marker_modify_acb) { if (data == M_NORMAL) { markers[active_marker].mtype = M_NORMAL; - } else if (data == M_REFERENCE) { + } + if (data == M_REFERENCE) { for (int i = 0; i