From 0575aed87bca44d4ebde5558a49565db03ccef33 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 1 Apr 2020 14:33:01 +0200 Subject: [PATCH] First measurement function --- sa_core.c | 4 ++-- ui_sa.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/sa_core.c b/sa_core.c index 799002d..3c370ea 100644 --- a/sa_core.c +++ b/sa_core.c @@ -458,7 +458,7 @@ void update_rbw(void) //static int spur_old_stepdelay = 0; static const unsigned int spur_IF = 433900000; -static const unsigned int spur_alternate_IF = 433700000; +static const unsigned int spur_alternate_IF = 434100000; static const int spur_table[] = { 470000, @@ -569,7 +569,7 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking) } #define MAX_MAX 4 -#define MAX_NOISE 20 // 10dB +#define MAX_NOISE 10 // 10dB int16_t max_index[MAX_MAX]; int16_t cur_max = 0; diff --git a/ui_sa.c b/ui_sa.c index 2ddc17d..7f0a67e 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -342,6 +342,34 @@ static void menu_spur_cb(int item, uint8_t data) } #endif +static void menu_measure_cb(int item, uint8_t data) +{ + (void)item; + switch(data) { + case 0: // IMD + for (int i = 0; i< MARKERS_MAX; i++) { + markers[i].enabled = M_TRACKING_ENABLED; + markers[i].mtype = M_DELTA; + } + markers[0].mtype = M_REFERENCE; + break; + case 1: + for (int i = 0; i< MARKERS_MAX; i++) { + markers[i].enabled = M_TRACKING_ENABLED; + markers[i].mtype = M_DELTA; + } + markers[0].mtype = M_REFERENCE; + break; + case 2: + break; + case 3: + break; + } + menu_move_back(); + ui_mode_normal(); +// draw_cal_status(); +} + static void menu_storage_cb(int item, uint8_t data) { (void)item; @@ -717,6 +745,12 @@ static const menuitem_t menu_settings[] = { MT_NONE, 0, NULL, NULL } // sentinel }; +static const menuitem_t menu_measure[] = { + { MT_CALLBACK, 0, "IMD", menu_measure_cb}, + { MT_CALLBACK, 1, "IIP3", menu_measure_cb}, + { MT_CANCEL, 0, S_LARROW" BACK", NULL }, + { MT_NONE, 0, NULL, NULL } // sentinel +}; static const menuitem_t menu_settingshigh2[] = { @@ -774,6 +808,7 @@ const menuitem_t menu_top[] = { { MT_SUBMENU, 0, "SCAN", menu_stimulus}, { MT_SUBMENU, 0, "DISPLAY", menu_display}, { MT_SUBMENU, 0, "MARKER", menu_marker}, + { MT_SUBMENU, 0, "MEASURE", menu_measure}, { MT_SUBMENU, 0, "SETTINGS", menu_settings}, { MT_CANCEL, 0, S_LARROW" MODE",NULL}, { MT_NONE, 0, NULL, NULL } // sentinel, @@ -786,6 +821,7 @@ const menuitem_t menu_tophigh[] = { MT_SUBMENU, 0, "SCAN", menu_stimulus}, { MT_SUBMENU, 0, "DISPLAY", menu_display}, { MT_SUBMENU, 0, "MARKER", menu_marker}, + { MT_SUBMENU, 0, "MEASURE", menu_measure}, { MT_SUBMENU, 0, "SETTINGS", menu_settings}, { MT_CANCEL, 0, S_LARROW" MODE",NULL}, { MT_NONE, 0, NULL, NULL } // sentinel,