From b3bbe0935ede6ba50b39ea94f12c5b9cdda8c51b Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Sat, 28 Sep 2013 13:27:58 +0200 Subject: [PATCH] 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 --- lib/hackrf/hackrf_sink_c.cc | 9 +++++---- lib/hackrf/hackrf_source_c.cc | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc index 37baee5..da19488 100644 --- a/lib/hackrf/hackrf_sink_c.cc +++ b/lib/hackrf/hackrf_sink_c.cc @@ -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 ) ) } diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc index 6462fa3..74e7980 100644 --- a/lib/hackrf/hackrf_source_c.cc +++ b/lib/hackrf/hackrf_source_c.cc @@ -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 ) ) }