calibration procedure updated

pull/34/head
erikkaashoek 4 years ago
parent 80cb6de65c
commit 0846fc33ae

@ -986,8 +986,10 @@ config_t config = {
.drive1_level_offset = 0,
.drive2_level_offset = -1.5,
.drive3_level_offset = -0.5,
.direct_level_offset = 100.0, // Uncalibrated
.ultra_level_offset = 100.0, // Uncalibrated
.direct_level_offset = 0.0, // Uncalibrated
.ultra_level_offset = 0.0, // Uncalibrated
.direct_lna_level_offset = 0,
.ultra_lna_level_offset = 0,
.correction_frequency =
{
/* low */ { 10000, 20000, 30000, 70000, 100000, 500000, 600000, 900000, 2000000, 30000000, 130000000, 350000000, 490000000, 540000000, 600000000, 720000000, 790000000, 810000000, 820000000, 830000000 },

@ -724,6 +724,8 @@ typedef struct config {
float drive3_level_offset;
float direct_level_offset;
float ultra_level_offset;
float direct_lna_level_offset;
float ultra_lna_level_offset;
#endif
#ifdef __NOISE_FIGURE__
float noise_figure;

@ -353,7 +353,7 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
{
// 0 1 2
#ifdef TINYSA4
static const char cmd_mode_list[] = "low|high|switch|receive_switch|out_switch|lna|harmonic|shift1|shift2|drive1|drive2|drive3|direct|ultra";
static const char cmd_mode_list[] = "low|high|switch|receive_switch|out_switch|lna|harmonic|shift1|shift2|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna";
#else
static const char cmd_mode_list[] = "low|high|switch|receive_switch";
#endif
@ -375,7 +375,9 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
shell_printf(p, "drive2", config.drive2_level_offset);
shell_printf(p, "drive3", config.drive3_level_offset);
shell_printf(p, "direct", config.direct_level_offset);
shell_printf(p, "direct_lna", config.direct_lna_level_offset);
shell_printf(p, "ultra", config.ultra_level_offset);
shell_printf(p, "ultra_lna", config.ultra_lna_level_offset);
#endif
return;
}
@ -402,7 +404,9 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
case 10: config.drive2_level_offset = v; break;
case 11: config.drive3_level_offset = v; break;
case 12: config.direct_level_offset = v; break;
case 13: config.ultra_level_offset = v; break;
case 13: config.direct_lna_level_offset = v; break;
case 14: config.ultra_level_offset = v; break;
case 15: config.ultra_lna_level_offset = v; break;
#endif
default: goto usage;
}

@ -1440,11 +1440,17 @@ void set_actual_power(float o) // Set peak level to known value
config.high_level_offset += new_offset;
} else if (setting.mode == M_LOW) {
#ifdef TINYSA4
if (signal_path == PATH_ULTRA)
if (signal_path == PATH_ULTRA) {
if (setting.extra_lna)
config.ultra_lna_level_offset += new_offset;
else
config.ultra_level_offset += new_offset;
else if (signal_path == PATH_DIRECT)
} else if (signal_path == PATH_DIRECT) {
if (setting.extra_lna)
config.direct_lna_level_offset += new_offset;
else
config.direct_level_offset += new_offset;
else if (setting.extra_lna)
} else if (setting.extra_lna)
config.lna_level_offset += new_offset;
else
#endif
@ -1469,19 +1475,20 @@ float get_level_offset(void)
int lev;
#ifdef TINYSA4
if (signal_path == PATH_DIRECT) {
if (setting.extra_lna)
lev = config.direct_lna_level_offset;
else
lev = config.direct_level_offset;
} else if (signal_path == PATH_ULTRA) {
if (setting.extra_lna)
lev = config.ultra_lna_level_offset;
else
lev = config.ultra_level_offset;
} else
} else if (setting.extra_lna)
lev = config.lna_level_offset;
else
#endif
{
lev = config.low_level_offset;
}
#ifdef TINYSA4
if (lev != 1000 && setting.extra_lna) {
lev += config.lna_level_offset;
}
#endif
return(lev == 100? 0 : lev);
}
if (setting.mode == M_GENLOW) {
@ -7032,7 +7039,7 @@ float get_jump_config(int i) {
return 0;
}
enum {CS_NORMAL, CS_LNA, CS_SWITCH, CS_ULTRA, CS_ULTRA990, CS_DIRECT, CS_MAX };
enum {CS_NORMAL, CS_LNA, CS_SWITCH, CS_ULTRA, CS_ULTRA_LNA, CS_ULTRA990, CS_DIRECT, CS_DIRECT_LNA, CS_MAX };
#else
enum {CS_NORMAL, CS_SWITCH, CS_MAX };
#endif
@ -7137,8 +7144,13 @@ again:
test_output = true;
test_path = 2; // Ultra path
break;
case CS_ULTRA_LNA:
test_output = true;
test_path = 3; // Ultra lna path
break;
case CS_LNA:
set_extra_lna(true);
test_output = true;
test_path = 1; // Normal lna path
break;
case CS_ULTRA990:
set_sweep_frequency(ST_CENTER, 150000000);
@ -7150,6 +7162,11 @@ again:
test_output = true;
test_path = 4; // Direct path at 900MHz
break;
case CS_DIRECT_LNA:
set_sweep_frequency(ST_CENTER, 150000000);
test_output = true;
test_path = 5; // Direct lna path at 900MHz
break;
#endif
}
set_average(0, AV_100);
@ -7212,13 +7229,13 @@ again:
} else {
#ifdef TINYSA4
if (calibration_stage == CS_ULTRA990)
direct_level = peakLevel;
else if (calibration_stage == CS_DIRECT)
direct_level = marker_to_value(0);
else if (calibration_stage == CS_DIRECT || calibration_stage == CS_DIRECT_LNA)
set_actual_power(direct_level);
else
#endif
set_actual_power(CAL_LEVEL); // Should be -23.5dBm (V0.2) OR 25 (V0.3)
chThdSleepMilliseconds(1000);
chThdSleepMilliseconds(500);
}
}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.