2828#include "max283x.h"
2929#include "mixer.h"
3030#include "sgpio.h"
31+ #include "transceiver_mode.h"
3132#if defined(PRALINE ) || defined(HACKRF_ONE )
3233 #include "operacake.h"
3334#endif
@@ -79,7 +80,7 @@ static uint32_t max2837_freq_nominal_hz = 2560000000;
7980 * hz between 0 to 999999 Hz (not checked)
8081 * return false on error or true if success.
8182 */
82- bool set_freq (const uint64_t freq )
83+ bool set_freq (const uint64_t freq , const transceiver_mode_t opmode )
8384{
8485 bool success ;
8586 uint64_t mixer_freq_hz ;
@@ -92,7 +93,7 @@ bool set_freq(const uint64_t freq)
9293 max283x_mode_t prior_max283x_mode = max283x_mode (& max283x );
9394 max283x_set_mode (& max283x , MAX283x_MODE_STANDBY );
9495 if (freq_mhz < MAX_LP_FREQ_MHZ ) {
95- rf_path_set_filter (& rf_path , RF_PATH_FILTER_LOW_PASS );
96+ rf_path_set_filter (& rf_path , RF_PATH_FILTER_LOW_PASS , opmode );
9697 #ifdef RAD1O
9798 max2837_freq_nominal_hz = 2300 * FREQ_ONE_MHZ ;
9899 #else
@@ -105,7 +106,7 @@ bool set_freq(const uint64_t freq)
105106 max283x_set_frequency (& max283x , real_mixer_freq_hz - freq );
106107 sgpio_cpld_set_mixer_invert (& sgpio_config , 1 );
107108 } else if ((freq_mhz >= MIN_BYPASS_FREQ_MHZ ) && (freq_mhz < MAX_BYPASS_FREQ_MHZ )) {
108- rf_path_set_filter (& rf_path , RF_PATH_FILTER_BYPASS );
109+ rf_path_set_filter (& rf_path , RF_PATH_FILTER_BYPASS , opmode );
109110 /* mixer_freq_mhz <= not used in Bypass mode */
110111 max283x_set_frequency (& max283x , freq );
111112 sgpio_cpld_set_mixer_invert (& sgpio_config , 0 );
@@ -124,7 +125,7 @@ bool set_freq(const uint64_t freq)
124125 max2837_freq_nominal_hz = (2500 * FREQ_ONE_MHZ ) +
125126 ((freq - (MID2_HP_FREQ_MHZ * FREQ_ONE_MHZ )) / 9 );
126127 }
127- rf_path_set_filter (& rf_path , RF_PATH_FILTER_HIGH_PASS );
128+ rf_path_set_filter (& rf_path , RF_PATH_FILTER_HIGH_PASS , opmode );
128129 mixer_freq_hz = freq - max2837_freq_nominal_hz ;
129130 /* Set Freq and read real freq */
130131 real_mixer_freq_hz = mixer_set_frequency (& mixer , mixer_freq_hz );
@@ -136,7 +137,9 @@ bool set_freq(const uint64_t freq)
136137 }
137138 max283x_set_mode (& max283x , prior_max283x_mode );
138139 if (success ) {
139- hackrf_ui ()-> set_frequency (freq );
140+ if (opmode != TRANSCEIVER_MODE_RX_SWEEP ) {
141+ hackrf_ui ()-> set_frequency (freq );
142+ }
140143 #ifdef HACKRF_ONE
141144 operacake_set_range (freq_mhz );
142145 #endif
@@ -149,7 +152,8 @@ bool set_freq(const uint64_t freq)
149152bool tuning_set_frequency (
150153 const tune_config_t * cfg ,
151154 const uint64_t freq ,
152- const uint32_t offset )
155+ const uint32_t offset ,
156+ const transceiver_mode_t opmode )
153157{
154158 uint64_t mixer_freq_hz ;
155159 uint64_t real_mixer_freq_hz ;
@@ -175,11 +179,11 @@ bool tuning_set_frequency(
175179 max283x_set_mode (& max283x , MAX283x_MODE_STANDBY );
176180
177181 if (cfg -> if_mhz == 0 ) {
178- rf_path_set_filter (& rf_path , RF_PATH_FILTER_BYPASS );
182+ rf_path_set_filter (& rf_path , RF_PATH_FILTER_BYPASS , opmode );
179183 max283x_set_frequency (& max283x , rf );
180184 sgpio_cpld_set_mixer_invert (& sgpio_config , 0 );
181185 } else if (cfg -> if_mhz > freq_mhz ) {
182- rf_path_set_filter (& rf_path , RF_PATH_FILTER_LOW_PASS );
186+ rf_path_set_filter (& rf_path , RF_PATH_FILTER_LOW_PASS , opmode );
183187 if (cfg -> high_lo ) {
184188 mixer_freq_hz = FREQ_ONE_MHZ * cfg -> if_mhz + rf ;
185189 real_mixer_freq_hz = mixer_set_frequency (& mixer , mixer_freq_hz );
@@ -192,15 +196,17 @@ bool tuning_set_frequency(
192196 sgpio_cpld_set_mixer_invert (& sgpio_config , 0 );
193197 }
194198 } else {
195- rf_path_set_filter (& rf_path , RF_PATH_FILTER_HIGH_PASS );
199+ rf_path_set_filter (& rf_path , RF_PATH_FILTER_HIGH_PASS , opmode );
196200 mixer_freq_hz = rf - FREQ_ONE_MHZ * cfg -> if_mhz ;
197201 real_mixer_freq_hz = mixer_set_frequency (& mixer , mixer_freq_hz );
198202 max283x_set_frequency (& max283x , rf - real_mixer_freq_hz );
199203 sgpio_cpld_set_mixer_invert (& sgpio_config , 0 );
200204 }
201205
202206 max283x_set_mode (& max283x , prior_max283x_mode );
203- hackrf_ui ()-> set_frequency (freq );
207+ if (opmode != TRANSCEIVER_MODE_RX_SWEEP ) {
208+ hackrf_ui ()-> set_frequency (freq );
209+ }
204210 operacake_set_range (freq_mhz );
205211 return true;
206212}
@@ -209,7 +215,8 @@ bool tuning_set_frequency(
209215bool set_freq_explicit (
210216 const uint64_t if_freq_hz ,
211217 const uint64_t lo_freq_hz ,
212- const rf_path_filter_t path )
218+ const rf_path_filter_t path ,
219+ const transceiver_mode_t opmode )
213220{
214221 if ((if_freq_hz < ((uint64_t ) ABS_MIN_BYPASS_FREQ_MHZ * FREQ_ONE_MHZ )) ||
215222 (if_freq_hz > ((uint64_t ) ABS_MAX_BYPASS_FREQ_MHZ * FREQ_ONE_MHZ ))) {
@@ -225,7 +232,7 @@ bool set_freq_explicit(
225232 return false;
226233 }
227234
228- rf_path_set_filter (& rf_path , path );
235+ rf_path_set_filter (& rf_path , path , opmode );
229236 max283x_set_frequency (& max283x , if_freq_hz );
230237
231238 if (lo_freq_hz > if_freq_hz ) {
0 commit comments