From 5140ccde5a75f1f7ae500b1aaa690808c6d16b74 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Fri, 26 Jun 2020 18:22:03 +0200 Subject: [PATCH] Updated spur shifts and 10MHz keypad --- sa_core.c | 21 ++++++++++++++------- ui_sa.c | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sa_core.c b/sa_core.c index 037979f..f1bd67d 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2020, Erik Kaashoek erik@kaashoek.com - * All rights reserved. +/* All rights reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -493,8 +492,8 @@ void set_spur(int v) if (setting.mode!=M_LOW) return; setting.spur = v; - if (setting.spur && actual_rbw > 360) - set_RBW(300); +// if (setting.spur && actual_rbw > 360) // moved to update_rbw +// set_RBW(300); dirty = true; } #endif @@ -978,13 +977,17 @@ void update_rbw(void) setting.vbw = 300; // trick to get right default rbw in zero span mode } actual_rbw = setting.rbw; - if (actual_rbw == 0) + if (actual_rbw == 0) { actual_rbw = 2*setting.vbw; + } if (actual_rbw < 2.6) actual_rbw = 2.6; if (actual_rbw > 600) actual_rbw = 600; + if (setting.spur && actual_rbw > 300) + actual_rbw = 250; + SI4432_Sel = MODE_SELECT(setting.mode); actual_rbw = SI4432_SET_RBW(actual_rbw); @@ -1346,8 +1349,12 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking) else setting.below_IF = S_AUTO_OFF; } - else - local_IF = local_IF + (int)(actual_rbw < 350.0 ? setting.spur*300000 : 0 ); + else { + int32_t spur_offset = actual_rbw * 1000; + if (setting.spur == -1) + spur_offset = - spur_offset; + local_IF = local_IF + spur_offset; + } #endif } else { // local_IF = setting.frequency_IF ; diff --git a/ui_sa.c b/ui_sa.c index bf911e3..c4d23e3 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -508,7 +508,7 @@ static const keypads_t * const keypads_mode_tbl[] = { keypads_plusmin, // KM_LOWOUTLEVEL keypads_positive, // KM_DECAY keypads_positive, // KM_NOISE - keypads_plusmin, // KM_10MHz + keypads_freq, // KM_10MHz keypads_positive, // KM_REPEA keypads_plusmin, // KM_OFFSET keypads_plusmin_unit, // KM_TRIGGER @@ -525,7 +525,7 @@ static const char * const keypad_mode_label[] = { static const char * const keypad_mode_label[] = { "error", "START", "STOP", "CENTER", "SPAN", "FREQ", "\2REF\0LEVEL", "SCALE", // 0-7 "ATTENUATE", "\2ACTUAL\0POWER", "IF", "\2SAMPLE\0DELAY", "DRIVE", "LEVEL", "SCANS", "LEVEL", // 8-15 - "OFFSET" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS"// 16- + "FREQ" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS"// 16- }; #endif