Updated correction tables

pull/94/head
erikkaashoek 2 years ago
parent 6c349b9155
commit 7dce74af15

@ -1090,6 +1090,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 */ { 30000000, 700000000, 980000000, 1440000000, 1590000000, 1900000000, 2810000000, 3340000000, 3390000000, 3930000000, 4230000000, 4300000000, 4340000000, 4810000000, 5070000000, 5110000000, 5300000000, 5510000000, 5850000000, 6000000000},
/* harm lna */ { 30000000, 700000000, 770000000, 990000000, 1230000000, 2390000000, 2800000000, 2810000000, 3150000000, 3210000000, 3810000000, 4060000000, 4180000000, 4230000000, 4300000000, 4400000000, 4490000000, 4960000000, 5070000000, 6000000000},
/* 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,6 +1105,8 @@ config_t config = {
/* 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 */ { 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, },
/* harm 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, },
/* 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, },
@ -1143,33 +1147,37 @@ config_t config = {
#ifdef TINYSA4
const freq_t v5_2_correction_frequency[CORRECTION_SIZE][CORRECTION_POINTS]=
{
/* low */ { 100000, 400000, 1000000, 80000000, 180000000, 260000000, 270000000, 300000000, 320000000, 390000000, 490000000, 660000000, 680000000, 690000000, 750000000, 790000000, 800000000, 810000000, 820000000, 830000000},
/* low lna */ { 100000, 300000, 2000000, 8000000, 20000000, 40000000, 70000000, 200000000, 230000000, 250000000, 260000000, 270000000, 300000000, 420000000, 540000000, 740000000, 790000000, 810000000, 820000000, 830000000},
/* ultra */ { 30000000, 700000000, 980000000, 1910000000, 2550000000, 2800000000, 2810000000, 3020000000, 3120000000, 3430000000, 3750000000, 4330000000, 4530000000, 5490000000, 5630000000, 5960000000, 6430000000, 6820000000, 7290000000, 7400000000},
/* ultra lna */ { 30000000, 700000000, 1130000000, 1840000000, 2490000000, 2800000000, 2810000000, 3120000000, 3500000000, 3890000000, 4410000000, 4610000000, 4940000000, 5450000000, 6110000000, 6550000000, 6610000000, 7150000000, 7280000000, 7400000000},
/* direct */ { 140000000, 150000000, 160000000, 180000000, 280000000, 300000000, 320000000, 380000000, 400000000, 420000000, 480000000, 510000000, 560000000, 823000000, 830000000, 850000000, 890000000, 950000000, 1090000000, 1120000000},
/* direct lna */ { 140000000, 150000000, 170000000, 180000000, 280000000, 290000000, 310000000, 370000000, 420000000, 440000000, 460000000, 560000000, 823000000, 830000000, 850000000, 890000000, 950000000, 1040000000, 1090000000, 1120000000, },
/* 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, },
/* ultra */ { 823000000, 1130000000, 1390000000, 1580000000, 1950000000, 2210000000, 2800000000, 2810000000, 2980000000, 3100000000, 3200000000, 3360000000, 3380000000, 3600000000, 3720000000, 3820000000, 3990000000, 4220000000, 5010000000, 5400000000, },
/* low */ { 10000, 100000, 300000, 600000, 2000000, 3000000, 30000000, 60000000, 80000000, 120000000, 230000000, 360000000, 520000000, 560000000, 640000000, 750000000, 800000000, 810000000, 820000000, 830000000},
/* low lna */ { 10000, 30000, 100000, 300000, 1000000, 5000000, 40000000, 70000000, 180000000, 210000000, 250000000, 270000000, 290000000, 480000000, 650000000, 740000000, 790000000, 810000000, 820000000, 830000000},
/* ultra */ { 30000000, 700000000, 980000000, 1910000000, 2550000000, 2800000000, 2810000000, 3020000000, 3120000000, 3430000000, 3750000000, 4230000000, 4480000000, 4810000000, 5430000000, 5640000000, 6390000000, 6660000000, 6980000000, 7250000000},
/* 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, },
/* 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, },
/* ultra */ { 10000, 100000, 500000, 3000000, 50000000, 800000000, 2300000000, 2800000000, 3300000000, 3620000000, 4200000000, 4470000000, 4480000000, 4570000000, 4780000000, 5330000000, 5700000000, 6000000000, 6390000000, 7300000000, },
};
const float v5_2_correction_value[CORRECTION_SIZE][CORRECTION_POINTS]=
{
/* low */ { 1.88, 0.25, 0.26, 0.1, -0.9, -0.73, -0.95, -0.79, -0.3, 0.07, -0.97, -1.02, -0.59, -0.07, 0.13, 2.04, 3.1, 4.02, 7.48, 13.7, },
/* low lna */ { 5.28, 0.85, -2.91, -3.09, -0.68, 1.58, 2.33, 2.93, 6.23, 8.61, 7.55, 5.9, 4.34, 4.55, 3.08, 4.7, 6.86, 9.37, 12.35, 18.82, },
/* ultra */ { -0.35, -0.8, -0.87, 0.35, 1.39, 1.07, 2.01, 3.06, 2.22, 3.65, 4.72, 5.45, 8.3, 9.03, 11.43, 11.5, 14.41, 20.05, 30.77, 31.52, },
/* ultra lna */ { -0.1, 3.86, 4.94, 5.06, 7.32, 6.16, 7.1, 6.96, 10.18, 10.23, 12.36, 12.35, 14.77, 13.75, 20.39, 18.23, 18.74, 33.83, 36.46, 37.46, },
/* direct */ { 3.39, 2.42, 0.95, -2.02, -10.09, -10.69, -12.27, -15.56, -16.81, -17.04, -20.22, -21.04, -23.22, -31.68, -31.68, -31.78, -31.52, -30.48, -27.36, -26.44, },
/* direct lna */ { 0.17, -1.96, -3.48, -4.46, -10.47, -12.51, -13.53, -17.12, -20.01, -20.52, -22.43, -26.13, -33.96, -34.05, -34.19, -34.12, -33.02, -30.6, -29.48, -28.66, },
/* 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, },
/* ultra */ { -3.49, -1.82, 0.74, 0.69, -2.16, -2.23, 0.81, 0.06, -0.1, 0.82, 0.65, 1.89, 1.64, 2.24, 1.32, 1.62, 0.76, 1.77, 7.57, 7.35, },
/* low */ { 4.24, 2.39, 1.18, 1.2, 0.33, 0.87, 0.4, 1.24, 0.64, 0.99, 0.04, 0.88, -0.64, -0.2, -0.36, 0.4, 3.45, 4.8, 8.04, 13.94, },
/* 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, },
/* 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 = 10;
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_lna_level_offset = 7;
#endif
@ -2954,7 +2962,7 @@ int main(void)
if (adc1_single_read(0)> 1000)
max2871 = true;
if (max2871) {
ULTRA_MAX_FREQ = 7250000000ULL + config.overclock; // Start of harmonic mode
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
@ -2976,7 +2984,7 @@ int main(void)
}
#ifdef TINYSA4
if (max2871) {
ULTRA_MAX_FREQ = 7250000000ULL + config.overclock; // Start of harmonic mode
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

@ -18,7 +18,7 @@
*/
#include "ch.h"
#ifdef TINYSA_F303
//#ifdef TINYSA_F303
#ifdef TINYSA_F072
#error "Remove comment for #ifdef TINYSA_F303"
#endif
@ -26,7 +26,7 @@
#define TINYSA4
#endif
#define TINYSA4_PROTO
#endif
//#endif
#ifdef TINYSA_F072
#ifdef TINYSA_F303
@ -230,11 +230,13 @@ typedef uint32_t freq_t;
#define CORRECTION_LNA_ULTRA 3
#define CORRECTION_DIRECT 4
#define CORRECTION_LNA_DIRECT 5
#define CORRECTION_LOW_OUT 6 // Must be same order as output path options!!!!!
#define CORRECTION_LOW_OUT_DIRECT 7
#define CORRECTION_LOW_OUT_ADF 8
#define CORRECTION_LOW_OUT_MIXER 9
#define CORRECTION_SIZE 10
#define CORRECTION_HARM 6
#define CORRECTION_LNA_HARM 7
#define CORRECTION_LOW_OUT 8 // Must be same order as output path options!!!!!
#define CORRECTION_LOW_OUT_DIRECT 9
#define CORRECTION_LOW_OUT_ADF 10
#define CORRECTION_LOW_OUT_MIXER 11
#define CORRECTION_SIZE 12
extern freq_t ULTRA_MAX_FREQ; // Start of harmonic mode
extern freq_t MAX_LO_FREQ;
@ -295,6 +297,7 @@ void resume_once(uint16_t c);
#ifdef TINYSA4
void set_deviation(int d);
void set_depth(int d);
extern int LO_harmonic;
#endif
void toggle_mute(void);
void toggle_pulse(void);
@ -513,6 +516,8 @@ void set_10mhz(freq_t);
#define HIGH_OUT_OFFSET config.high_level_output_offset
#endif
#ifdef __ULTRA__
extern bool debug_level;
extern void toggle_debug_level(void);
extern bool debug_spur;
extern void toggle_debug_spur(void);
#endif
@ -825,6 +830,7 @@ typedef struct config {
#endif
#ifdef __ULTRA__
freq_t ultra_start;
freq_t harmonic_start;
freq_t direct_start;
freq_t direct_stop;
freq_t overclock;
@ -1455,7 +1461,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e60 /* 'CONF' */
#define CONFIG_MAGIC 0x434f4e61 /* 'CONF' */
#define SETTING_MAGIC 0x434f4e64
extern int16_t lastsaveid;
@ -1818,8 +1824,8 @@ extern void SI4432_Listen(int s);
// si4432.c
enum {PATH_OFF, PATH_LOW, PATH_DIRECT, PATH_LEAKAGE, PATH_ULTRA, PATH_HIGH}; // must be same order as correction tables!!!!
#define PATH_TEXT {"OFF", "LOW", "DIRECT", "ADF", "ULTRA", "High"}
enum {PATH_OFF, PATH_LOW, PATH_DIRECT, PATH_LEAKAGE, PATH_ULTRA, PATH_HARM, PATH_HIGH}; // must be same order as correction tables!!!!
#define PATH_TEXT {"OFF", "LOW", "DIRECT", "ADF", "ULTRA", "HARM", "High"}
extern const char * const path_text[];
extern int signal_path;
extern int test_path;

@ -197,7 +197,7 @@ VNA_SHELL_FUNCTION(cmd_lna)
#ifdef __ULTRA__
VNA_SHELL_FUNCTION(cmd_ultra)
{
const char *ultra_cmd = "off|on|auto|start";
const char *ultra_cmd = "off|on|auto|start|harm";
if (argc<1 || argc>2)
goto usage;
if (argv[0][0] == '?')
@ -223,6 +223,13 @@ VNA_SHELL_FUNCTION(cmd_ultra)
ultra_start = a;
dirty = true;
break;
case 4:
if (argc != 2)
goto usage;
a = my_atoui(argv[1]);
config.harmonic_start = a;
dirty = true;
break;
default:
{
usage:
@ -1173,7 +1180,7 @@ VNA_SHELL_FUNCTION(cmd_correction)
{
(void)argc;
#ifdef TINYSA4
static const char cmd[] = "low|lna|ultra|ultra_lna|direct|direct_lna|out|out_direct|out_adf|out_ultra|off|on";
static const char cmd[] = "low|lna|ultra|ultra_lna|direct|direct_lna|harm|harm_lna|out|out_direct|out_adf|out_ultra|off|on";
static const char range[] = "0-19";
#else
static const char cmd[] = "low|high|out";

@ -60,6 +60,7 @@ bool debug_avoid_second = false;
bool progress_bar = true;
#ifdef __ULTRA__
bool debug_spur = false;
bool debug_level = false;
#endif
int current_index = -1;
@ -80,7 +81,7 @@ uint16_t current_band = 0;
#ifdef __ULTRA__
freq_t ultra_start;
//bool ultra;
static int LO_harmonic;
int LO_harmonic;
#endif
#ifdef TINYSA4
bool direct_test;
@ -126,7 +127,7 @@ int actual_drive = -1;
const float si_drive_dBm [] = {-44.1, -30, -21.6, -17, -14, -11.7, -9.9, -8.4, -7.1, -6, -5, -4.2, -3.4, -2.7 , -2.1, -1.5, -1, -0.47, 0};
//const float adf_drive_dBm[] = {-13,-7.5,-4.2, 0};
//const float adf_drive_dBm[] = {-9, -4, 0, 0};
const float adf_drive_dBm[] = {0, 5, 0, 0}; // Only use drive 0 and 1
const float adf_drive_dBm[] = {0, 0, 0, 0}; // Only use drive 0
const uint8_t drive_register[] = {0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
float *drive_dBm = (float *) si_drive_dBm;
const int min_drive = 0;
@ -169,9 +170,11 @@ const char *const path_text[]=PATH_TEXT;
void set_output_drive(int d)
{
if (signal_path == PATH_LEAKAGE)
if (signal_path == PATH_LEAKAGE) {
if (max2871 && d == 0)
d = 3;
ADF4351_drive(d);
else {
} else {
#ifdef __SI4432__
SI4432_Sel = SI4432_RX ;
SI4432_Drive(d);
@ -204,6 +207,7 @@ void set_output_step_atten(int s)
void set_output_path(freq_t f, float level)
{
LO_harmonic = false;
if (depth_error) { depth_error = false; redraw_request |= REDRAW_CAL_STATUS; draw_all(true);}
if (force_signal_path) {
signal_path = test_path;
@ -212,6 +216,11 @@ void set_output_path(freq_t f, float level)
setting.atten_step = test_output_switch;
set_output_drive(test_output_drive);
PE4302_Write_Byte(test_output_attenuate);
if (debug_level && SDU1.config->usbp->state == USB_ACTIVE) {
shell_printf ("d=%d, a=%d, s=%d\r\n",test_output_drive, test_output_attenuate, (setting.atten_step ? 1 : 0));
osalThreadSleepMilliseconds(100);
}
goto set_path;
}
} else if (MODE_HIGH(setting.mode))
@ -249,7 +258,7 @@ void set_output_path(freq_t f, float level)
return; //TODO setup high path
}
float ATTENUATION_RESERVE = 3.0;
float ATTENUATION_RESERVE = 0.0;
if (signal_path == PATH_LEAKAGE) {
ATTENUATION_RESERVE = 0;
}
@ -321,10 +330,8 @@ void set_output_path(freq_t f, float level)
a = -a - 0.25; // Rounding
setting.attenuate_x2 = (int)(a * 2);
PE4302_Write_Byte(setting.attenuate_x2);
#if 0
if (SDU1.config->usbp->state == USB_ACTIVE)
shell_printf ("level=%f, drive=%d, atten=%f, switch=%d\r\n", level, d, a, (setting.atten_step ? 1 : 0));
#endif
if (debug_level && SDU1.config->usbp->state == USB_ACTIVE)
shell_printf ("level=%.2f, d=%d, a=%d, s=%d, f=%.2f\r\n", level, d, setting.attenuate_x2, (setting.atten_step ? 1 : 0), PURE_TO_float(get_frequency_correction(f)));
enable_extra_lna(false);
if (setting.mute)
@ -384,12 +391,14 @@ void set_output_path(freq_t f, float level)
static void calculate_static_correction(void);
void set_input_path(freq_t f)
{
LO_harmonic = false;
if (force_signal_path) {
setting.extra_lna = test_path & 0x01;
switch ((test_path & 0xFE)>>1) {
case 0: signal_path = PATH_LOW; break;
case 1: signal_path = PATH_ULTRA; break;
case 2: signal_path = PATH_DIRECT; break;
case 3: signal_path = PATH_ULTRA; LO_harmonic = true; break;
}
}
else if (MODE_HIGH(setting.mode))
@ -398,9 +407,10 @@ void set_input_path(freq_t f)
signal_path = PATH_DIRECT;
else if (config.direct && f >= config.direct_start && f < config.direct_stop)
signal_path = PATH_DIRECT;
else if(config.ultra && ((config.ultra_start == ULTRA_AUTO && f > ultra_start) || (config.ultra_start != ULTRA_AUTO && f >config.ultra_start)))
else if(config.ultra && ((config.ultra_start == ULTRA_AUTO && f > ultra_start) || (config.ultra_start != ULTRA_AUTO && f >config.ultra_start))) {
LO_harmonic = (f > (config.harmonic_start?config.harmonic_start:ULTRA_MAX_FREQ));
signal_path = PATH_ULTRA;
else
} else
signal_path = PATH_LOW;
if (signal_path == PATH_HIGH) {
@ -509,10 +519,17 @@ void update_min_max_freq(void)
minFreq = 0;
#ifdef TINYSA4
#ifdef __ULTRA_OUT__
if (setting.mixer_output)
if (setting.mixer_output) {
if (setting.harmonic)
maxFreq = setting.harmonic * MAX_LO_FREQ - DEFAULT_IF; // ULTRA_MAX_FREQ; // make use of harmonic mode above ULTRA_MAX_FREQ
else
maxFreq = ULTRA_MAX_FREQ+60000000; // Add 60MHz to go to 5.40GHz
} else {
if (setting.harmonic)
maxFreq = setting.harmonic * (MAX_LO_FREQ+config.overclock); // ULTRA_MAX_FREQ; // make use of harmonic mode above ULTRA_MAX_FREQ
else
maxFreq = MAX_LO_FREQ+config.overclock; // 4.4GHz
}
#else
maxFreq = MAX_LOW_OUTPUT_FREQ;
#endif
@ -725,6 +742,9 @@ void reset_settings(int m)
case M_GENLOW:
#ifdef TINYSA4
setting.rx_drive= MAX_DRIVE;
if (max2871)
setting.lo_drive= 2;
else
setting.lo_drive= 1;
#else
// setting.rx_drive=8;
@ -1015,6 +1035,13 @@ void toggle_debug_spur(void)
#endif
#ifdef TINYSA4
void toggle_debug_level(void)
{
debug_level = !debug_level;
dirty = true;
}
#ifndef __NEW_SWITCHES__
void toggle_high_out_adf4350(void)
{
@ -1232,8 +1259,8 @@ float low_out_offset(void)
{
if (config.output_is_calibrated)
return config.low_level_output_offset;
if (config.input_is_calibrated)
return - config.low_level_offset;
// if (config.input_is_calibrated)
// return - config.low_level_offset;
return 0;
}
#endif
@ -2237,6 +2264,7 @@ pureRSSI_t get_frequency_correction(freq_t f) // Frequency dependent RSSI c
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);
@ -3772,7 +3800,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
set_switch_transmit();
PE4302_Write_Byte(setting.attenuate_x2);
#if 0
if (SDU1.config->usbp->state == USB_ACTIVE)
if (debug_level && SDU1.config->usbp->state == USB_ACTIVE)
shell_printf ("level=%f, d=%d, a=%d, s=%d\r\n", setting.level, d, setting.attenuate_x2, (setting.atten_step ? 1 : 0));
#endif
}
@ -3997,7 +4025,7 @@ again: // Spur redu
LO_shifting = false;
#endif
#ifdef __ULTRA__
LO_harmonic = false;
// LO_harmonic = false;
#endif
if (MODE_LOW(setting.mode)){ // All low mode
if (!setting.auto_IF)
@ -4224,14 +4252,14 @@ again: // Spur redu
#endif
#endif
#ifdef __ULTRA__
if (setting.harmonic && lf > ULTRA_MAX_FREQ) {
if (LO_harmonic) {
target_f /= setting.harmonic;
#ifdef TINYSA3
if (target_f > MAX_LO_FREQ) {
target_f = (lf - local_IF) / setting.harmonic;
}
#endif
LO_harmonic = true;
// LO_harmonic = true;
}
#endif
set_freq (SI4432_LO, target_f); // otherwise to above IF
@ -4383,9 +4411,8 @@ again: // Spur redu
}
#endif // __ADF4351__
TRACE(2.5);
if (setting.harmonic && lf > ( setting.mode == M_GENLOW ? ULTRA_MAX_FREQ + 60000000:ULTRA_MAX_FREQ) ) {
if (LO_harmonic) {
target_f /= setting.harmonic;
LO_harmonic = true;
}
// ----------------------------- set mixer drive --------------------------------------------
if (setting.mode == M_LOW || setting.mode == M_GENLOW) {
@ -4456,8 +4483,12 @@ again: // Spur redu
set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode
if (setting.tracking_output)
set_freq (ADF4351_LO, lf);
} else
} else {
freq_t target_f = lf;
if (setting.harmonic && lf > 6300000000ULL)
target_f /= setting.harmonic;
set_freq (ADF4351_LO, lf); // sweep LO, local_IF = 0 in high mode
}
local_IF = 0;
} else if (setting.mode == M_GENHIGH) {
local_IF = 0;

36
ui.c

@ -1364,6 +1364,7 @@ enum {
KM_ATTACK,
#ifdef __ULTRA__
KM_ULTRA_START,
KM_HARM_START,
#endif
#ifdef TINYSA4
KM_EXP_AVER,
@ -1448,6 +1449,7 @@ static const struct {
[KM_ATTACK] = {keypads_positive , "ATTACK"}, // KM_ATTACK
#ifdef __ULTRA__
[KM_ULTRA_START] = {keypads_freq , "ULTRA\nSTART"}, // KM_ULTRA_START
[KM_HARM_START] = {keypads_freq , "HARM\nSTART"}, // KM_HARM_START
#endif
#ifdef TINYSA4
[KM_EXP_AVER] = {keypads_positive , "EXPONENTIAL\nAVERAGING"}, //KM_EXP_AVER
@ -1682,6 +1684,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_curve_acb)
reset_settings(old_m);
}
break;
case CORRECTION_LNA_HARM:
case CORRECTION_LNA:
case CORRECTION_LNA_ULTRA:
reset_settings(M_LOW);
@ -1720,6 +1723,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_curve_acb)
#endif
#ifdef TINYSA4
case CORRECTION_HARM:
case CORRECTION_LOW_ULTRA:
goto common;
#else
@ -2475,6 +2479,19 @@ static UI_FUNCTION_ADV_CALLBACK(menu_debug_spur_acb)
// menu_move_back();
ui_mode_normal();
}
static UI_FUNCTION_ADV_CALLBACK(menu_debug_level_acb)
{
(void)data;
(void)item;
if (b){
b->icon = debug_level == 0 ? BUTTON_ICON_NOCHECK : BUTTON_ICON_CHECK;
return;
}
toggle_debug_level();
// menu_move_back();
ui_mode_normal();
}
#endif
#ifdef TINYSA4
@ -4595,6 +4612,7 @@ static const menuitem_t menu_settings4[] =
{ MT_ADV_CALLBACK, 0, "DEBUG\nFREQ", menu_debug_freq_acb},
{ MT_ADV_CALLBACK, 0, "DEBUG\nAVOID", menu_debug_avoid_acb},
{ MT_ADV_CALLBACK, 0, "DEBUG\nSPUR", menu_debug_spur_acb},
{ MT_ADV_CALLBACK, 0, "DEBUG\nLEVEL", menu_debug_level_acb},
{ MT_ADV_CALLBACK, 0, "HIDE\n21MHz", menu_hide_21MHz_acb},
{ MT_KEYPAD, KM_OVERCLOCK, "OVERCLOCK\n\b%s", "Enter overclock amount"},
@ -4618,6 +4636,7 @@ static const menuitem_t menu_settings3[] =
{ MT_ADV_CALLBACK, 0, "ADF OUT", menu_adf_out_acb},
#endif
{ MT_KEYPAD, KM_ULTRA_START,"ULTRASTART\n\b%s", "10G=auto"},
{ MT_KEYPAD, KM_HARM_START,"HARM START\n\b%s", "0=auto"},
// { MT_KEYPAD | MT_LOW, KM_IF2, "IF2 FREQ", "Set to zero for no IF2"},
{ MT_KEYPAD, KM_R, "R\n\b%s", "Set R"},
{ MT_KEYPAD, KM_MOD, "MODULO\n\b%s", "Set MODULO"},
@ -5245,6 +5264,13 @@ static void fetch_numeric_target(uint8_t mode)
else
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value );
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 );
break;
case KM_DIRECT_START:
uistat.freq_value = config.direct_start;
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value);
@ -5487,6 +5513,12 @@ set_numeric_value(void)
case KM_ULTRA_START:
config.ultra_start = uistat.freq_value;
reset_settings(setting.mode);
// config_save(); // TODO not now
//ultra_start = config.ultra_start;
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;
break;
@ -5988,7 +6020,7 @@ redraw_cal_status:
if (force_signal_path){
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
lcd_printf(x, y, "Path:\n%s", path_text[signal_path]);
lcd_printf(x, y, "Path:\n%s", path_text[signal_path+(LO_harmonic?1:0)]);
y += 2*YSTEP + YSTEP/2;
}
@ -6062,6 +6094,8 @@ redraw_cal_status:
buf[4] = 's';
else if (S_STATE(setting.spur_removal))
buf[4] = 'S';
if (LO_harmonic)
buf[5] = 'H';
#endif
ili9341_drawstring(buf, x, y);

Loading…
Cancel
Save

Powered by TurnKey Linux.