changed logic value for automatic gain mode

sorry boys & girls!
gr3.6
Dimitri Stolnikov 11 years ago
parent cf1c3ab117
commit ba0b52868a
  1. 8
      apps/osmosdr_source.grc
  2. 134
      apps/osmosdr_source_multi.grc
  3. 4
      grc/gen_osmosdr_blocks.py
  4. 2
      include/osmosdr/osmosdr_source_c.h
  5. 2
      lib/osmosdr_src_iface.h
  6. 12
      lib/rtl/rtl_source_c.cc
  7. 2
      lib/rtl/rtl_source_c.h

@ -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>

@ -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>
@ -418,6 +367,57 @@
<value>0</value>
</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>
@ -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>
@ -488,6 +496,10 @@
<key>gain2</key>
<value>0</value>
</param>
<param>
<key>gain_mode2</key>
<value>0</value>
</param>
<param>
<key>ant2</key>
<value></value>
@ -504,6 +516,10 @@
<key>gain3</key>
<value>0</value>
</param>
<param>
<key>gain_mode3</key>
<value>0</value>
</param>
<param>
<key>ant3</key>
<value></value>
@ -520,6 +536,10 @@
<key>gain4</key>
<value>0</value>
</param>
<param>
<key>gain_mode4</key>
<value>0</value>
</param>
<param>
<key>ant4</key>
<value></value>

@ -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>

@ -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
*/

@ -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
*/

@ -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 )

@ -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 */

Loading…
Cancel
Save