hackrf: don't set automatic bandwidth on samplerate change

automatic bandwidth selection may be triggered by calling
set_bandwidth(0) after changing the sample rate
This commit is contained in:
Dimitri Stolnikov 2013-09-28 13:27:58 +02:00
parent 9b41c6aa20
commit b3bbe0935e
2 changed files with 10 additions and 8 deletions

View File

@ -159,7 +159,8 @@ hackrf_sink_c::hackrf_sink_c (const std::string &args)
_freq_corr(0),
_auto_gain(false),
_amp_gain(0),
_vga_gain(0)
_vga_gain(0),
_bandwidth(0)
{
int ret;
@ -208,8 +209,8 @@ hackrf_sink_c::hackrf_sink_c (const std::string &args)
<< std::endl;
}
// set_sample_rate( get_sample_rates().start() );
set_sample_rate( 10e6 );
set_sample_rate( get_sample_rates().start() );
set_bandwidth( 0 );
set_gain( 0 ); /* disable AMP gain stage by default */
@ -495,7 +496,7 @@ double hackrf_sink_c::set_sample_rate( double rate )
ret = hackrf_set_sample_rate( _dev, rate );
if ( HACKRF_SUCCESS == ret ) {
_sample_rate = rate;
set_bandwidth( 0.0 ); /* bandwidth of 0 means automatic filter selection */
//set_bandwidth( 0.0 ); /* bandwidth of 0 means automatic filter selection */
} else {
HACKRF_THROW_ON_ERROR( ret, HACKRF_FUNC_STR( "hackrf_set_sample_rate", rate ) )
}

View File

@ -93,7 +93,8 @@ hackrf_source_c::hackrf_source_c (const std::string &args)
_auto_gain(false),
_amp_gain(0),
_lna_gain(0),
_vga_gain(0)
_vga_gain(0),
_bandwidth(0)
{
int ret;
@ -162,8 +163,8 @@ hackrf_source_c::hackrf_source_c (const std::string &args)
<< std::endl;
}
// set_sample_rate( get_sample_rates().start() );
set_sample_rate( 10e6 );
set_sample_rate( get_sample_rates().start() );
set_bandwidth( 0 );
set_gain( 0 ); /* disable AMP gain stage by default */
@ -387,7 +388,7 @@ double hackrf_source_c::set_sample_rate( double rate )
ret = hackrf_set_sample_rate( _dev, rate );
if ( HACKRF_SUCCESS == ret ) {
_sample_rate = rate;
set_bandwidth( 0.0 ); /* bandwidth of 0 means automatic filter selection */
//set_bandwidth( 0.0 ); /* bandwidth of 0 means automatic filter selection */
} else {
HACKRF_THROW_ON_ERROR( ret, HACKRF_FUNC_STR( "hackrf_set_sample_rate", rate ) )
}