diff options
-rw-r--r-- | apps/osmosdr_source.grc | 8 | ||||
-rw-r--r-- | apps/osmosdr_source_multi.grc | 134 | ||||
-rw-r--r-- | grc/gen_osmosdr_blocks.py | 4 | ||||
-rw-r--r-- | include/osmosdr/osmosdr_source_c.h | 2 | ||||
-rw-r--r-- | lib/osmosdr_src_iface.h | 2 | ||||
-rw-r--r-- | lib/rtl/rtl_source_c.cc | 12 | ||||
-rw-r--r-- | lib/rtl/rtl_source_c.h | 2 |
7 files changed, 94 insertions, 70 deletions
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 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat May 5 14:59:24 2012</timestamp> + <timestamp>Sat May 5 21:04:19 2012</timestamp> <block> <key>options</key> <param> @@ -426,7 +426,7 @@ </param> <param> <key>args</key> - <value>rtl=0</value> + <value></value> </param> <param> <key>nchan</key> @@ -450,7 +450,7 @@ </param> <param> <key>gain_mode0</key> - <value>1</value> + <value>0</value> </param> <param> <key>ant0</key> @@ -470,7 +470,7 @@ </param> <param> <key>gain_mode1</key> - <value>1</value> + <value>0</value> </param> <param> <key>ant1</key> 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 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Apr 28 20:02:00 2012</timestamp> + <timestamp>Sat May 5 21:02:25 2012</timestamp> <block> <key>options</key> <param> @@ -44,67 +44,16 @@ <value>True</value> </param> <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value></value> - </param> - <param> - <key>value</key> - <value>10</value> - </param> - <param> - <key>min</key> + <key>max_nouts</key> <value>0</value> </param> <param> - <key>max</key> - <value>30</value> - </param> - <param> - <key>num_steps</key> - <value>31</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> + <key>realtime_scheduling</key> <value></value> </param> <param> <key>_coordinate</key> - <value>(472, 65)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -419,6 +368,57 @@ </param> </block> <block> + <key>variable_chooser</key> + <param> + <key>id</key> + <value>gain_chooser</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value></value> + </param> + <param> + <key>value</key> + <value>9.0</value> + </param> + <param> + <key>choices</key> + <value>[-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]</value> + </param> + <param> + <key>labels</key> + <value>[]</value> + </param> + <param> + <key>type</key> + <value>drop_down</value> + </param> + <param> + <key>style</key> + <value>wx.RA_HORIZONTAL</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(460, 64)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> <key>osmosdr_source_c</key> <param> <key>id</key> @@ -454,7 +454,11 @@ </param> <param> <key>gain0</key> - <value>gain</value> + <value>gain_chooser</value> + </param> + <param> + <key>gain_mode0</key> + <value>0</value> </param> <param> <key>ant0</key> @@ -470,7 +474,11 @@ </param> <param> <key>gain1</key> - <value>gain</value> + <value>gain_chooser</value> + </param> + <param> + <key>gain_mode1</key> + <value>0</value> </param> <param> <key>ant1</key> @@ -489,6 +497,10 @@ <value>0</value> </param> <param> + <key>gain_mode2</key> + <value>0</value> + </param> + <param> <key>ant2</key> <value></value> </param> @@ -505,6 +517,10 @@ <value>0</value> </param> <param> + <key>gain_mode3</key> + <value>0</value> + </param> + <param> <key>ant3</key> <value></value> </param> @@ -521,6 +537,10 @@ <value>0</value> </param> <param> + <key>gain_mode4</key> + <value>0</value> + </param> + <param> <key>ant4</key> <value></value> </param> 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 = """ <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide> <option> <name>Manual</name> - <key>1</key> + <key>0</key> </option> <option> <name>Auto</name> - <key>0</key> + <key>1</key> </option> </param> <param> 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 */ |