Separate NG gain from external amp

multi_trace
erikkaashoek 5 years ago
parent 31dea26076
commit 5f13d6e097

@ -1190,6 +1190,7 @@ void clear_all_config_prop_data(void);
extern void ui_init(void);
extern void ui_process(void);
int current_menu_is_form(void);
extern float nf_gain;
void ui_mode_normal(void);
void ui_mode_menu(void);

@ -1602,10 +1602,10 @@ static void cell_draw_marker_info(int x0, int y0)
aNP = marker_to_value(0);
#endif
float mNF = aNP - logf(actual_rbw_x10*100.0) * (10.0/logf(10.0)) + 173.93 + SI4463_noise_correction_x10/10.0; // measured noise figure at 20C
if (setting.external_gain != 0) {
float mnf = expf(mNF/10 * logf(10)); // measure noise factor
if (nf_gain != 0) {
float mnf = expf((mNF - nf_gain)/10 * logf(10)); // measure noise factor
float tnf = expf(config.noise_figure/10 * logf(10)); // tinySA noise factor
float amp_gain = expf(setting.external_gain/10 * logf(10));
float amp_gain = expf(nf_gain/10 * logf(10));
float anf = mnf - (tnf - 1.0)/amp_gain;
mNF = 10*logf(anf)/logf(10);
}
@ -1617,7 +1617,7 @@ static void cell_draw_marker_info(int x0, int y0)
// j = 1;
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0;
cell_printf(xpos, ypos, FONT_b"NF: %4.1f", mNF);
cell_printf(xpos, ypos, FONT_b"GAIN: %4.1fdB NF: %4.1f", nf_gain, mNF);
break;
#endif
} else

@ -4780,7 +4780,7 @@ enum {
#ifdef TINYSA4
//#define CAL_LEVEL -23.5
#define CAL_LEVEL -23
#define CAL_LEVEL -23.1
#else
#define CAL_LEVEL (has_esd ? -26.2 : -25)
#endif
@ -4833,8 +4833,8 @@ const test_case_t test_case [] =
#define TEST_SPUR 23
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur
#define TEST_LEVEL 24
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ, 30, 0, CAL_LEVEL, 145, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ_LNA, 30, 0, CAL_LEVEL, 145, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ, 30.01, 0, CAL_LEVEL, 145, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ_LNA, 30.01, 0, CAL_LEVEL, 145, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TPH_30MHZ, 150, 0, CAL_LEVEL-30, 145, -55), // 23 Measure level
};

@ -1524,14 +1524,14 @@ static const RBW_t RBW_choices[] =
{
// BW register corr freq
{SI4463_RBW_02kHz, 18,3,42},
{SI4463_RBW_1kHz, 18,10,22},
{SI4463_RBW_3kHz, 12,30,21},
{SI4463_RBW_10kHz, 7,100,20},
{SI4463_RBW_30kHz, 10,300,20},
{SI4463_RBW_100kHz,2,1000,26},
{SI4463_RBW_300kHz,2,3000,19},
{SI4463_RBW_600kHz,3,6000,18},
{SI4463_RBW_850kHz,12,8500,15},
{SI4463_RBW_1kHz, 18,10,29},
{SI4463_RBW_3kHz, 12,30,28},
{SI4463_RBW_10kHz, 7,100,26},
{SI4463_RBW_30kHz, 10,300,22},
{SI4463_RBW_100kHz,2,1000,19},
{SI4463_RBW_300kHz,2,3000,7},
{SI4463_RBW_600kHz,3,6000,-1},
{SI4463_RBW_850kHz,12,8500,-9},
};
const uint8_t SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t)));

@ -1151,6 +1151,7 @@ static UI_FUNCTION_CALLBACK(menu_clearconfig_cb)
ui_mode_normal();
}
float nf_gain;
const char * const averageText[] = { "OFF", "MIN", "MAX", "MAXD", " A 4", "A 16", "AVER", "QUASI", "DECONV"};
static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb)
@ -1348,13 +1349,17 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb)
markers[0].mtype = M_NOISE; // Not tracking
set_extra_lna(true);
kp_help_text = "Amplifier Gain ";
float old_gain = setting.external_gain;
ui_mode_keypad(KM_EXT_GAIN);
kp_help_text = "Noise frequency";
nf_gain = setting.external_gain;
setting.external_gain = old_gain;
kp_help_text = "Noise center frequency";
ui_mode_keypad(KM_CENTER);
set_marker_frequency(0, uistat.value);
// kp_help_text = "Noise width";
// ui_mode_keypad(KM_SPAN);
set_sweep_frequency(ST_SPAN, 0);
kp_help_text = "Noise span";
ui_mode_keypad(KM_SPAN);
set_RBW(get_sweep_frequency(ST_SPAN)/100 / 100);
// set_sweep_frequency(ST_SPAN, 0);
set_average(AV_100);
break;
#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.