diff --git a/main.c b/main.c index f324e41..86bec44 100644 --- a/main.c +++ b/main.c @@ -1018,15 +1018,15 @@ config_t config = { .high_level_output_offset = 0.0, // Uncalibrated .correction_frequency = { - { 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000 }, - { 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000 }, - { 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000 }, + { 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 750000010, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 }, + { 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 750000010, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 }, + { 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 750000010, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 }, }, .correction_value = { - { 10.5, +4.9, +1.6, +0.6, 0, 0, +4, +2.5, +2, +2, +2, +3.5, +6.5, +6.5, +9, +9, +9, +11, +11, +11, }, - { 10.5, +4.9, +1.6, +0.6, 0, 0, +4, +2.5, +2, +2, +2, +6, +9, +11.5, +14.5, +23, +25, +36, +46, +46, }, - { 10.5, +4.9, +1.6, +0.6, 0, 0, +4, +2.5, +2, +2, +2, +3.5, +6.5, +6.5, +9, +9, +9, +11, +11, +11, }, + { 10.5, +4.9, +1.6, +0.6, 0, 0, +2, +0, +2, +2, +2, +2, +3.5, +6.5, +6.5, +9, +9, +9, +11, +11,}, + { 10.5, +4.9, +1.6, +0.6, 0, 0, +2, +0, +2, +2, +2, +2, +6, +9, +11.5, +14.5, +23, +25, +36, +46,}, + { 10.5, +4.9, +1.6, +0.6, 0, 0, +2, +0, +2, +2, +2, +2, +3.5, +6.5, +6.5, +9, +9, +9, +11, +11,}, }, .setting_frequency_30mhz = 30000000, .cor_am = 0, diff --git a/sa_core.c b/sa_core.c index 60b9cd3..d494b25 100644 --- a/sa_core.c +++ b/sa_core.c @@ -95,7 +95,7 @@ const int8_t drive_dBm [16] = {-38, -32, -30, -27, -24, -19, -15, -12, -5, -2, 0 #define SL_GENHIGH_LEVEL_MIN (drive_dBm[MIN_DRIVE] - (config.high_out_adf4350 ? 0: 37 - config.switch_offset)) #define SL_GENHIGH_LEVEL_MAX drive_dBm[MAX_DRIVE] -#define SL_GENLOW_LEVEL_MIN -104 +#define SL_GENLOW_LEVEL_MIN -124 #define SL_GENLOW_LEVEL_MAX -16 @@ -2551,6 +2551,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / float a = ((int)((setting.level + ((float)i / sweep_points) * ls)*2.0)) / 2.0; a += PURE_TO_float(get_frequency_correction(f)); if (a != old_a) { + int very_low_flag = false; old_a = a; a = a - level_max; // convert to all settings maximum power output equals a = zero if (a < -SWITCH_ATTENUATION) { @@ -2560,6 +2561,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / set_switch_receive(); #else enable_rx_output(false); + very_low_flag = true; #endif } else { #ifdef TINYSA3 @@ -2567,11 +2569,16 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / set_switch_transmit(); #else enable_rx_output(true); + #endif } - +#ifdef TINYSA4 +#define LOWEST_LEVEL (very_low_flag ? 0 : MIN_DRIVE) +#else +#define LOWEST_LEVEL MIN_DRIVE +#endif int d = MAX_DRIVE; // Reduce level till it fits in attenuator range - while (a - BELOW_MAX_DRIVE(d) < - 31 && d > MIN_DRIVE) { + while (a - BELOW_MAX_DRIVE(d) < - 31 && d > LOWEST_LEVEL) { d--; } a -= BELOW_MAX_DRIVE(d);