diff --git a/apps/osmosdr_source.grc b/apps/osmosdr_source.grc index 2a22589..03e439a 100644 --- a/apps/osmosdr_source.grc +++ b/apps/osmosdr_source.grc @@ -1,6 +1,6 @@ - Sat May 5 14:59:24 2012 + Sat May 5 21:04:19 2012 options @@ -426,7 +426,7 @@ args - rtl=0 + nchan @@ -450,7 +450,7 @@ gain_mode0 - 1 + 0 ant0 @@ -470,7 +470,7 @@ gain_mode1 - 1 + 0 ant1 diff --git a/apps/osmosdr_source_multi.grc b/apps/osmosdr_source_multi.grc index dc14239..7270485 100644 --- a/apps/osmosdr_source_multi.grc +++ b/apps/osmosdr_source_multi.grc @@ -1,6 +1,6 @@ - Sat Apr 28 20:02:00 2012 + Sat May 5 21:02:25 2012 options @@ -43,6 +43,10 @@ run True + + max_nouts + 0 + realtime_scheduling @@ -56,61 +60,6 @@ 0 - - variable_slider - - id - gain - - - _enabled - True - - - label - - - - value - 10 - - - min - 0 - - - max - 30 - - - num_steps - 31 - - - style - wx.SL_HORIZONTAL - - - converver - float_converter - - - grid_pos - - - - notebook - - - - _coordinate - (472, 65) - - - _rotation - 0 - - variable @@ -418,6 +367,57 @@ 0 + + variable_chooser + + id + gain_chooser + + + _enabled + True + + + label + + + + value + 9.0 + + + choices + [-1.0, 1.5, 4.0, 6.5, 9.0, 11.5, 14.0, 16.5, 19.0, 21.5, 24.0, 29.0, 34.0, 42.0, 43.0, 45.0, 47.0, 49.0] + + + labels + [] + + + type + drop_down + + + style + wx.RA_HORIZONTAL + + + grid_pos + + + + notebook + + + + _coordinate + (460, 64) + + + _rotation + 0 + + osmosdr_source_c @@ -454,7 +454,11 @@ gain0 - gain + gain_chooser + + + gain_mode0 + 0 ant0 @@ -470,7 +474,11 @@ gain1 - gain + gain_chooser + + + gain_mode1 + 0 ant1 @@ -488,6 +496,10 @@ gain2 0 + + gain_mode2 + 0 + ant2 @@ -504,6 +516,10 @@ gain3 0 + + gain_mode3 + 0 + ant3 @@ -520,6 +536,10 @@ gain4 0 + + gain_mode4 + 0 + ant4 diff --git a/grc/gen_osmosdr_blocks.py b/grc/gen_osmosdr_blocks.py index b57fa16..5c831c2 100644 --- a/grc/gen_osmosdr_blocks.py +++ b/grc/gen_osmosdr_blocks.py @@ -180,11 +180,11 @@ PARAMS_TMPL = """ \#if \$nchan() > $n then 'none' else 'all'# diff --git a/include/osmosdr/osmosdr_source_c.h b/include/osmosdr/osmosdr_source_c.h index fae0f05..1da922b 100644 --- a/include/osmosdr/osmosdr_source_c.h +++ b/include/osmosdr/osmosdr_source_c.h @@ -148,7 +148,7 @@ public: /*! * Set the gain mode for the underlying radio hardware. * This might be supported only for certain hardware types. - * \param mode the gain mode (true means manual gain mode) + * \param mode the gain mode (true means automatic gain mode) * \param chan the channel index 0 to N-1 * \return the actual gain mode */ diff --git a/lib/osmosdr_src_iface.h b/lib/osmosdr_src_iface.h index 2a6ae40..a02e8c1 100644 --- a/lib/osmosdr_src_iface.h +++ b/lib/osmosdr_src_iface.h @@ -126,7 +126,7 @@ public: /*! * Set the gain mode for the underlying radio hardware. * This might be supported only for certain hardware types. - * \param mode the gain mode (true means manual gain mode) + * \param mode the gain mode (true means automatic gain mode) * \param chan the channel index 0 to N-1 * \return the actual gain mode */ diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc index f60d2cf..c594abc 100644 --- a/lib/rtl/rtl_source_c.cc +++ b/lib/rtl/rtl_source_c.cc @@ -153,9 +153,13 @@ rtl_source_c::rtl_source_c (const std::string &args) if (ret < 0) throw std::runtime_error("Failed to reset usb buffers."); + ret = rtlsdr_set_tuner_gain_mode(_dev, 1); + if (ret < 0) + throw std::runtime_error("Failed to enable manual gain mode."); + _running = true; - _manual_gain = false; + _auto_gain = false; _thread = gruel::thread(_rtlsdr_wait, this); } @@ -418,8 +422,8 @@ osmosdr::gain_range_t rtl_source_c::get_gain_range( const std::string & name, si bool rtl_source_c::set_gain_mode( bool mode, size_t chan ) { if (_dev) { - if (!rtlsdr_set_tuner_gain_mode(_dev, int(mode))) { - _manual_gain = mode; + if (!rtlsdr_set_tuner_gain_mode(_dev, int(!mode))) { + _auto_gain = mode; } } @@ -428,7 +432,7 @@ bool rtl_source_c::set_gain_mode( bool mode, size_t chan ) bool rtl_source_c::get_gain_mode( size_t chan ) { - return _manual_gain; + return _auto_gain; } double rtl_source_c::set_gain( double gain, size_t chan ) diff --git a/lib/rtl/rtl_source_c.h b/lib/rtl/rtl_source_c.h index b2591f1..737e3c0 100644 --- a/lib/rtl/rtl_source_c.h +++ b/lib/rtl/rtl_source_c.h @@ -132,7 +132,7 @@ private: unsigned int _buf_offset; unsigned int _samp_avail; - bool _manual_gain; + bool _auto_gain; }; #endif /* INCLUDED_RTLSDR_SOURCE_C_H */