From 8bf29111521059b6f94fccba9b2814ee760ff08f Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 9 May 2021 09:03:07 +0200 Subject: [PATCH 1/2] update sweep time before sweep --- sa_core.c | 5 +---- ui_sa.c | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sa_core.c b/sa_core.c index f311681..4167ebc 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3159,13 +3159,10 @@ again: // Spur redu #define TXCO_DIV3 10000000 if (setting.R == 0) { -#if 0 - if (actual_rbw_x10 >= 3000) { + if (setting.mode == M_GENLOW) { if (local_modulo == 0) ADF4351_modulo(1000); ADF4351_R_counter(1); - } else -#endif if (lf < 1000000000 /* && lf >= TXCO_DIV3 */ && MODE_INPUT(setting.mode)) { if (local_modulo == 0) { if (actual_rbw_x10 >= 3000) diff --git a/ui_sa.c b/ui_sa.c index a99958b..5b485e7 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -517,6 +517,7 @@ static const menuitem_t menu_curve[]; static const menuitem_t menu_curve_confirm[]; #endif static const menuitem_t menu_sweep[]; +static const menuitem_t menu_settings[]; extern bool dirty; char range_text[20]; @@ -1999,7 +2000,7 @@ static const menuitem_t menu_lowoutputmode[] = { #endif { MT_FORM | MT_KEYPAD, KM_EXT_GAIN, "EXTERNAL GAIN: %s", "-100..+100"}, #ifdef TINYSA4 - { MT_FORM | MT_SUBMENU, 255, S_RARROW" Settings", menu_settings3}, + { MT_FORM | MT_SUBMENU, 255, S_RARROW" Settings", menu_settings}, #endif { MT_FORM | MT_CANCEL, 0, "MODE", NULL }, { MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel @@ -2443,7 +2444,7 @@ static const menuitem_t menu_actual_power[] = static const menuitem_t menu_settings[] = { { MT_ADV_CALLBACK | MT_LOW, 0,"LO OUTPUT", menu_lo_output_acb}, - { MT_SUBMENU, 0, "ACTUAL\nPOWER", menu_actual_power}, + { MT_SUBMENU, 0, "LEVEL\nCORRECTION", menu_actual_power}, { MT_KEYPAD | MT_LOW, KM_IF, "IF FREQ", "0=auto IF"}, { MT_SUBMENU,0, "SCAN SPEED", menu_scanning_speed}, #ifndef TINYSA4 @@ -3340,6 +3341,8 @@ redraw_cal_status: strcpy(&buf[0],"Scan:"); ili9341_drawstring(buf, x, y); + if (dirty) setting.actual_sweep_time_us = calc_min_sweep_time_us(); + #if 0 // Activate for sweep time debugging y += YSTEP; plot_printf(buf, BLEN, "%5.3Fs", (float)setting.sweep_time_us/ONE_SECOND_TIME); From c0369f5b1c61284173459cd04008db500a8dcc0c Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Mon, 10 May 2021 16:38:47 +0200 Subject: [PATCH 2/2] Small bug repairs --- nanovna.h | 3 ++- sa_core.c | 8 ++++++-- ui_sa.c | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/nanovna.h b/nanovna.h index e656098..654a8db 100644 --- a/nanovna.h +++ b/nanovna.h @@ -401,6 +401,7 @@ void set_measurement(int); // extern int settingSpeed; //extern int setting.step_delay; void sweep_remote(void); +void calculate_step_delay(void); extern int generic_option_cmd( const char *cmd, const char *cmd_list, int argc, char *argv); #ifdef TINYSA4 @@ -1184,7 +1185,7 @@ typedef struct properties { //sizeof(properties_t) == 0x1200 -#define CONFIG_MAGIC 0x434f4e4e /* 'CONF' */ +#define CONFIG_MAGIC 0x434f4e4f /* 'CONF' */ extern int16_t lastsaveid; //extern properties_t *active_props; diff --git a/sa_core.c b/sa_core.c index 4167ebc..d76a906 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1447,7 +1447,7 @@ static const struct { }; #endif -static void calculate_step_delay(void) +void calculate_step_delay(void) { if (setting.step_delay_mode == SD_MANUAL || setting.step_delay != 0) { // The latter part required for selftest 3 SI4432_step_delay = setting.step_delay; @@ -3111,7 +3111,11 @@ again: // Spur redu #endif else { +#ifdef TINYSA4 + local_IF = local_IF - DEFAULT_SPUR_OFFSET/4; // No spure removal and no spur, center in IF but avoid mirror +#else local_IF = local_IF; // + DEFAULT_SPUR_OFFSET/2; // No spure removal and no spur, center in IF +#endif } } } @@ -3174,7 +3178,7 @@ again: // Spur redu if (tf + actual_rbw_x10*100 >= lf && tf < lf + actual_rbw_x10*100) { // 30MHz ADF4351_R_counter(6); } else { - if (setting.frequency_step < 100000) { + if (actual_rbw_x10 < 1000) { freq_t tf = ((lf + actual_rbw_x10*1000) / TXCO_DIV3) * TXCO_DIV3; if (tf + actual_rbw_x10*100 >= lf && tf < lf + actual_rbw_x10*100) // 10MHz ADF4351_R_counter(4); diff --git a/ui_sa.c b/ui_sa.c index 5b485e7..0a15f56 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -3302,7 +3302,7 @@ redraw_cal_status: else color = LCD_FG_COLOR; ili9341_set_foreground(color); - + if (dirty) update_rbw(); ili9341_drawstring("RBW:", x, y); y += YSTEP; plot_printf(buf, BLEN, "%.1FHz", actual_rbw_x10*100.0); @@ -3341,7 +3341,10 @@ redraw_cal_status: strcpy(&buf[0],"Scan:"); ili9341_drawstring(buf, x, y); - if (dirty) setting.actual_sweep_time_us = calc_min_sweep_time_us(); + if (dirty) { + calculate_step_delay(); + setting.actual_sweep_time_us = calc_min_sweep_time_us(); + } #if 0 // Activate for sweep time debugging y += YSTEP;