Direct added

Speed-test
erikkaashoek 4 years ago
parent 634b0ff68b
commit 49c13d298d

@ -1112,6 +1112,7 @@ typedef struct setting
bool extra_lna; bool extra_lna;
int R; // KM_R int R; // KM_R
int32_t exp_aver; int32_t exp_aver;
bool increased_R;
#endif #endif
int64_t test_argument; // used for tests int64_t test_argument; // used for tests
uint32_t checksum; // must be last and at 4 byte boundary uint32_t checksum; // must be last and at 4 byte boundary

@ -231,6 +231,7 @@ void reset_settings(int m)
#ifdef TINYSA4 #ifdef TINYSA4
drive_dBm = (float *) (setting.mode == M_GENHIGH && config.high_out_adf4350 ? adf_drive_dBm : si_drive_dBm); drive_dBm = (float *) (setting.mode == M_GENHIGH && config.high_out_adf4350 ? adf_drive_dBm : si_drive_dBm);
setting.exp_aver = 1; setting.exp_aver = 1;
setting.increased_R = false;
#endif #endif
update_min_max_freq(); update_min_max_freq();
setting.frequency_var = 0; setting.frequency_var = 0;
@ -1636,7 +1637,7 @@ void calculate_step_delay(void)
noise_level = step_delay_table[i].noise_level - PURE_TO_float(get_signal_path_loss()); noise_level = step_delay_table[i].noise_level - PURE_TO_float(get_signal_path_loss());
log_averaging_correction = step_delay_table[i].log_aver_correction; log_averaging_correction = step_delay_table[i].log_aver_correction;
#endif #endif
if (setting.step_delay_mode == SD_PRECISE) // In precise mode wait twice as long for RSSI to stabilize if (setting.step_delay_mode == SD_PRECISE || setting.increased_R) // In precise mode wait twice as long for RSSI to stabilize
SI4432_step_delay += (SI4432_step_delay>>2) ; SI4432_step_delay += (SI4432_step_delay>>2) ;
if (setting.fast_speedup >0) if (setting.fast_speedup >0)
SI4432_offset_delay = SI4432_step_delay / setting.fast_speedup; SI4432_offset_delay = SI4432_step_delay / setting.fast_speedup;
@ -2016,7 +2017,10 @@ case M_LOW: // Mixed into 0
} else { } else {
enable_rx_output(false); enable_rx_output(false);
} }
#endif #ifdef __NEW_SWITCHES__
enable_direct(false);
#endif
#endif
set_AGC_LNA(); set_AGC_LNA();
#ifdef TINYSA4 #ifdef TINYSA4
ADF4351_enable(true); ADF4351_enable(true);
@ -2073,6 +2077,9 @@ mute:
enable_rx_output(false); enable_rx_output(false);
} }
enable_high(true); enable_high(true);
#ifdef __NEW_SWITCHES__
enable_direct(false);
#endif
enable_extra_lna(false); enable_extra_lna(false);
#endif #endif
#ifdef __ULTRA__ #ifdef __ULTRA__
@ -2116,6 +2123,9 @@ case M_GENLOW: // Mixed output from 0
} }
SI4463_set_output_level(setting.rx_drive); SI4463_set_output_level(setting.rx_drive);
enable_high(false); enable_high(false);
#ifdef __NEW_SWITCHES__
enable_direct(false);
#endif
enable_extra_lna(false); enable_extra_lna(false);
#endif #endif
#ifdef __ULTRA__ #ifdef __ULTRA__
@ -2827,6 +2837,10 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
is_below = false; is_below = false;
#endif #endif
correct_RSSI_freq = get_frequency_correction(f); // for i == 0 and freq_step == 0; correct_RSSI_freq = get_frequency_correction(f); // for i == 0 and freq_step == 0;
#ifdef TINYSA4
correct_RSSI_freq += float_TO_PURE_RSSI(direct ? -6.0 : 0); // TODO add impact of direct
#endif
} else { } else {
#ifdef __MCU_CLOCK_SHIFT__ #ifdef __MCU_CLOCK_SHIFT__
clock_at_48MHz(); clock_at_48MHz();
@ -2921,7 +2935,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
else else
ls -= 0.5; ls -= 0.5;
float a = ((int)((setting.level + ((float)i / sweep_points) * ls)*2.0)) / 2.0 /* + get_level_offset() */ ; float a = ((int)((setting.level + ((float)i / sweep_points) * ls)*2.0)) / 2.0 /* + get_level_offset() */ ;
correct_RSSI_freq = get_frequency_correction(f); correct_RSSI_freq = get_frequency_correction(f); // No direct in output
a += PURE_TO_float(correct_RSSI_freq); a += PURE_TO_float(correct_RSSI_freq);
#ifdef TINYSA4 #ifdef TINYSA4
{ {
@ -3084,8 +3098,12 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
#endif #endif
// Calculate the RSSI correction for later use // Calculate the RSSI correction for later use
if (MODE_INPUT(setting.mode)){ // only cases where the value can change on 0 point of sweep if (MODE_INPUT(setting.mode)){ // only cases where the value can change on 0 point of sweep
if (setting.frequency_step != 0) if (setting.frequency_step != 0) {
correct_RSSI_freq = get_frequency_correction(f); correct_RSSI_freq = get_frequency_correction(f);
#ifdef TINYSA4
correct_RSSI_freq += float_TO_PURE_RSSI(direct ? -6.0 : 0); // TODO add impact of direct
#endif
}
} }
// #define DEBUG_CORRECTION // #define DEBUG_CORRECTION
#ifdef DEBUG_CORRECTION #ifdef DEBUG_CORRECTION
@ -3168,20 +3186,23 @@ modulation_again:
enable_ultra(true); enable_ultra(true);
enable_direct(true); enable_direct(true);
enable_high(true); enable_high(true);
} else ADF4351_enable_out(false);
} else {
#endif #endif
ADF4351_enable_out(true);
if (ultra && f > ultra_threshold) { if (ultra && f > ultra_threshold) {
enable_ultra(true); enable_ultra(true);
#ifdef __NEW_SWITCHES__ #ifdef __NEW_SWITCHES__
enable_direct(false); enable_direct(false);
enable_high(false); enable_high(false);
#endif #endif
} else { } else {
enable_ultra(false); enable_ultra(false);
#ifdef __NEW_SWITCHES__ #ifdef __NEW_SWITCHES__
enable_high(false); enable_high(false);
enable_direct(false); enable_direct(false);
#endif #endif
}
} }
} }
#endif #endif
@ -3481,27 +3502,32 @@ again: // Spur redu
#define TXCO_DIV3 10000000 #define TXCO_DIV3 10000000
if (setting.R == 0) { if (setting.R == 0) {
setting.increased_R = false;
if (setting.mode == M_GENLOW) { if (setting.mode == M_GENLOW) {
if (local_modulo == 0) ADF4351_modulo(1000); if (local_modulo == 0) ADF4351_modulo(1000);
ADF4351_R_counter(3); ADF4351_R_counter(3);
} else } else if ( ( (lf > 8000000 && lf < 700000000) || (lf > 500000000 && lf < 520000000) ) /* && lf >= TXCO_DIV3 */ && MODE_INPUT(setting.mode)) {
if (lf > 8000000 && lf < 1000000000 /* && lf >= TXCO_DIV3 */ && MODE_INPUT(setting.mode)) { #if 0
if (local_modulo == 0) { if (local_modulo == 0) {
if (actual_rbw_x10 >= 3000) if (actual_rbw_x10 >= 3000)
ADF4351_modulo(1000); ADF4351_modulo(1000);
else else
ADF4351_modulo(60); ADF4351_modulo(60);
} }
#endif
freq_t tf = ((lf + actual_rbw_x10*1000) / TCXO) * TCXO; freq_t tf = ((lf + actual_rbw_x10*1000) / TCXO) * TCXO;
if (tf + actual_rbw_x10*100 >= lf && tf < lf + actual_rbw_x10*100) { // 30MHz if (tf + actual_rbw_x10*200 >= lf && tf < lf + actual_rbw_x10*200 && tf != 180000000) { // 30MHz
ADF4351_R_counter(6); setting.increased_R = true;
ADF4351_R_counter(3);
} else { } else {
#if 0 #if 0
if (actual_rbw_x10 < 1000) { if (actual_rbw_x10 < 1000) {
freq_t tf = ((lf + actual_rbw_x10*1000) / TXCO_DIV3) * TXCO_DIV3; 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 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 else
setting.increased_R = true;
ADF4351_R_counter(3); ADF4351_R_counter(3);
} else } else
#endif #endif
@ -3514,13 +3540,15 @@ again: // Spur redu
else else
ADF4351_modulo(60); ADF4351_modulo(60);
} }
if (setting.frequency_step < 100000) #if 0
if (setting.frequency_step < 100000) {
setting.increased_R = true;
ADF4351_R_counter(3); ADF4351_R_counter(3);
else } else
#endif
ADF4351_R_counter(1); // Used to be 1 ADF4351_R_counter(1); // Used to be 1
} }
} } else {
else {
ADF4351_R_counter(setting.R); ADF4351_R_counter(setting.R);
} }
#endif // __ADF4351__ #endif // __ADF4351__
@ -4001,7 +4029,7 @@ static bool sweep(bool break_on_operation)
int16_t downslope = true; int16_t downslope = true;
// ------------------------- start sweep loop ----------------------------------- // ------------------------- start sweep loop -----------------------------------
for (int i = 0; i < sweep_points; i++) { for (int i = 0; i < sweep_points ; i++) {
debug_avoid_second = false; debug_avoid_second = false;
debug_avoid_label: debug_avoid_label:
debug_avoid_second = debug_avoid_second; debug_avoid_second = debug_avoid_second;

@ -1321,10 +1321,10 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb)
markers[1].mtype = M_TRACKING; markers[1].mtype = M_TRACKING;
kp_help_text = "Frequency of left signal"; kp_help_text = "Frequency of left signal";
ui_mode_keypad(KM_CENTER); ui_mode_keypad(KM_CENTER);
int left = uistat.value; freq_t left = uistat.value;
kp_help_text = "Right signal"; kp_help_text = "Right signal";
ui_mode_keypad(KM_CENTER); ui_mode_keypad(KM_CENTER);
int right = uistat.value; freq_t right = uistat.value;
set_sweep_frequency(ST_CENTER, (left+right)/2); set_sweep_frequency(ST_CENTER, (left+right)/2);
set_sweep_frequency(ST_SPAN, (right - left)*5); set_sweep_frequency(ST_SPAN, (right - left)*5);
set_average(0,AV_4); set_average(0,AV_4);

Loading…
Cancel
Save

Powered by TurnKey Linux.