From 98f574f296a5f88c77fe3f6a7573138b80b4b104 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 2 Jun 2021 16:27:12 +0200 Subject: [PATCH] Tuned noise filter measurements --- nanovna.h | 1 + plot.c | 3 ++- sa_core.c | 13 +++++++++++-- si4468.c | 18 +++++++++--------- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/nanovna.h b/nanovna.h index 112e784..a915f55 100644 --- a/nanovna.h +++ b/nanovna.h @@ -266,6 +266,7 @@ extern float level_range(void); extern float channel_power[3]; extern float channel_power_watt[3]; extern const char * const unit_string[]; +extern uint16_t vbwSteps; #ifdef TINYSA4 extern freq_t ultra_threshold; extern bool ultra; diff --git a/plot.c b/plot.c index 5ba014f..54b8698 100644 --- a/plot.c +++ b/plot.c @@ -1685,7 +1685,8 @@ static void cell_draw_marker_info(int x0, int y0) int level = temppeakLevel - get_attenuation() + setting.external_gain; if ((!setting.subtract_stored) && // Disabled when normalized ((setting.mode == M_LOW && level > -10) || - (setting.mode == M_HIGH && level > -29) )) + (setting.mode == M_HIGH && level > -29) || + (setting.mode == M_LOW && (markers[i].mtype & M_NOISE) && vbwSteps > 1))) //MAXPEAK increases noise marker, should reduce span. color = LCD_BRIGHT_COLOR_RED; else color = marker_color(markers[i].mtype); diff --git a/sa_core.c b/sa_core.c index 00b7f3e..a65e3a2 100644 --- a/sa_core.c +++ b/sa_core.c @@ -4602,6 +4602,11 @@ static volatile int dummy; // palSetLine(LINE_LED); #endif + // Enable traces at sweep complete for redraw + if (enable_after_complete){ + TRACE_ENABLE(enable_after_complete); + enable_after_complete = 0; + } return true; } @@ -5744,9 +5749,11 @@ quit: shell_printf("%6.2f ", (first_level - peakLevel)*10.0 ); if (setting.test_argument != 0) break; + if (operation_requested) goto abort; } } #endif +abort: shell_printf("\n\r"); setting.R = 0; switch_SI4463_RSSI_correction(true); @@ -5764,6 +5771,7 @@ quit: if (setting.test_argument != 0) j = setting.test_argument; test_prepare(TEST_NOISE); + markers[0].mtype = M_NOISE | M_AVER; setting.rbw_x10 = force_rbw(j); setting.extra_lna = true; osalThreadSleepMilliseconds(200); @@ -5798,7 +5806,7 @@ quit: setting.rbw_x10 = force_rbw(j); setting.extra_lna = true; osalThreadSleepMilliseconds(200); - + markers[0].mtype = M_NOISE | M_AVER; set_sweep_frequency(ST_SPAN, (freq_t)(setting.rbw_x10 * (1000 << k))); set_average(AV_100); test_acquire(TC_LEVEL); // Acquire test @@ -5818,6 +5826,7 @@ quit: shell_printf("%6.2f ", (first_level - peakLevel)*10.0 ); if (setting.test_argument != 0) break; + if (operation_requested) goto abort; } } #endif @@ -5899,7 +5908,7 @@ again: set_refer_output(0); set_sweep_frequency(ST_STOP, 60000000); int test_case = TEST_POWER; -#ifdef TINYSA +#ifdef TINYSA4 set_extra_lna(calibrate_lna); #endif set_average(AV_100); diff --git a/si4468.c b/si4468.c index a607564..82422b7 100644 --- a/si4468.c +++ b/si4468.c @@ -1523,15 +1523,15 @@ typedef struct { static const RBW_t RBW_choices[] = { // BW register corr freq - {SI4463_RBW_02kHz, 14,3,22}, - {SI4463_RBW_1kHz, 18,10,9}, - {SI4463_RBW_3kHz, 14,30,8}, - {SI4463_RBW_10kHz, 6,100,6}, - {SI4463_RBW_30kHz, 11,300,2}, - {SI4463_RBW_100kHz, 6,1000,-1}, - {SI4463_RBW_300kHz, 6,3000,-15}, - {SI4463_RBW_600kHz, 6,6000,-21}, - {SI4463_RBW_850kHz,16,8500,-29}, + {SI4463_RBW_02kHz, 21,3, 26}, + {SI4463_RBW_1kHz, 26,10, 10}, + {SI4463_RBW_3kHz, 22,30, 8}, + {SI4463_RBW_10kHz, 12,100, 9}, + {SI4463_RBW_30kHz, 12,300, 12}, + {SI4463_RBW_100kHz, 7,1000, 10}, + {SI4463_RBW_300kHz, 8,3000, 7}, + {SI4463_RBW_600kHz, 8,6000, 15}, + {SI4463_RBW_850kHz,18,8500, 15}, }; const uint8_t SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t)));