From 6c1ab117a1b743a74aa00cb1b7204365f1b99335 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Mon, 3 May 2021 17:28:45 +0200 Subject: [PATCH] Add offset command ( 'n' ) --- main.c | 1 + sa_cmd.c | 12 ++++++++++++ sa_core.c | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index ae6102e..82c30a6 100644 --- a/main.c +++ b/main.c @@ -2530,6 +2530,7 @@ static const VNAShellCommand commands[] = #ifdef TINYSA4 { "g", cmd_g, CMD_WAIT_MUTEX }, { "q", cmd_q, CMD_WAIT_MUTEX }, + { "n", cmd_n, CMD_WAIT_MUTEX }, { "z", cmd_z, CMD_WAIT_MUTEX }, #endif #ifdef __ADF4351__ diff --git a/sa_cmd.c b/sa_cmd.c index 6564001..45cca4e 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -741,6 +741,18 @@ VNA_SHELL_FUNCTION(cmd_z) dirty = true; } } + +VNA_SHELL_FUNCTION(cmd_n) +{ + if (argc != 1) { + shell_printf("usage: z 0..30000\r\n%d\r\n", SI4432_offset_delay); + return; + } + if (argc == 1) { + setting.offset_delay = atoi(argv[0]); + dirty = true; + } +} #endif #if 0 // not used VNA_SHELL_FUNCTION(cmd_z) diff --git a/sa_core.c b/sa_core.c index e12950c..221b733 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1421,7 +1421,7 @@ static const struct { { 100, 800, 120, 100, -115}, { 30, 1500, 300, 100, -120}, { 10, 5000, 600, 100, -122}, - { 3, 19000, 3000, 100, -125} + { 3, 19000, 12000, 100, -125} }; #endif @@ -2054,9 +2054,9 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# actual_rbw_x10 = set_rbw(actual_rbw_x10); // see what rbw the SI4432 can realize if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) { // When doing frequency scanning in input mode #ifdef TINYSA4 - if (frequency_step_x10 > actual_rbw_x10) - vbwSteps = 1+(frequency_step_x10 / actual_rbw_x10); //((int)(2 * (frequency_step_x10 + (actual_rbw_x10/8)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step - vbwSteps += vbwSteps; + if (frequency_step_x10 > actual_rbw_x10) { + vbwSteps = 1+((frequency_step_x10 + actual_rbw_x10 - 1) / actual_rbw_x10); //((int)(2 * (frequency_step_x10 + (actual_rbw_x10/8)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step + } #else vbwSteps = ((int)(2 * (frequency_step_x10 + (actual_rbw_x10/2)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step #endif