From 8b8749eb525c6c8c818605b9ab4527712433eae3 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Thu, 18 Aug 2022 08:46:29 +0200 Subject: [PATCH] Updated output correction tables --- main.c | 17 ++++++++--------- nanovna.h | 2 +- sa_core.c | 11 +++++++++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index 5b6e640..a9ee24e 100644 --- a/main.c +++ b/main.c @@ -1008,10 +1008,10 @@ config_t config = { /* ultra lna */ { 30000000, 700000000, 1720000000, 2270000000, 2530000000, 2800000000, 2810000000, 3160000000, 3420000000, 3780000000, 4260000000, 4340000000, 4450000000, 4540000000, 4940000000, 5150000000, 5280000000, 5380000000, 5640000000, 6000000000}, /* direct */ { 140000000, 150000000, 160000000, 180000000, 280000000, 380000000, 390000000, 410000000, 490000000, 560000000, 830000000, 840000000, 890000000, 900000000, 920000000, 940000000, 980000000, 1020000000, 1070000000, 1130000000}, /* direct lna */ { 140000000, 160000000, 180000000, 280000000, 300000000, 380000000, 390000000, 450000000, 490000000, 560000000, 830000000, 880000000, 920000000, 930000000, 950000000, 1010000000, 1040000000, 1070000000, 1120000000, 1130000000}, -/* out */ {10000, 30000, 70000, 100000, 300000, 500000, 800000, 2000000, 5000000, 8000000, 30000000, 90000000, 140000000, 370000000, 630000000, 750000000, 790000000, 810000000, 820000000, 830000000}, -/* direct */ { 500000000, 823000000, 830000000, 840000000, 850000000, 860000000, 910000000, 920000000, 930000000, 970000000, 990000000, 1030000000, 1040000000, 1070000000, 1080000000, 1090000000, 1100000000, 1110000000, 1120000000, 1130000000}, -/* adf */ { 500000000, 700000000, 820000000, 840000000, 950000000, 1000000000, 1040000000, 1070000000, 1320000000, 1570000000, 1750000000, 2220000000, 2800000000, 2810000000, 3000000000, 3250000000, 3440000000, 3800000000, 4060000000, 4350000000}, -/* ultra */ { 500000000, 700000000, 1100000000, 1500000000, 1670000000, 2050000000, 2300000000, 2800000000, 2810000000, 3020000000, 3250000000, 3360000000, 3370000000, 3640000000, 3730000000, 4030000000, 4330000000, 4830000000, 5200000000, 5350000000 }, + /* out */ { 10000, 20000, 50000, 100000, 200000, 500000, 2000000, 8000000, 30000000, 150000000, 390000000, 470000000, 640000000, 740000000, 770000000, 800000000, 810000000, 820000000, 823000000, 830000000, }, + /* direct */ { 500000000, 823000000, 830000000, 840000000, 890000000, 920000000, 930000000, 940000000, 950000000, 970000000, 990000000, 1000000000, 1020000000, 1030000000, 1040000000, 1050000000, 1060000000, 1080000000, 1110000000, 1130000000, }, + /* adf */ { 500000000, 700000000, 823000000, 980000000, 1050000000, 1300000000, 1550000000, 1850000000, 2030000000, 2800000000, 2810000000, 2970000000, 3100000000, 3210000000, 3470000000, 3780000000, 3910000000, 4060000000, 4190000000, 4400000000, }, + /* ultra */ { 10000, 20000, 70000, 200000, 500000, 3000000, 140000000, 480000000, 910000000, 1210000000, 1580000000, 2000000000, 2480000000, 2800000000, 2810000000, 3710000000, 4230000000, 4940000000, 5200000000, 5400000000, }, }, .correction_value = { @@ -1021,11 +1021,10 @@ config_t config = { /* ultra lna */ { 0, 0.74, 1.93, 1.81, 2.64, 1.55, 2.45, 5.1, 7.78, 9.46, 13.98, 15.34, 18.41, 19.96, 23.21, 21.82, 22.09, 24.23, 25.42, 26.02}, /* direct */ { 4.98, 3.43, 2.6, 0, -8.46, -14.19, -13.67, -15.69, -18.7, -21.64, -30.68, -30.3, -30.13, -29.18, -29.46, -28.56, -27.77, -26.79, -25.11, -24.06}, /* direct lna */ { 4.98, 3, 0, -9.4, -11, -15.63, -16.11, -18.7, -20.79, -23.52, -31.62, -31.58, -31.03, -30.36, -30.43, -28.56, -27.31, -27.05, -25.41, -25.41}, -/* out */ { 8.5, 6.04, 3.55, 2.42, -0.04, -1.06, -1.46, -2.16, -2.71, -2.56, -3.08, -3.47, -3.15, -1.03, -1.75, -0.21, 1.53, 3.81, 5.69, 9.4}, -/* direct */ { -6.71, -2.48, -2.46, -2.2, -2.24, -1.96, -1.37, -1.41, -1.14, -0.55, -0.5, 0.11, 0.06, 0.69, 0.64, 0.71, 0.96, 0.93, 1.35, 1.52}, -/* adf */ { -1, -5.25, -8.11, -8.35, -8.1, -8.91, -10.3, -10.05, -5.19, -2.69, -2.31, -2.68, -1.31, -2.36, -2.93, -1.94, -0.37, 4.33, 7.17, 9.02}, -/* ultra */ { -1.92, -2.05, -1.15, 1.16, 0.99, -0.34, 0.29, 3.33, 2.26, 3.08, 4.99, 6.75, 4.87, 6.12, 6.1, 5.3, 5.21, 8.3, 9.25, 10.85 }, - + /* out */ { 8.21, 5.86, 3.02, 0.76, -1.17, -2.75, -3.77, -4.3, -4.58, -4.66, -2.6, -3.27, -3.38, -2.34, -1.47, 0.51, 1.48, 2.83, 3.41, 5.57, }, + /* direct */ { -8.86, -4.93, -4.84, -4.74, -4.2, -3.88, -3.78, -3.63, -3.51, -3.23, -2.95, -2.77, -2.56, -2.46, -2.33, -2.21, -2.08, -1.74, -1.48, -1.22, }, + /* adf */ { -1.88, -4.15, -6.6, -6.7, -7.92, -4.23, -1.31, -0.36, -0.79, 0.19, -0.95, -1.8, -0.71, -0.97, 0.98, 5.56, 7.16, 7.49, 6.83, 6.68, }, + /* ultra */ { 7.83, 5.55, 1.5, -1.54, -2.96, -4.15, -4.87, -3.68, -3.78, -2.51, -0.46, -2.17, -0.7, 1.5, 0.51, 2.84, 1.87, 7.65, 6.73, 7.13, }, }, .setting_frequency_30mhz = 30000000ULL * FREQ_MULTIPLIER, .cor_am = 0, diff --git a/nanovna.h b/nanovna.h index bc4ef92..5c8d1d2 100644 --- a/nanovna.h +++ b/nanovna.h @@ -1345,7 +1345,7 @@ typedef struct properties { //sizeof(properties_t) == 0x1200 -#define CONFIG_MAGIC 0x434f4e57 /* 'CONF' */ +#define CONFIG_MAGIC 0x434f4e59 /* 'CONF' */ extern int16_t lastsaveid; //extern properties_t *active_props; diff --git a/sa_core.c b/sa_core.c index 50ecf26..da15e76 100644 --- a/sa_core.c +++ b/sa_core.c @@ -138,7 +138,7 @@ int max_drive = 18; #define SL_GENHIGH_LEVEL_MAX drive_dBm[MAX_DRIVE] #define SL_GENLOW_LEVEL_MIN -124 -#define SL_GENLOW_LEVEL_MAX -16 +#define SL_GENLOW_LEVEL_MAX -18.5 #ifdef TINYSA4_4 #define MAX_ATTENUATE (setting.extra_lna ? 0 : 31.5) #else @@ -7427,11 +7427,13 @@ void calibrate(void) set_sweep_frequency(ST_CENTER, DRIRECT_CAL_FREQ); test_path = 4; // Direct path at 900MHz force_signal_path = true; + config.direct_level_offset -= 1.0; break; case CS_DIRECT_LNA: set_sweep_frequency(ST_CENTER, DRIRECT_CAL_FREQ); test_path = 5; // Direct lna path at 900MHz force_signal_path = true; + config.direct_lna_level_offset += 1.0; break; #endif } @@ -7496,8 +7498,13 @@ void calibrate(void) #ifdef TINYSA4 if (calibration_stage == CS_DIRECT_REF) direct_level = marker_to_value(0); - else if (calibration_stage == CS_DIRECT || calibration_stage == CS_DIRECT_LNA) + else if (calibration_stage == CS_DIRECT){ + config.direct_level_offset += 1.0; offset = set_actual_power(direct_level); + } else if (calibration_stage == CS_DIRECT_LNA){ + config.direct_lna_level_offset -= 1.0; + offset = set_actual_power(direct_level); + } else #endif offset = set_actual_power(CAL_LEVEL); // Should be -23.5dBm (V0.2) OR 25 (V0.3)