From 8a4179c6847fa9a3501a821a0f2676cdf6edfe17 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Thu, 10 Sep 2020 18:40:42 +0200 Subject: [PATCH] Correct wrong marker frequencies --- main.c | 3 +++ sa_core.c | 5 +++++ ui_sa.c | 1 + 3 files changed, 9 insertions(+) diff --git a/main.c b/main.c index 3d741f6..4c9df33 100644 --- a/main.c +++ b/main.c @@ -185,6 +185,8 @@ static THD_FUNCTION(Thread1, arg) int i = marker_search(); if (i != -1 && active_marker != -1) { markers[active_marker].index = i; + markers[active_marker].frequency = frequencies[i]; + redraw_request |= REDRAW_MARKER; } } @@ -1054,6 +1056,7 @@ update_marker_index(void) for (i = 0; i < sweep_points-1; i++) { if (frequencies[i] <= f && f < frequencies[i+1]) { markers[m].index = f < (frequencies[i] / 2 + frequencies[i + 1] / 2) ? i : i + 1; + markers[m].frequency = frequencies[markers[m].index ]; break; } } diff --git a/sa_core.c b/sa_core.c index 99e54b1..6435add 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1328,6 +1328,7 @@ search_maximum(int m, int center, int span) } } markers[m].index = max_index[0]; + markers[m].frequency = frequencies[markers[m].index]; return found; } @@ -2272,10 +2273,14 @@ sweep_again: // stay in sweep loop when output mo } uint32_t lf = frequencies[l]; uint32_t rf = frequencies[r]; + markers[0].frequency = lf; + markers[1].frequency = rf; + markers[2].enabled = search_maximum(2, lf - (rf - lf), 12); markers[3].enabled = search_maximum(3, rf + (rf - lf), 12); } else if (setting.measurement == M_PHASE_NOISE && markers[0].index > 10) { // ------------Phase noise measurement markers[1].index = markers[0].index + (setting.mode == M_LOW ? 290/4 : -290/4); // Position phase noise marker at requested offset + markers[1].frequency = frequencies[markers[1].index]; } else if (setting.measurement == M_STOP_BAND && markers[0].index > 10) { // -------------Stop band measurement markers[1].index = marker_search_left_min(markers[0].index); if (markers[1].index < 0) markers[1].index = 0; diff --git a/ui_sa.c b/ui_sa.c index 5b71912..07f0245 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -948,6 +948,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_marker_select_acb) return; } markers[data-1].enabled = true; + markers[data-1].frequency = frequencies[markers[data-1].index]; active_marker_select(data-1); menu_push_submenu(menu_marker_modify); redraw_marker(active_marker);