Cal to 10GHz

pull/94/head
erikkaashoek 2 years ago
parent 9f8c6eb9ee
commit 66124b04b6

@ -1070,16 +1070,17 @@ config_t config = {
.lna_level_offset = 0,
.low_level_output_offset = 0, // Uncalibrated
.high_level_output_offset = 0, // Uncalibrated, but checking code is not yet present
.harmonic_level_offset = 10.5,
.harmonic_level_offset = 0, // 10.5, should be in correction table now
.harmonic_lna_level_offset = 0, // 10.5, should be in correction table now
.shift1_level_offset = 0.5,
.shift2_level_offset = 3,
.shift3_level_offset = 0,
.drive1_level_offset = 0,
.drive2_level_offset = -1.5,
.drive3_level_offset = -0.5,
.direct_level_offset = 30.0, // Uncalibrated
.direct_level_offset = 0.0, // Uncalibrated
.ultra_level_offset = 0.0, // Uncalibrated
.direct_lna_level_offset = 30,
.direct_lna_level_offset = 0,
.ultra_lna_level_offset = 0,
.adf_level_offset = 0,
.correction_frequency =
@ -1090,8 +1091,8 @@ config_t config = {
/* ultra lna */ { 30000000, 700000000, 770000000, 990000000, 1230000000, 2390000000, 2800000000, 2810000000, 3150000000, 3210000000, 3810000000, 4060000000, 4180000000, 4230000000, 4300000000, 4400000000, 4490000000, 4960000000, 5070000000, 6000000000},
/* direct */ { 140000000, 150000000, 160000000, 180000000, 280000000, 300000000, 380000000, 390000000, 410000000, 430000000, 490000000, 520000000, 560000000, 830000000, 840000000, 860000000, 870000000, 960000000, 1040000000, 1130000000},
/* direct lna */ { 140000000, 150000000, 170000000, 180000000, 280000000, 300000000, 340000000, 360000000, 500000000, 560000000, 830000000, 840000000, 860000000, 870000000, 950000000, 1010000000, 1030000000, 1040000000, 1050000000, 1130000000, },
/* harm */ { 4000000000, 4200445434, 5095768374, 5403118040, 5710467706, 5897550111, 6204899777, 6806236080, 7006681514, 7394209354, 7701559020, 7995545657, 8102449889, 8703786192, 8997772829, 9198218263, 9505567929, 9799554566, 9906458797, 10000000000, },
/* harm lna */ { 4000000000, 4200445434, 4400890869, 5897550111, 6004454343, 6298440980, 6498886414, 6806236080, 7100222717, 7501113586, 7701559020, 7795100223, 8102449889, 8383073497, 8797327394, 9305122494, 9492204900, 9599109131, 9799554566, 10000000000, },
/* harm */ { 30000000, 4000000000, 4601336303, 5095768374, 5296213808, 5496659243, 5804008909, 6298440980, 6806236080, 7193763920, 7501113586, 7701559020, 7995545657, 8302895323, 8797327394, 9104677060, 9305122494, 9505567929, 9799554566, 10000000000, },
/* harm lna */ { 30000000, 4000000000, 4093541203, 4200445434, 4293986637, 4400890869, 4601336303, 5296213808, 5897550111, 6405345212, 6498886414, 6806236080, 7100222717, 7594654788, 7795100223, 8102449889, 8503340757, 8997772829, 9599109131, 10000000000, },
/* out */ { 30000, 100000, 200000, 600000, 5000000, 10000000, 110000000, 120000000, 240000000, 300000000, 400000000, 490000000, 650000000, 690000000, 750000000, 780000000, 800000000, 810000000, 823000000, 830000000, },
/* direct */ { 500000000, 823000000, 830000000, 850000000, 860000000, 870000000, 880000000, 890000000, 900000000, 910000000, 920000000, 930000000, 1030000000, 1040000000, 1050000000, 1060000000, 1080000000, 1100000000, 1120000000, 1130000000, },
/* adf */ { 500000000, 1130000000, 1240000000, 1400000000, 1500000000, 1560000000, 1610000000, 1850000000, 1970000000, 2210000000, 2350000000, 2600000000, 2800000000, 2810000000, 2940000000, 3000000000, 3250000000, 3480000000, 3830000000, 4400000000, },
@ -1103,10 +1104,10 @@ config_t config = {
/* low lna */ { 11, 8.54, 6.32, 4.46, 3.18, 1.02, 0.69, 0.2, -0.43, -0.41, 0.58, 0.66, -0.08, 0.58, 0.77, 1.7, 1.77, 3.55, 5.51, 7.99, },
/* ultra */ { 0, 0.58, 1.7, 4.53, 4.46, 3.23, 4.64, 6.29, 5.67, 7.03, 8.78, 7.04, 8.25, 11.42, 11.63, 13.29, 12.38, 12.58, 15.75, 15.93, },
/* ultra lna */ { 0, 0.49, 0.52, 1.26, 3.13, 2.68, 2.68, 3.45, 4.7, 6.2, 8.49, 11.54, 13.51, 15.82, 15.82, 18.66, 19.41, 22.6, 22.8, 28.1, },
/* direct */ { 5.12, 4.22, 2.41, 0, -8.3, -9.59, -13.55, -14.09, -15.14, -15.66, -18.37, -19.29, -21.12, -28.75, -29.37, -28.55, -29.41, -27.8, -26.21, -23.72, },
/* direct lna */ { 4.3, 3.31, 1.69, 0, -10.15, -11.7, -13.87, -14.84, -20.95, -23.28, -30.7, -30.97, -30.8, -31.32, -30.35, -29.25, -28.19, -28.39, -28.02, -25.85, },
/* harm */ { 7.91, 7.91, 13.91, 13.28, 15.28, 16.28, 17.28, 22.28, 20.28, 18.78, 20.28, 26.78, 28.28, 32.28, 36.28, 40.78, 41.78, 40.28, 41.78, 41.28, },
/* harm lna */ { 10.88, 14.38, 19.38, 28.25, 29.25, 33.75, 35.75, 36.75, 34.75, 34.25, 34.75, 35.75, 42.25, 46.25, 50.25, 56.25, 56.25, 56.75, 60.25, 67.4, },
/* direct */ { 35.12, 34.22, 32.41, 30, 21.7, 20.41, 16.45, 15.91, 14.86, 14.34, 11.63, 10.71, 8.88, 1.25, 0.629999999999999, 1.45, 0.59, 2.2, 3.79, 6.28, },
/* direct lna */ { 34.3, 33.31, 31.69, 30, 19.85, 18.3, 16.13, 15.16, 9.05, 6.72, -0.699999999999999, -0.969999999999999, -0.800000000000001, -1.32, -0.350000000000001, 0.75, 1.81, 1.61, 1.98, 4.15, },
/* harm */ { 2, 18.69, 21.69, 21.69, 20.69, 20.69, 23.1, 25.19, 29.7, 26.69, 26.19, 27.69, 33.69, 37.19, 40.69, 45.69, 48.19, 49.48, 47.7, 48.7, },
/* harm lna */ { 2.8, 22.25, 23.25, 25.75, 29.75, 32.25, 34.25, 33.25, 36.25, 42.75, 43.75, 44.7, 42.7, 42.25, 43.75, 50.25, 55.75, 61.25, 65.25, 72.75, },
/* out */ { 4.67, 1.06, -0.8, -2.53, -4.01, -4.16, -4.57, -4.67, -3.57, -3.42, -2.95, -3.52, -3.4, -2.96, -2.11, -1.1, 0.02, 0.96, 2.86, 4.87, },
/* direct */ { -7.4, -3.63, -3.52, -3.35, -3.22, -3.1, -2.99, -2.9, -2.79, -2.62, -2.51, -2.47, -1.14, -1.02, -0.87, -0.77, -0.38, -0.22, 0.04, 0.22, },
/* adf */ { -1.05, -0.3, 2.28, 6.72, 8.44, 8.97, 8.96, 8.5, 8.02, 7.74, 8.48, 7.73, 6.22, 5.33, 3.38, 3.11, 3.12, 5.15, 9.5, 11.12, },
@ -1153,8 +1154,8 @@ const freq_t v5_2_correction_frequency[CORRECTION_SIZE][CORRECTION_POINTS]=
/* ultra lna */ { 30000000, 700000000, 1130000000, 1840000000, 2490000000, 2800000000, 2810000000, 3110000000, 3500000000, 3940000000, 4480000000, 4610000000, 4940000000, 5450000000, 6030000000, 6200000000, 6580000000, 6650000000, 7150000000, 7250000000},
/* direct */ { 140000000, 150000000, 160000000, 180000000, 280000000, 290000000, 300000000, 330000000, 340000000, 350000000, 410000000, 480000000, 560000000, 823000000, 830000000, 850000000, 890000000, 950000000, 1090000000, 1120000000},
/* direct lna */ { 140000000, 150000000, 170000000, 180000000, 280000000, 290000000, 310000000, 370000000, 440000000, 470000000, 480000000, 560000000, 823000000, 830000000, 850000000, 890000000, 950000000, 1040000000, 1090000000, 1120000000, },
/* harm */ { 6000000000, 6115812918, 6356347439, 6712694878, 7149220490, 7443207127, 7808463252, 8280623608, 8458797327, 8565701559, 8788418708, 9002227171, 9135857461, 9224944321, 9447661470, 9527839644, 9590200445, 9679287305, 9839643653, 10000000000, },
/* harm lna */ { 6000000000, 6204899777, 6579064588, 6908685969, 7033407572, 7345211581, 7594654788, 8146993318, 8360801782, 8672605791, 8832962138, 9100222717, 9216035635, 9305122494, 9420935412, 9563474388, 9652561247, 9688195991, 9768374165, 10000000000, },
/* harm */ { 30000000, 6000000000, 6400890869, 6596881960, 7104677060, 7398663697, 7603563474, 8004454343, 8200445434, 8396436526, 8503340757, 8601336303, 8904231626, 9100222717, 9296213808, 9403118040, 9599109131, 9804008909, 9902004454, 10000000000, },
/* harm lna */ { 30000000, 6000000000, 6195991091, 6596881960, 6997772829, 7300668151, 7603563474, 7897550111, 8200445434, 8396436526, 8601336303, 8797327394, 8904231626, 9100222717, 9198218263, 9305122494, 9501113586, 9599109131, 9697104677, 10000000000, },
/* out */ { 10000, 30000, 100000, 200000, 600000, 5000000, 170000000, 250000000, 300000000, 390000000, 490000000, 650000000, 690000000, 740000000, 780000000, 800000000, 810000000, 820000000, 823000000, 830000000, },
/* direct */ { 500000000, 823000000, 830000000, 850000000, 860000000, 870000000, 880000000, 890000000, 900000000, 910000000, 920000000, 930000000, 970000000, 1030000000, 1040000000, 1050000000, 1060000000, 1070000000, 1080000000, 1100000000, },
/* adf */ { 500000000, 700000000, 1340000000, 1500000000, 2000000000, 2350000000, 2800000000, 2810000000, 3000000000, 3410000000, 3600000000, 3990000000, 4330000000, 4570000000, 4760000000, 5310000000, 5320000000, 5720000000, 6100000000, 6440000000, },
@ -1167,17 +1168,18 @@ const float v5_2_correction_value[CORRECTION_SIZE][CORRECTION_POINTS]=
/* low lna */ { 17.53, 11.92, 5.48, 0.9, -1.57, -3.5, 1.8, 2.47, 2.75, 4.08, 9.22, 6.07, 5.23, 3.5, 3.77, 4.9, 7.06, 9.11, 12.48, 19.18, },
/* ultra */ { -0.01, -0.42, -0.53, 0.38, 1.65, 1.35, 2.24, 2.96, 2.88, 4.4, 4.85, 5.43, 7.64, 8.82, 8.2, 11.3, 12.94, 15.53, 22.44, 29.28, },
/* ultra lna */ { 0.65, 4.24, 4.91, 5.15, 7.38, 6.29, 7.14, 7.09, 10.38, 10.66, 12.3, 11.71, 14.07, 13.1, 19, 19.03, 16.03, 16.88, 32.09, 34.59, },
/* direct */ { 4.02, 1.94, 0.89, -1.12, -9.9, -9.77, -10.96, -11.94, -13.25, -13.06, -16.61, -19.37, -22.8, -31.19, -31.19, -31.29, -31, -30.04, -26.96, -25.97, },
/* direct lna */ { -0.35, -1.49, -3.27, -4.18, -10.33, -11.33, -13.36, -16.19, -20.27, -22.38, -22.43, -25.42, -33.66, -33.66, -33.67, -33.68, -32.48, -30.38, -29.14, -28.47, },
/* harm */ { 19.53, 20.53, 20.56, 23.03, 23.56, 25.56, 29.53, 37.53, 39.56, 39.03, 37.03, 37.53, 38.53, 40.56, 44.56, 45.03, 47.53, 48.56, 51.03, 52.53, },
/* harm lna */ { 26.91, 27.91, 23.91, 28.91, 29.91, 30.41, 34.44, 47.41, 48.41, 44.41, 44.41, 49.41, 53.41, 58.91, 63.91, 66.01, 65.38, 66.91, 65.44, 66.41, },
/* direct */ { 34.02, 31.94, 30.89, 28.88, 20.1, 20.23, 19.04, 18.06, 16.75, 16.94, 13.39, 10.63, 7.2, -1.19, -1.19, -1.29, -1, -0.0399999999999991, 3.04, 4.03, },
/* direct lna */ { 29.65, 28.51, 26.73, 25.82, 19.67, 18.67, 16.64, 13.81, 9.73, 7.62, 7.57, 4.58, -3.66, -3.66, -3.67, -3.68, -2.48, -0.379999999999999, 0.859999999999999, 1.53, },
/* harm */ { 18.6, 17.38, 18.68, 19.78, 20.88, 22.41, 24.41, 29.91, 33.41, 36.41, 36.91, 35.91, 33.91, 35.41, 39.91, 41.91, 45, 47.91, 48.91, 50.41, },
/* harm lna */ { 13.6, 26.38, 26.38, 21.88, 26.88, 28.65, 31.88, 39.88, 45.88, 45.88, 42.88, 42.3, 42.98, 46.88, 51.38, 56.38, 63.38, 63.88, 62.88, 65.34, },
/* out */ { 3.84, 2.31, 1.04, 0.1, -0.82, -1.51, -2.33, -2.25, -2.04, -1.43, -2.2, -2.36, -1.84, -1.23, 0.51, 1.8, 3.17, 6.28, 7.85, 12.37, },
/* direct */ { -7.76, -3.85, -3.71, -3.54, -3.45, -3.34, -3.23, -3.11, -2.98, -2.86, -2.74, -2.64, -2.14, -1.29, -1.14, -1.05, -0.89, -0.79, -0.62, -0.31, },
/* adf */ { 5.58, 3.91, -4.52, -6, -3.36, -2.14, -2.3, -3.11, -3.11, -2.05, -1.5, -1.36, 1.28, 4.63, 5.89, 5.55, 5.47, 6.49, 3.86, 5.8, },
/* ultra */ { 3.69, 0.75, -0.94, -1.61, -2.45, -3.16, -1.09, 0.2, 0.73, 2.14, 2.37, 4.84, 3.13, 4.15, 4.89, 4.13, 7.48, 7.14, 8.99, 18.8, },
};
const float v5_2_harmonic_level_offset = 0; //-7; // Depends on where the transition to harmonic is done!!!!!! TODO find best frequency to transition to harmonic
const float v5_2_harmonic_lna_level_offset = 0; // should be in correction table now -7; // Depends on where the transition to harmonic is done!!!!!! TODO find best frequency to transition to harmonic
const float v5_2_harmonic_level_offset = 0; // should be in correction table now -7; // Depends on where the transition to harmonic is done!!!!!! TODO find best frequency to transition to harmonic
const float v5_2_lna_level_offset = 7;
#endif
@ -1288,7 +1290,6 @@ VNA_SHELL_FUNCTION(cmd_hop)
usage_printf("hop {start(Hz)} {stop(Hz)} {step(Hz) | points} [outmask]\r\n");
return;
}
start = my_atoui(argv[0]);
if (argc > 1)
stop = my_atoui(argv[1]);
@ -1304,6 +1305,8 @@ VNA_SHELL_FUNCTION(cmd_hop)
}
} else
step = 1;
if (step == 0)
step = 1;
int old_sweep = sweep_mode;
if (old_sweep & SWEEP_ENABLE)
pause_sweep();
@ -1324,6 +1327,8 @@ VNA_SHELL_FUNCTION(cmd_hop)
shell_printf("frequency range is invalid\r\n");
return;
}
freq_t old_frequency_step = setting.frequency_step;
setting.frequency_step = setting.rbw_x10*100;
if (mask) {
int old_vbwSteps = vbwSteps;
// vbwSteps = 1;
@ -1337,6 +1342,8 @@ VNA_SHELL_FUNCTION(cmd_hop)
}
vbwSteps = old_vbwSteps;
}
setting.frequency_step = old_frequency_step;
if (old_sweep & SWEEP_ENABLE)
resume_sweep();
}
@ -2829,6 +2836,20 @@ static void dac_init(void){
#define PULSE
#endif
#ifdef TINYSA4
void set_freq_boundaries(void) {
if (max2871) {
MAX_LO_FREQ = 6300000000ULL + config.overclock;
MAX_ABOVE_IF_FREQ = 4470000000ULL + config.overclock; // Range to use for below IF
MIN_BELOW_IF_FREQ = 2310000000ULL + config.overclock; // Range to use for below IF
} else {
MAX_LO_FREQ = 4350000000ULL + config.overclock;
MAX_ABOVE_IF_FREQ = 3360000000ULL + config.overclock; // Range to use for below IF
MIN_BELOW_IF_FREQ = 2310000000ULL + config.overclock; // Range to use for below IF
}
set_jump_freq( MAX_ABOVE_IF_FREQ, (config.harmonic_start?config.harmonic_start:ULTRA_MAX_FREQ));
}
#endif
int main(void)
{
halInit();
@ -2959,23 +2980,17 @@ int main(void)
#endif
int reset_state = btn_side();
#ifdef TINYSA4
if (adc1_single_read(0)> 1000)
if (adc1_single_read(0)> 1000) {
max2871 = true;
if (max2871) {
ULTRA_MAX_FREQ = 7000000000ULL + config.overclock; // Start of harmonic mode
MAX_LO_FREQ = 6300000000ULL + config.overclock;
MAX_ABOVE_IF_FREQ = 4470000000ULL + config.overclock; // Range to use for below IF
MIN_BELOW_IF_FREQ = 2310000000ULL + config.overclock; // Range to use for below IF
memcpy(config.correction_frequency, v5_2_correction_frequency, sizeof(config.correction_frequency));
memcpy(config.correction_value, v5_2_correction_value, sizeof(config.correction_value));
config.harmonic_level_offset = v5_2_harmonic_level_offset;
config.harmonic_lna_level_offset = v5_2_harmonic_lna_level_offset;
ULTRA_MAX_FREQ = 7000000000ULL;
} else {
ULTRA_MAX_FREQ = 5340000000ULL + config.overclock; // Start of harmonic mode
MAX_LO_FREQ = 4350000000ULL + config.overclock;
MAX_ABOVE_IF_FREQ = 3360000000ULL + config.overclock; // Range to use for below IF
MIN_BELOW_IF_FREQ = 2310000000ULL + config.overclock; // Range to use for below IF
ULTRA_MAX_FREQ = 5340000000ULL;
}
set_jump_freq( MAX_ABOVE_IF_FREQ, ULTRA_MAX_FREQ);
set_freq_boundaries();
#endif
if (!reset_state) {
if(config_recall()) {
@ -2983,18 +2998,7 @@ int main(void)
}
}
#ifdef TINYSA4
if (max2871) {
ULTRA_MAX_FREQ = 7000000000ULL + config.overclock; // Start of harmonic mode
MAX_LO_FREQ = 6300000000ULL + config.overclock;
MAX_ABOVE_IF_FREQ = 4470000000ULL + config.overclock; // Range to use for below IF
MIN_BELOW_IF_FREQ = 2310000000ULL + config.overclock; // Range to use for below IF
} else {
ULTRA_MAX_FREQ = 5340000000ULL + config.overclock; // Start of harmonic mode
MAX_LO_FREQ = 4350000000ULL + config.overclock;
MAX_ABOVE_IF_FREQ = 3360000000ULL + config.overclock; // Range to use for below IF
MIN_BELOW_IF_FREQ = 2310000000ULL + config.overclock; // Range to use for below IF
}
set_jump_freq( MAX_ABOVE_IF_FREQ, ULTRA_MAX_FREQ);
set_freq_boundaries(); // In case harmonic_start was set
#endif
config.cor_am = 0; // Should be removed from config
config.cor_nfm = 0;

@ -243,7 +243,7 @@ typedef uint32_t freq_t;
extern freq_t MAX_ABOVE_IF_FREQ; // Range to use for below IF
extern freq_t MIN_BELOW_IF_FREQ; // Range to use for below IF
extern int max2871;
extern void set_freq_boundaries(void);
#endif
typedef float measurement_t[TRACES_MAX][POINTS_COUNT];
extern measurement_t measured;
@ -275,6 +275,7 @@ freq_t my_atoui(const char *p);
int shell_printf(const char *fmt, ...);
int usage_printf(const char *fmt, ...);
void clear_backup(void);
const char *get_hw_version_text(void);
#ifdef __REMOTE_DESKTOP__
extern uint8_t remote_mouse_down;
@ -798,6 +799,7 @@ typedef struct config {
float out_switch_offset;
float lna_level_offset;
float harmonic_level_offset;
float harmonic_lna_level_offset;
float shift1_level_offset;
float shift2_level_offset;
float shift3_level_offset;
@ -1461,7 +1463,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e61 /* 'CONF' */
#define CONFIG_MAGIC 0x434f4e65 /* 'CONF' */
#define SETTING_MAGIC 0x434f4e64
extern int16_t lastsaveid;

@ -408,7 +408,7 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
{
// 0 1 2
#ifdef TINYSA4
static const char cmd_mode_list[] = "low|switch|receive_switch|out_switch|lna|harmonic|shift1|shift2|shift3|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna|adf";
static const char cmd_mode_list[] = "low|switch|receive_switch|out_switch|lna|harmonic|shift1|shift2|shift3|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna|harmonic_lna|adf";
#else
static const char cmd_mode_list[] = "low|high|switch|receive_switch";
#endif
@ -430,6 +430,7 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
shell_printf(p, "out_switch", config.out_switch_offset);
shell_printf(p, "lna", config.lna_level_offset);
shell_printf(p, "harmonic", config.harmonic_level_offset);
shell_printf(p, "harmonic_lna", config.harmonic_lna_level_offset);
shell_printf(p, "shift1", config.shift1_level_offset);
shell_printf(p, "shift2", config.shift2_level_offset);
shell_printf(p, "shift3", config.shift3_level_offset);
@ -477,7 +478,8 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
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;
case 16: config.adf_level_offset = v; break;
case 16: config.harmonic_lna_level_offset = v; break;
case 17: config.adf_level_offset = v; break;
#endif
default: goto usage;
}

@ -1573,10 +1573,17 @@ float set_actual_power(float target_level) // Set peak level to kno
// if (in_calibration && SDU1.config->usbp->state == USB_ACTIVE)
// shell_printf ("stage=%d, target=%5.2f, actual=%5.2f, correction=%5.2f, old correction=%5.2f\r\n", calibration_stage, target_level, actual_level, offset_correction, get_level_offset());
if (signal_path == PATH_ULTRA) {
if (setting.extra_lna)
config.ultra_lna_level_offset += offset_correction;
else
config.ultra_level_offset += offset_correction;
if (LO_harmonic) {
if (setting.extra_lna)
config.harmonic_lna_level_offset += offset_correction;
else
config.harmonic_level_offset += offset_correction;
} else {
if (setting.extra_lna)
config.ultra_lna_level_offset += offset_correction;
else
config.ultra_level_offset += offset_correction;
}
} else if (signal_path == PATH_DIRECT) {
if (setting.extra_lna)
config.direct_lna_level_offset += offset_correction;
@ -1599,6 +1606,8 @@ float set_actual_power(float target_level) // Set peak level to kno
float get_level_offset(void)
{
if (setting.disable_correction)
return 0;
if (setting.mode == M_HIGH) {
if (config.high_level_offset == 100) // Offset of 100 means not calibrated
return 0;
@ -1615,10 +1624,17 @@ float get_level_offset(void)
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;
if (LO_harmonic) {
if (setting.extra_lna)
lev = config.harmonic_lna_level_offset;
else
lev = config.harmonic_level_offset;
} else {
if (setting.extra_lna)
lev = config.ultra_lna_level_offset;
else
lev = config.ultra_level_offset;
}
} else if (setting.extra_lna)
lev = config.lna_level_offset;
else
@ -2238,7 +2254,7 @@ pureRSSI_t get_frequency_correction(freq_t f) // Frequency dependent RSSI c
if (LO_harmonic)
actual_drive = 3;
// else if (f < DRIVE0_MAX_FREQ) // below 600MHz
// actual_drive = 0;
// actual_drive = 0; // Never use drive zero
else if (f < DRIVE1_MAX_FREQ) // below 1.2GHz
actual_drive = 1;
else if (f < DRIVE2_MAX_FREQ) // below 2.1GHz
@ -2250,24 +2266,23 @@ pureRSSI_t get_frequency_correction(freq_t f) // Frequency dependent RSSI c
// ----------------- end duplication of code
//
if (actual_drive >= 1)
cv += float_TO_PURE_RSSI(config.drive1_level_offset);
if (actual_drive >= 2)
cv += float_TO_PURE_RSSI(config.drive2_level_offset);
if (actual_drive >= 3)
cv += float_TO_PURE_RSSI(config.drive3_level_offset);
switch (signal_path) {
case PATH_LOW:
c = CORRECTION_LOW_IN;
break;
case PATH_ULTRA:
c = CORRECTION_LOW_ULTRA;
if (LO_harmonic) {
c = CORRECTION_HARM;
cv += float_TO_PURE_RSSI(config.harmonic_level_offset); // +10.5dB correction.
} else if (f>MAX_ABOVE_IF_FREQ) {
cv += float_TO_PURE_RSSI(config.shift3_level_offset);
} else {
c = CORRECTION_LOW_ULTRA;
// if (actual_drive >= 1)
// cv += float_TO_PURE_RSSI(config.drive1_level_offset); // always zero
if (actual_drive >= 2)
cv += float_TO_PURE_RSSI(config.drive2_level_offset);
if (actual_drive >= 3)
cv += float_TO_PURE_RSSI(config.drive3_level_offset);
if (f>MAX_ABOVE_IF_FREQ)
cv += float_TO_PURE_RSSI(config.shift3_level_offset);
}
break;
@ -2357,8 +2372,12 @@ pureRSSI_t get_frequency_correction(freq_t f) // Frequency dependent RSSI c
freq_t m = (setting.correction_frequency[i] - setting.correction_frequency[i-1]) >> SCALE_FACTOR ;
float multi = (setting.correction_value[i] - setting.correction_value[i-1]) * (1 << (SCALE_FACTOR -1)) / (float)m;
float cv = setting.correction_value[i-1] + ((f >> SCALE_FACTOR) * multi) / (float)(1 << (SCALE_FACTOR -1)) ;
#else
#ifdef TINYSA4
int64_t scaled_f = f >> FREQ_SCALE_FACTOR;
#else
int32_t scaled_f = f >> FREQ_SCALE_FACTOR;
#endif
int32_t scaled_f_divider = (config.correction_frequency[c][i] - config.correction_frequency[c][i-1]) >> FREQ_SCALE_FACTOR;
if (scaled_f_divider!=0)
cv += (scaled_correction_value[c][i-1] + ((scaled_f * scaled_correction_multi[c][i])/scaled_f_divider)) >> (SCALE_FACTOR - 5) ;
@ -4284,7 +4303,6 @@ again: // Spur redu
#ifdef __SI5351__
if (si5351_available) {
if (setting.R == 0) {
setting.increased_R = false;
if (setting.mode == M_GENLOW) {
if (local_modulo == 0) ADF4351_modulo(1000);
ADF4350_shift_ref(false);
@ -4302,7 +4320,6 @@ again: // Spur redu
} else
if (get_sweep_frequency(ST_SPAN)<5000000) { // When scanning less then 5MHz
if (actual_rbw_x10 <= 3000) {
setting.increased_R = true;
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(2); // To avoid PLL Loop shoulders at multiple of 10MHz
@ -4326,7 +4343,6 @@ again: // Spur redu
#endif
{
if (setting.R == 0) {
setting.increased_R = false;
if (setting.mode == M_GENLOW) {
if (max2871) {
if (local_modulo == 0) ADF4351_modulo(1000);
@ -4338,8 +4354,7 @@ again: // Spur redu
} else if (lf < 25000000 && max2871) {
ADF4351_R_counter(-1);
ADF4351_modulo(200);
} else if (lf > 8000000 && lf < 3000000000 && MODE_INPUT(setting.mode)) {
if (max2871)
} else if (lf > 8000000 /* && lf < 3000000000*/ && MODE_INPUT(setting.mode)) {
if (local_modulo == 0) {
if (max2871)
ADF4351_modulo(100);
@ -4348,13 +4363,12 @@ again: // Spur redu
}
freq_t tf = ((lf + actual_rbw_x10*AVOID_MULTI) / TCXO) * TCXO;
if (tf + actual_rbw_x10*AVOID_MULTI >= lf && tf < lf + actual_rbw_x10*AVOID_MULTI /* && tf != 180000000 */ ) { // 30MHz
setting.increased_R = true;
if (max2871) {
if (lf > 59000000 && lf <390000000) {
if (lf > 59000000) {
// if (tf == 180000000) {
// ADF4351_R_counter(7);
// } else
ADF4351_R_counter(8);
ADF4351_R_counter(8);
}
} else {
if ( (tf / TCXO) & 1 ) { // Odd harmonic of 30MHz
@ -4368,16 +4382,13 @@ again: // Spur redu
else 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
setting.increased_R = true;
ADF4351_R_counter(4);
ADF4351_R_counter(4);
else
setting.increased_R = true;
ADF4351_R_counter(3);
ADF4351_R_counter(3);
}
#endif
else if (get_sweep_frequency(ST_SPAN)<5000000) { // When scanning less then 5MHz
if (actual_rbw_x10 <= 3000) {
setting.increased_R = true;
freq_t tf = ((lf + actual_rbw_x10*1000) / TXCO_DIV3) * TXCO_DIV3;
if (tf + actual_rbw_x10*1000 >= lf && tf < lf + actual_rbw_x10*1000) // 10MHz
ADF4351_R_counter(-4); // To avoid PLL Loop shoulders at multiple of 10MHz
@ -4389,7 +4400,7 @@ again: // Spur redu
else if (max2871)
ADF4351_R_counter(1);
else
ADF4351_R_counter(2);
ADF4351_R_counter(1);
} else { // Input above 800 MHz
if (local_modulo == 0) {
@ -4403,14 +4414,13 @@ again: // Spur redu
}
#if 0
if (setting.frequency_step < 100000) {
setting.increased_R = true;
ADF4351_R_counter(3);
} else
#endif
if (max2871)
ADF4351_R_counter(1); // Used to be 1
else
ADF4351_R_counter(2); // Used to be 1
ADF4351_R_counter(1); // Used to be 1
}
} else {
ADF4351_R_counter(setting.R%1000);
@ -7628,7 +7638,7 @@ float get_jump_config(int i) {
return 0;
}
enum {CS_NORMAL, CS_LNA, CS_SWITCH, CS_ULTRA, CS_ULTRA_LNA, CS_DIRECT_REF, CS_DIRECT, CS_DIRECT_LNA, CS_MAX };
enum {CS_NORMAL, CS_LNA, CS_SWITCH, CS_ULTRA, CS_ULTRA_LNA, CS_DIRECT_REF, CS_DIRECT, CS_DIRECT_LNA, CS_HARMONIC, CS_HARMONIC_LNA, CS_MAX };
#define ULTRA_HARMONIC_CAL_FREQ 5340000000
#else
enum {CS_NORMAL, CS_SWITCH, CS_MAX };
@ -7851,6 +7861,14 @@ void calibrate(void)
force_signal_path = true;
config.direct_lna_level_offset += 1.0;
break;
case CS_HARMONIC:
test_path = 6; // harmonic path
force_signal_path = true;
break;
case CS_HARMONIC_LNA:
test_path = 7; // harmonic lna path
force_signal_path = true;
break;
#endif
}
set_average(0, AV_100);

@ -633,6 +633,10 @@ void ADF4351_R_counter(int new_R)
if (new_R<1)
return;
R = new_R;
if (R>1)
setting.increased_R = true;
else
setting.increased_R = false;
clear_frequency_cache(); // When R changes the possible frequencies will change
}

198
ui.c

@ -1539,6 +1539,7 @@ static const menuitem_t menu_curve_confirm[];
static const menuitem_t menu_settings3[];
static const menuitem_t menu_measure_noise_figure[];
static const menuitem_t menu_calibrate_harmonic[];
static const menuitem_t menu_calibrate_normal[];
static const menuitem_t menu_calibrate_max[];
#endif
static const menuitem_t menu_calibrate[];
@ -1684,6 +1685,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_curve_acb)
reset_settings(old_m);
}
break;
case CORRECTION_LNA_DIRECT:
case CORRECTION_LNA_HARM:
case CORRECTION_LNA:
case CORRECTION_LNA_ULTRA:
@ -1723,6 +1725,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_curve_acb)
#endif
#ifdef TINYSA4
case CORRECTION_DIRECT:
case CORRECTION_HARM:
case CORRECTION_LOW_ULTRA:
goto common;
@ -1739,6 +1742,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_curve_acb)
setting.step_delay_mode = SD_PRECISE;
setting.repeat = 10;
current_curve_index = data;
force_signal_path = true;
test_path = current_curve;
menu_push_submenu(menu_curve_confirm);
break;
}
@ -1756,6 +1761,7 @@ UI_FUNCTION_CALLBACK(menu_curve_confirm_cb)
config_save();
}
}
force_signal_path = false;
menu_move_back(false);
}
@ -1781,7 +1787,6 @@ UI_FUNCTION_CALLBACK(menu_noise_figure_confirm_cb)
static UI_FUNCTION_CALLBACK(menu_input_curve_prepare_cb)
{
(void)item;
(void)data;
#ifdef TINYSA4
if (!input_is_calibrated())
return;
@ -1791,7 +1796,7 @@ static UI_FUNCTION_CALLBACK(menu_input_curve_prepare_cb)
ui_mode_keypad(KM_LEVEL);
if (kp_buf[0] != 0) {
local_actual_level = uistat.value;
current_curve = CORRECTION_LOW_IN;
current_curve = data;
menu_push_submenu(menu_curve);
}
}
@ -1815,7 +1820,7 @@ static UI_FUNCTION_CALLBACK(menu_high_curve_prepare_cb)
}
#endif
#ifdef TINYSA4
#if 0
static UI_FUNCTION_CALLBACK(menu_lna_curve_prepare_cb)
{
(void)item;
@ -1848,6 +1853,22 @@ static UI_FUNCTION_CALLBACK(menu_lna_u_curve_prepare_cb)
}
}
static UI_FUNCTION_CALLBACK(menu_lna_h_curve_prepare_cb)
{
(void)item;
(void)data;
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
ui_mode_keypad(KM_LEVEL);
if (kp_buf[0] != 0) {
local_actual_level = uistat.value;
current_curve = CORRECTION_LNA_HARM;
menu_push_submenu(menu_curve);
}
}
static UI_FUNCTION_CALLBACK(menu_ultra_curve_prepare_cb)
{
(void)item;
@ -1864,16 +1885,50 @@ static UI_FUNCTION_CALLBACK(menu_ultra_curve_prepare_cb)
}
}
static UI_FUNCTION_CALLBACK(menu_direct_curve_prepare_cb)
{
(void)item;
(void)data;
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
ui_mode_keypad(KM_LEVEL);
if (kp_buf[0] != 0) {
local_actual_level = uistat.value;
current_curve = CORRECTION_LOW_ULTRA;
menu_push_submenu(menu_curve);
}
}
static UI_FUNCTION_CALLBACK(menu_harm_curve_prepare_cb)
{
(void)item;
(void)data;
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
ui_mode_keypad(KM_LEVEL);
if (kp_buf[0] != 0) {
local_actual_level = uistat.value;
current_curve = CORRECTION_HARM;
menu_push_submenu(menu_curve);
}
}
#endif
static UI_FUNCTION_CALLBACK(menu_output_curve_prepare_cb)
{
(void)item;
(void)data;
if (!output_is_calibrated())
return;
current_curve = CORRECTION_LOW_OUT;
current_curve = data;
menu_push_submenu(menu_curve);
}
#if 0
static UI_FUNCTION_CALLBACK(menu_output_ultra_curve_prepare_cb)
{
(void)item;
@ -1903,14 +1958,6 @@ static UI_FUNCTION_CALLBACK(menu_output_adf_curve_prepare_cb)
current_curve = CORRECTION_LOW_OUT_ADF;
menu_push_submenu(menu_curve);
}
#else
static UI_FUNCTION_CALLBACK(menu_output_curve_prepare_cb)
{
(void)item;
current_curve = data;
menu_push_submenu(menu_curve);
}
#endif
#endif
@ -2145,6 +2192,33 @@ static UI_FUNCTION_CALLBACK(menu_scale_cb)
ui_mode_keypad(KM_SCALE);
ui_mode_normal();
}
#ifdef TINYSA4
//char hstart[6];
static UI_FUNCTION_ADV_CALLBACK(menu_calibrate_normal_acb)
{
(void)item;
if(b){
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", (config.harmonic_start?config.harmonic_start:ULTRA_MAX_FREQ));
b->param_1.text = uistat.text;
return;
}
if (data == 0)
menu_push_submenu(menu_calibrate_normal);
}
static UI_FUNCTION_ADV_CALLBACK(menu_calibrate_harmonic_acb)
{
(void)item;
if(b){
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", (config.harmonic_start?config.harmonic_start:ULTRA_MAX_FREQ));
b->param_1.text = uistat.text;
return;
}
if (data == 0)
menu_push_submenu(menu_calibrate_harmonic);
}
#endif
#ifdef __CALIBRATE__
static UI_FUNCTION_CALLBACK(menu_calibrate_cb)
@ -2213,11 +2287,11 @@ static UI_FUNCTION_CALLBACK(menu_config_cb)
show_version();
break;
case CONFIG_MENUITEM_CALIBRATE:
#ifdef TINYSA4
menu_push_submenu(max2871?menu_calibrate_max:menu_calibrate);
#else
//#ifdef TINYSA4
// menu_push_submenu(max2871?menu_calibrate_max:menu_calibrate);
//#else
menu_push_submenu(menu_calibrate);
#endif
//#endif
return;
}
ui_mode_normal();
@ -2871,9 +2945,9 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb)
ui_mode_keypad(KM_CENTER);
set_marker_frequency(0, uistat.value);
#ifdef TINYSA4
kp_help_text = "Modulation frequency: 500Hz .. 10kHz";
kp_help_text = "Modulation frequency: 500Hz .. 20kHz";
ui_mode_keypad(KM_SPAN);
if (uistat.value < 500 || uistat.value > 10000)
if (uistat.value < 500 || uistat.value > 20000)
goto no_measurement;
set_RBW(uistat.value/300);
#else
@ -4573,7 +4647,43 @@ static const menuitem_t menu_curve_confirm[] = {
{ MT_CALLBACK, 0, "CANCEL", menu_curve_confirm_cb },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
#define CORRECTION_LOW_IN 0
#define CORRECTION_LNA 1
#define CORRECTION_LOW_ULTRA 2
#define CORRECTION_LNA_ULTRA 3
#define CORRECTION_DIRECT 4
#define CORRECTION_LNA_DIRECT 5
#define CORRECTION_HARM 6
#define CORRECTION_LNA_HARM 7
static const menuitem_t menu_actual_in_power[] =
{
{ MT_CALLBACK, CORRECTION_LOW_IN, "IN\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LNA, "IN LNA\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_ULTRA, "IN ULTRA\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LNA_ULTRA, "IN ULTRA\nLNA CURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_DIRECT, "IN DIRECT\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LNA_DIRECT, "IN DIRECT\nLNA CURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_HARM, "IN HARM\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LNA_HARM, "IN HARM\nLNA CURVE", menu_input_curve_prepare_cb},
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
static const menuitem_t menu_actual_out_power[] =
{
{ MT_CALLBACK, CORRECTION_LOW_OUT, "OUT\nCURVE", menu_output_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_OUT_DIRECT, "OUT DIR\nCURVE", menu_output_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_OUT_ADF, "OUT ADF\nCURVE", menu_output_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_OUT_MIXER, "OUT MIXER\nCURVE", menu_output_curve_prepare_cb},
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#endif
static const menuitem_t menu_actual_power[] =
{
{ MT_KEYPAD, KM_ACTUALPOWER, "INPUT\nLEVEL", "Enter actual level under marker"},
@ -4584,18 +4694,13 @@ static const menuitem_t menu_actual_power[] =
#endif
#ifdef __CURVE_EDIT__
#ifdef TINYSA4
{ MT_CALLBACK, 0, "IN\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, 0, "IN LNA\nCURVE", menu_lna_curve_prepare_cb},
{ MT_CALLBACK, 0, "IN ULTRA\nCURVE", menu_ultra_curve_prepare_cb},
{ MT_CALLBACK, 0, "IN ULTRA\nLNA CURVE", menu_lna_u_curve_prepare_cb},
{ MT_CALLBACK, 0, "OUT\nCURVE", menu_output_curve_prepare_cb},
{ MT_CALLBACK, 0, "OUT DIR\nCURVE", menu_output_direct_curve_prepare_cb},
{ MT_CALLBACK, 0, "OUT ADF\nCURVE", menu_output_adf_curve_prepare_cb},
{ MT_CALLBACK, 0, "OUT MIXER\nCURVE", menu_output_ultra_curve_prepare_cb},
{ MT_SUBMENU, 0, "INPUT\nCURVES", menu_actual_in_power},
{ MT_SUBMENU, 0, "OUTPUT\nCURVES", menu_actual_out_power},
#else
{ MT_CALLBACK, 0, "IN LOW\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, 0, "IN HIGH\nCURVE", menu_high_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_OUT, "OUT LOW\nCURVE", menu_output_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_IN, "IN LOW\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_HIGH_IN, "IN HIGH\nCURVE", menu_input_curve_prepare_cb},
{ MT_CALLBACK, CORRECTION_LOW_OUT, "OUT LOW\nCURVE", menu_output_curve_prepare_cb},
// { MT_CALLBACK, CORRECTION_HIGH_OUT,"OUT HIGH\nCURVE", menu_output_curve_prepare_cb},
#endif
#endif
@ -4765,13 +4870,15 @@ static const menuitem_t menu_measure[] = {
#ifdef TINYSA4
static const menuitem_t menu_calibrate_harmonic[] =
{
{ MT_FORM | MT_TITLE, 0, "Connect 5.34GHz at -50 to -10dBm", NULL},
{ MT_FORM | MT_TITLE, 1, "Connect %sHz at -50 to -10dBm", menu_calibrate_harmonic_acb}, // Titles can have advanced callback for title format
// { MT_FORM | MT_TITLE, 0, "Connect 5.34GHz at -50 to -10dBm", NULL},
#ifdef TINYSA4
{ MT_FORM | MT_CALLBACK, 3, "CALIBRATE", menu_calibrate_cb},
#endif
{ MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#if 0
static const menuitem_t menu_calibrate_harmonic_max[] =
{
{ MT_FORM | MT_TITLE, 0, "Connect 7.25GHz at -50 to -10dBm", NULL},
@ -4780,6 +4887,7 @@ static const menuitem_t menu_calibrate_harmonic_max[] =
#endif
{ MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#endif
static const menuitem_t menu_calibrate_normal[] =
{
@ -4792,12 +4900,12 @@ static const menuitem_t menu_calibrate_normal[] =
static const menuitem_t menu_calibrate[] =
{
{ MT_FORM | MT_SUBMENU, 1, "CALIBRATE 100kHz to 5.34GHz", menu_calibrate_normal},
{ MT_FORM | MT_SUBMENU, 1, "CALIBRATE above 5.34GHz", menu_calibrate_harmonic},
{ MT_FORM | MT_CALLBACK, 2, "RESET CALIBRATION", menu_calibrate_cb},
{ MT_FORM | MT_ADV_CALLBACK, 0, "CALIBRATE 100kHz to %sHz", menu_calibrate_normal_acb},
{ MT_FORM | MT_ADV_CALLBACK, 0, "CALIBRATE above %sHz", menu_calibrate_harmonic_acb},
{ MT_FORM | MT_CALLBACK, 2, "RESET CALIBRATION", menu_calibrate_cb},
{ MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#if 0
static const menuitem_t menu_calibrate_max[] =
{
{ MT_FORM | MT_SUBMENU, 1, "CALIBRATE 100kHz to 7.25GHz", menu_calibrate_normal},
@ -4805,6 +4913,7 @@ static const menuitem_t menu_calibrate_max[] =
{ MT_FORM | MT_CALLBACK, 2, "RESET CALIBRATION", menu_calibrate_cb},
{ MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#endif
#else
static const menuitem_t menu_calibrate[] =
@ -5266,10 +5375,7 @@ static void fetch_numeric_target(uint8_t mode)
break;
case KM_HARM_START:
uistat.freq_value = config.harmonic_start;
if (config.harmonic_start == 0)
plot_printf(uistat.text, sizeof uistat.text, "AUTO");
else
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value );
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz",(config.harmonic_start?config.harmonic_start:ULTRA_MAX_FREQ) );
break;
case KM_DIRECT_START:
uistat.freq_value = config.direct_start;
@ -5518,9 +5624,8 @@ set_numeric_value(void)
break;
case KM_HARM_START:
config.harmonic_start = uistat.freq_value;
reset_settings(setting.mode);
// config_save(); // TODO not now
//ultra_start = config.ultra_start;
config_save();
set_freq_boundaries();
break;
case KM_DIRECT_START:
config.direct_start = uistat.freq_value;
@ -6124,6 +6229,11 @@ redraw_cal_status:
buf[6] = 0;
ili9341_drawstring(buf, x, y);
#ifdef TINYSA4
y += YSTEP;
ili9341_drawstring(&(get_hw_version_text()[3]),x, y);
#endif
#ifdef __USE_RTC__
y += YSTEP + YSTEP/2 ;
uint32_t dr = rtc_get_dr_bin(); // DR read second
@ -6629,7 +6739,11 @@ draw_menu_buttons(const menuitem_t *menu, uint32_t mask)
menu_item_modify_attribute(menu, i, &button); // before plot_printf to create status text
char *text;
// MT_ADV_CALLBACK - allow change button data in callback, more easy and correct
if (MT_MASK(m->type) == MT_ADV_CALLBACK){
if (MT_MASK(m->type) == MT_ADV_CALLBACK
#ifdef TINYSA4
|| (MT_MASK(m->type) == MT_TITLE && m->reference != 0 ) // Only for tinySA4
#endif
){
menuaction_acb_t cb = (menuaction_acb_t)m->reference;
if (cb) (*cb)(i, (m->type & MT_REPEATS) ? (m->data & 0x0f)+sub_item : m->data, &button);
// Apply custom text, from button label and

Loading…
Cancel
Save

Powered by TurnKey Linux.