From 27e0159ce2847f37e4f8b5f99c2cfb9a98ae46a7 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 8 Jul 2020 18:49:00 +0200 Subject: [PATCH 1/2] Add fast speedup menu option --- nanovna.h | 1 + sa_core.c | 10 ++++++++++ ui_sa.c | 9 +++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/nanovna.h b/nanovna.h index 4e11dfc..93fdaf2 100644 --- a/nanovna.h +++ b/nanovna.h @@ -903,6 +903,7 @@ void set_switches(int); void set_trigger_level(float); void set_trigger(int); void update_rbw(void); +void set_fast_speedup(int); //extern int setting_measurement; void self_test(int); //extern int setting_test; diff --git a/sa_core.c b/sa_core.c index 4909937..86d51e6 100644 --- a/sa_core.c +++ b/sa_core.c @@ -790,6 +790,14 @@ void set_mode(int m) extern int SI4432_offset_delay; +int fast_speedup = 0; + +void set_fast_speedup(int s) +{ + fast_speedup = s; + dirty = true; +} + void calculate_step_delay(void) { if (setting.step_delay_mode == SD_MANUAL || setting.step_delay != 0) { // The latter part required for selftest 3 @@ -824,6 +832,8 @@ void calculate_step_delay(void) #endif if (setting.step_delay_mode == SD_PRECISE) // In precise mode wait twice as long for RSSI to stabalize SI4432_step_delay *= 2; + if (fast_speedup >0) + SI4432_offset_delay = SI4432_step_delay / fast_speedup; } if (setting.offset_delay != 0) // Override if set SI4432_offset_delay = setting.offset_delay; diff --git a/ui_sa.c b/ui_sa.c index 6dd1497..6e31407 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -301,7 +301,7 @@ const uint16_t right_icons [] = enum { KM_START=1, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_REFLEVEL, KM_SCALE, KM_ATTENUATION, KM_ACTUALPOWER, KM_IF, KM_SAMPLETIME, KM_DRIVE, KM_LOWOUTLEVEL, KM_DECAY, KM_NOISE, - KM_10MHZ, KM_REPEAT, KM_OFFSET, KM_TRIGGER, KM_LEVELSWEEP, KM_SWEEP_TIME, KM_OFFSET_DELAY, + KM_10MHZ, KM_REPEAT, KM_OFFSET, KM_TRIGGER, KM_LEVELSWEEP, KM_SWEEP_TIME, KM_OFFSET_DELAY, KM_FAST_SPEEDUP }; @@ -516,6 +516,7 @@ static const keypads_t * const keypads_mode_tbl[] = { keypads_plusmin, // KM_LEVELSWEEP keypads_time, // KM_SWEEP_TIME keypads_positive, // KM_OFFSET_DELAY + keypads_positive, // KM_FAST_SPEEDUP }; #ifdef __VNA__ @@ -527,7 +528,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 - "FREQ" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS", "\2OFFSET\0DELAY" // 16- + "FREQ" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS", "\2OFFSET\0DELAY", "\2FAST\0SPEEDUP" // 16- }; #endif @@ -1393,6 +1394,7 @@ static const menuitem_t menu_scanning_speed[] = { MT_CALLBACK, SD_NORMAL, "NORMAL", menu_scanning_speed_cb}, // order must match definition of enum { MT_CALLBACK, SD_PRECISE, "PRECISE", menu_scanning_speed_cb}, { MT_CALLBACK | MT_LOW,SD_FAST, "FAST", menu_scanning_speed_cb}, + { MT_KEYPAD | MT_LOW,KM_FAST_SPEEDUP, "\2FAST\0SPEEDUP", "2..20"}, { MT_KEYPAD, KM_SAMPLETIME, "\2SAMPLE\0DELAY", "300..30000"}, // item number must match SD_MANUAL { MT_KEYPAD, KM_OFFSET_DELAY, "\2OFFSET\0DELAY", "300..30000"}, // item number must match SD_MANUAL { MT_CANCEL, 0, "\032 BACK", NULL }, @@ -1942,6 +1944,9 @@ set_numeric_value(void) case KM_OFFSET_DELAY: set_offset_delay(uistat.value); break; + case KM_FAST_SPEEDUP: + set_fast_speedup(uistat.value); + break; case KM_REPEAT: set_repeat(uistat.value); break; From c08346af2b49b7b09eadeca82c531c472b9a5683 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Thu, 9 Jul 2020 08:07:33 +0200 Subject: [PATCH 2/2] Fast below IF added and increase RBW if fast scanning --- sa_core.c | 36 +++++++++++++++++++++++++++--------- ui_sa.c | 2 +- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/sa_core.c b/sa_core.c index 96e2f6d..af00984 100644 --- a/sa_core.c +++ b/sa_core.c @@ -996,15 +996,27 @@ void set_freq(int V, unsigned long freq) // translate the requested frequency } else { #ifdef __WIDE_OFFSET__ uint32_t target_f; // Impossible to use offset so set SI4432 to new frequency - if (freq + 80000 >= 480000000) { - target_f = freq + 160000; - } else { - target_f = freq + 80000; + if (freq < real_old_freq[V]) { // sweeping down + if (freq - 80000 >= 480000000) { + target_f = freq - 160000; + } else { + target_f = freq - 80000; + } + SI4432_Set_Frequency(target_f); + SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0xff); // set offset to most positive + SI4432_Write_Byte(SI4432_FREQ_OFFSET2, 0x01); + real_old_freq[V] = target_f; + } else { // sweeping up + if (freq + 80000 >= 480000000) { + target_f = freq + 160000; + } else { + target_f = freq + 80000; + } + SI4432_Set_Frequency(target_f); + SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0); // set offset to most negative + SI4432_Write_Byte(SI4432_FREQ_OFFSET2, 0x02); + real_old_freq[V] = target_f; } - SI4432_Set_Frequency(target_f); - SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0); // set offset to most negative - SI4432_Write_Byte(SI4432_FREQ_OFFSET2, 0x02); - real_old_freq[V] = target_f; #else SI4432_Set_Frequency(freq); // Impossible to use offset so set SI4432 to new frequency SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0); // set offset to zero @@ -1147,7 +1159,13 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# } actual_rbw_x10 = setting.rbw_x10; // requested rbw if (actual_rbw_x10 == 0) { // if auto rbw - actual_rbw_x10 = 2*setting.vbw_x10; // rbw is twice the frequency step to ensure no gaps in coverage + if (setting.step_delay_mode==SD_FAST) { // if in fast scanning + if (fast_speedup > 2) + actual_rbw_x10 = 6*setting.vbw_x10; // rbw is four the frequency step to ensure no gaps in coverage as there are some weird jumps + else + actual_rbw_x10 = 4*setting.vbw_x10; // rbw is four the frequency step to ensure no gaps in coverage as there are some weird jumps + } else + actual_rbw_x10 = 2*setting.vbw_x10; // rbw is twice the frequency step to ensure no gaps in coverage } if (actual_rbw_x10 < 26) actual_rbw_x10 = 26; diff --git a/ui_sa.c b/ui_sa.c index 6e31407..00c17d9 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1292,7 +1292,7 @@ static const menuitem_t menu_atten[] = { { MT_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_cb}, { MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL", "0..30"}, { MT_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_cb}, - { MT_CALLBACK | MT_HIGH,30, "\00225..30dB", menu_atten_high_cb}, + { MT_CALLBACK | MT_HIGH,30, "\00225..40dB", menu_atten_high_cb}, { MT_CANCEL, 0, "\032 BACK", NULL }, { MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel };