mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	LimeSDR input: individual manually set gains: GUI part
This commit is contained in:
		
							parent
							
								
									4079d84d74
								
							
						
					
					
						commit
						c00acc6585
					
				| @ -268,10 +268,30 @@ void LimeSDRInputGUI::displaySettings() | |||||||
|     ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000); |     ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000); | ||||||
| 
 | 
 | ||||||
|     ui->gain->setValue(m_settings.m_gain); |     ui->gain->setValue(m_settings.m_gain); | ||||||
|     ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain)); |     ui->gainText->setText(tr("%1").arg(m_settings.m_gain)); | ||||||
| 
 | 
 | ||||||
|     ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath); |     ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath); | ||||||
| 
 | 
 | ||||||
|  |     ui->gainMode->setCurrentIndex((int) m_settings.m_gainMode); | ||||||
|  |     ui->lnaGain->setValue(m_settings.m_lnaGain); | ||||||
|  |     ui->tiaGain->setCurrentIndex(m_settings.m_tiaGain - 1); | ||||||
|  |     ui->pgaGain->setValue(m_settings.m_pgaGain); | ||||||
|  | 
 | ||||||
|  |     if (m_settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO) | ||||||
|  |     { | ||||||
|  |         ui->gain->setEnabled(true); | ||||||
|  |         ui->lnaGain->setEnabled(false); | ||||||
|  |         ui->tiaGain->setEnabled(false); | ||||||
|  |         ui->pgaGain->setEnabled(false); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         ui->gain->setEnabled(false); | ||||||
|  |         ui->lnaGain->setEnabled(true); | ||||||
|  |         ui->tiaGain->setEnabled(true); | ||||||
|  |         ui->pgaGain->setEnabled(true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     setNCODisplay(); |     setNCODisplay(); | ||||||
| 
 | 
 | ||||||
|     ui->ncoEnable->setChecked(m_settings.m_ncoEnable); |     ui->ncoEnable->setChecked(m_settings.m_ncoEnable); | ||||||
| @ -477,10 +497,52 @@ void LimeSDRInputGUI::on_lpFIR_changed(quint64 value) | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void LimeSDRInputGUI::on_gainMode_currentIndexChanged(int index) | ||||||
|  | { | ||||||
|  |     m_settings.m_gainMode = (LimeSDRInputSettings::GainMode) index; | ||||||
|  | 
 | ||||||
|  |     if (index == 0) | ||||||
|  |     { | ||||||
|  |         ui->gain->setEnabled(true); | ||||||
|  |         ui->lnaGain->setEnabled(false); | ||||||
|  |         ui->tiaGain->setEnabled(false); | ||||||
|  |         ui->pgaGain->setEnabled(false); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         ui->gain->setEnabled(false); | ||||||
|  |         ui->lnaGain->setEnabled(true); | ||||||
|  |         ui->tiaGain->setEnabled(true); | ||||||
|  |         ui->pgaGain->setEnabled(true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     sendSettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void LimeSDRInputGUI::on_gain_valueChanged(int value) | void LimeSDRInputGUI::on_gain_valueChanged(int value) | ||||||
| { | { | ||||||
|     m_settings.m_gain = value; |     m_settings.m_gain = value; | ||||||
|     ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain)); |     ui->gainText->setText(tr("%1").arg(m_settings.m_gain)); | ||||||
|  |     sendSettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void LimeSDRInputGUI::on_lnaGain_valueChanged(int value) | ||||||
|  | { | ||||||
|  |     m_settings.m_lnaGain = value; | ||||||
|  |     ui->lnaGainText->setText(tr("%1").arg(m_settings.m_lnaGain)); | ||||||
|  |     sendSettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void LimeSDRInputGUI::on_tiaGain_currentIndexChanged(int index) | ||||||
|  | { | ||||||
|  |     m_settings.m_tiaGain = index + 1; | ||||||
|  |     sendSettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void LimeSDRInputGUI::on_pgaGain_valueChanged(int value) | ||||||
|  | { | ||||||
|  |     m_settings.m_pgaGain = value; | ||||||
|  |     ui->pgaGainText->setText(tr("%1").arg(m_settings.m_pgaGain)); | ||||||
|     sendSettings(); |     sendSettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -87,7 +87,11 @@ private slots: | |||||||
|     void on_lpf_changed(quint64 value); |     void on_lpf_changed(quint64 value); | ||||||
|     void on_lpFIREnable_toggled(bool checked); |     void on_lpFIREnable_toggled(bool checked); | ||||||
|     void on_lpFIR_changed(quint64 value); |     void on_lpFIR_changed(quint64 value); | ||||||
|  |     void on_gainMode_currentIndexChanged(int index); | ||||||
|     void on_gain_valueChanged(int value); |     void on_gain_valueChanged(int value); | ||||||
|  |     void on_lnaGain_valueChanged(int value); | ||||||
|  |     void on_tiaGain_currentIndexChanged(int index); | ||||||
|  |     void on_pgaGain_valueChanged(int value); | ||||||
|     void on_antenna_currentIndexChanged(int index); |     void on_antenna_currentIndexChanged(int index); | ||||||
| 
 | 
 | ||||||
|     void updateHardware(); |     void updateHardware(); | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
|    <rect> |    <rect> | ||||||
|     <x>0</x> |     <x>0</x> | ||||||
|     <y>0</y> |     <y>0</y> | ||||||
|     <width>350</width> |     <width>374</width> | ||||||
|     <height>290</height> |     <height>290</height> | ||||||
|    </rect> |    </rect> | ||||||
|   </property> |   </property> | ||||||
| @ -550,19 +550,6 @@ | |||||||
|        </property> |        </property> | ||||||
|       </widget> |       </widget> | ||||||
|      </item> |      </item> | ||||||
|      <item> |  | ||||||
|       <spacer name="horizontalSpacer"> |  | ||||||
|        <property name="orientation"> |  | ||||||
|         <enum>Qt::Horizontal</enum> |  | ||||||
|        </property> |  | ||||||
|        <property name="sizeHint" stdset="0"> |  | ||||||
|         <size> |  | ||||||
|          <width>40</width> |  | ||||||
|          <height>20</height> |  | ||||||
|         </size> |  | ||||||
|        </property> |  | ||||||
|       </spacer> |  | ||||||
|      </item> |  | ||||||
|      <item> |      <item> | ||||||
|       <widget class="ButtonSwitch" name="lpFIREnable"> |       <widget class="ButtonSwitch" name="lpFIREnable"> | ||||||
|        <property name="toolTip"> |        <property name="toolTip"> | ||||||
| @ -619,19 +606,38 @@ | |||||||
|       <number>2</number> |       <number>2</number> | ||||||
|      </property> |      </property> | ||||||
|      <item> |      <item> | ||||||
|       <widget class="QLabel" name="gainLabel"> |       <widget class="QComboBox" name="gainMode"> | ||||||
|        <property name="text"> |        <property name="maximumSize"> | ||||||
|         <string>Gain</string> |         <size> | ||||||
|  |          <width>54</width> | ||||||
|  |          <height>16777215</height> | ||||||
|  |         </size> | ||||||
|        </property> |        </property> | ||||||
|  |        <property name="toolTip"> | ||||||
|  |         <string>Automatic or Manual gain selection</string> | ||||||
|  |        </property> | ||||||
|  |        <item> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Aut</string> | ||||||
|  |         </property> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Man</string> | ||||||
|  |         </property> | ||||||
|  |        </item> | ||||||
|       </widget> |       </widget> | ||||||
|      </item> |      </item> | ||||||
|      <item> |      <item> | ||||||
|       <widget class="QSlider" name="gain"> |       <widget class="QDial" name="gain"> | ||||||
|        <property name="toolTip"> |        <property name="maximumSize"> | ||||||
|         <string>Global gain setting (dB)</string> |         <size> | ||||||
|  |          <width>24</width> | ||||||
|  |          <height>24</height> | ||||||
|  |         </size> | ||||||
|        </property> |        </property> | ||||||
|        <property name="minimum"> |        <property name="toolTip"> | ||||||
|         <number>0</number> |         <string>Automatic global gain (dB)</string> | ||||||
|        </property> |        </property> | ||||||
|        <property name="maximum"> |        <property name="maximum"> | ||||||
|         <number>70</number> |         <number>70</number> | ||||||
| @ -642,30 +648,188 @@ | |||||||
|        <property name="value"> |        <property name="value"> | ||||||
|         <number>20</number> |         <number>20</number> | ||||||
|        </property> |        </property> | ||||||
|        <property name="orientation"> |  | ||||||
|         <enum>Qt::Horizontal</enum> |  | ||||||
|        </property> |  | ||||||
|       </widget> |       </widget> | ||||||
|      </item> |      </item> | ||||||
|      <item> |      <item> | ||||||
|       <widget class="QLabel" name="gainText"> |       <widget class="QLabel" name="gainText"> | ||||||
|        <property name="minimumSize"> |        <property name="minimumSize"> | ||||||
|         <size> |         <size> | ||||||
|          <width>40</width> |          <width>18</width> | ||||||
|          <height>0</height> |          <height>0</height> | ||||||
|         </size> |         </size> | ||||||
|        </property> |        </property> | ||||||
|  |        <property name="maximumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>18</width> | ||||||
|  |          <height>16777215</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|        <property name="toolTip"> |        <property name="toolTip"> | ||||||
|         <string>Global gain (dB)</string> |         <string>Automatic global gain</string> | ||||||
|        </property> |        </property> | ||||||
|        <property name="text"> |        <property name="text"> | ||||||
|         <string>20dB</string> |         <string>20</string> | ||||||
|        </property> |        </property> | ||||||
|        <property name="alignment"> |        <property name="alignment"> | ||||||
|         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | ||||||
|        </property> |        </property> | ||||||
|       </widget> |       </widget> | ||||||
|      </item> |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="Line" name="line_3"> | ||||||
|  |        <property name="orientation"> | ||||||
|  |         <enum>Qt::Vertical</enum> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="QDial" name="lnaGain"> | ||||||
|  |        <property name="maximumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>24</width> | ||||||
|  |          <height>24</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="toolTip"> | ||||||
|  |         <string>Manual LNA gain</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="minimum"> | ||||||
|  |         <number>1</number> | ||||||
|  |        </property> | ||||||
|  |        <property name="maximum"> | ||||||
|  |         <number>30</number> | ||||||
|  |        </property> | ||||||
|  |        <property name="pageStep"> | ||||||
|  |         <number>1</number> | ||||||
|  |        </property> | ||||||
|  |        <property name="sliderPosition"> | ||||||
|  |         <number>15</number> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="QLabel" name="lnaGainText"> | ||||||
|  |        <property name="minimumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>18</width> | ||||||
|  |          <height>0</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="maximumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>18</width> | ||||||
|  |          <height>16777215</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="toolTip"> | ||||||
|  |         <string>Manual LNA gain (dB)</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="text"> | ||||||
|  |         <string>15</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="alignment"> | ||||||
|  |         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="QComboBox" name="tiaGain"> | ||||||
|  |        <property name="maximumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>40</width> | ||||||
|  |          <height>16777215</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="toolTip"> | ||||||
|  |         <string>Manual TIA gain (dB)</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="currentIndex"> | ||||||
|  |         <number>1</number> | ||||||
|  |        </property> | ||||||
|  |        <item> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>1</string> | ||||||
|  |         </property> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>2</string> | ||||||
|  |         </property> | ||||||
|  |        </item> | ||||||
|  |        <item> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>3</string> | ||||||
|  |         </property> | ||||||
|  |        </item> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="QDial" name="pgaGain"> | ||||||
|  |        <property name="maximumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>24</width> | ||||||
|  |          <height>24</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="toolTip"> | ||||||
|  |         <string>Manual PGA gain</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="maximum"> | ||||||
|  |         <number>32</number> | ||||||
|  |        </property> | ||||||
|  |        <property name="pageStep"> | ||||||
|  |         <number>1</number> | ||||||
|  |        </property> | ||||||
|  |        <property name="value"> | ||||||
|  |         <number>16</number> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="QLabel" name="pgaGainText"> | ||||||
|  |        <property name="minimumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>18</width> | ||||||
|  |          <height>0</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="maximumSize"> | ||||||
|  |         <size> | ||||||
|  |          <width>18</width> | ||||||
|  |          <height>16777215</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |        <property name="toolTip"> | ||||||
|  |         <string>Manual PGA gain (dB)</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="text"> | ||||||
|  |         <string>16</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="alignment"> | ||||||
|  |         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <spacer name="horizontalSpacer_5"> | ||||||
|  |        <property name="orientation"> | ||||||
|  |         <enum>Qt::Horizontal</enum> | ||||||
|  |        </property> | ||||||
|  |        <property name="sizeHint" stdset="0"> | ||||||
|  |         <size> | ||||||
|  |          <width>40</width> | ||||||
|  |          <height>20</height> | ||||||
|  |         </size> | ||||||
|  |        </property> | ||||||
|  |       </spacer> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="Line" name="line_4"> | ||||||
|  |        <property name="orientation"> | ||||||
|  |         <enum>Qt::Vertical</enum> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|      <item> |      <item> | ||||||
|       <widget class="QLabel" name="antennaLabel"> |       <widget class="QLabel" name="antennaLabel"> | ||||||
|        <property name="pixmap"> |        <property name="pixmap"> | ||||||
|  | |||||||
| @ -37,6 +37,10 @@ void LimeSDRInputSettings::resetToDefaults() | |||||||
|     m_ncoEnable = false; |     m_ncoEnable = false; | ||||||
|     m_ncoFrequency = 0; |     m_ncoFrequency = 0; | ||||||
|     m_antennaPath = PATH_RFE_NONE; |     m_antennaPath = PATH_RFE_NONE; | ||||||
|  |     m_gainMode = GAIN_AUTO; | ||||||
|  |     m_lnaGain = 15; | ||||||
|  |     m_tiaGain = 2; | ||||||
|  |     m_pgaGain = 16; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QByteArray LimeSDRInputSettings::serialize() const | QByteArray LimeSDRInputSettings::serialize() const | ||||||
| @ -55,6 +59,10 @@ QByteArray LimeSDRInputSettings::serialize() const | |||||||
|     s.writeBool(11, m_ncoEnable); |     s.writeBool(11, m_ncoEnable); | ||||||
|     s.writeS32(12, m_ncoFrequency); |     s.writeS32(12, m_ncoFrequency); | ||||||
|     s.writeS32(13, (int) m_antennaPath); |     s.writeS32(13, (int) m_antennaPath); | ||||||
|  |     s.writeS32(14, (int) m_gainMode); | ||||||
|  |     s.writeU32(15, m_lnaGain); | ||||||
|  |     s.writeU32(16, m_tiaGain); | ||||||
|  |     s.writeU32(17, m_pgaGain); | ||||||
| 
 | 
 | ||||||
|     return s.final(); |     return s.final(); | ||||||
| } | } | ||||||
| @ -86,6 +94,11 @@ bool LimeSDRInputSettings::deserialize(const QByteArray& data) | |||||||
|         d.readS32(12, &m_ncoFrequency, 0); |         d.readS32(12, &m_ncoFrequency, 0); | ||||||
|         d.readS32(13, &intval, 0); |         d.readS32(13, &intval, 0); | ||||||
|         m_antennaPath = (PathRFE) intval; |         m_antennaPath = (PathRFE) intval; | ||||||
|  |         d.readS32(14, &intval, 0); | ||||||
|  |         m_gainMode = (GainMode) intval; | ||||||
|  |         d.readU32(15, &m_lnaGain, 15); | ||||||
|  |         d.readU32(16, &m_tiaGain, 2); | ||||||
|  |         d.readU32(17, &m_pgaGain, 16); | ||||||
| 
 | 
 | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -42,6 +42,11 @@ struct LimeSDRInputSettings | |||||||
|         PATH_RFE_LB2 |         PATH_RFE_LB2 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     typedef enum { | ||||||
|  |         GAIN_AUTO, | ||||||
|  |         GAIN_MANUAL | ||||||
|  |     } GainMode; | ||||||
|  | 
 | ||||||
|     // global settings to be saved
 |     // global settings to be saved
 | ||||||
|     uint64_t m_centerFrequency; |     uint64_t m_centerFrequency; | ||||||
|     int      m_devSampleRate; |     int      m_devSampleRate; | ||||||
| @ -57,6 +62,10 @@ struct LimeSDRInputSettings | |||||||
|     bool     m_ncoEnable;    //!< Enable TSP NCO and mixing
 |     bool     m_ncoEnable;    //!< Enable TSP NCO and mixing
 | ||||||
|     int      m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed)
 |     int      m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed)
 | ||||||
|     PathRFE  m_antennaPath; |     PathRFE  m_antennaPath; | ||||||
|  |     GainMode m_gainMode;     //!< Gain mode: auto or manual
 | ||||||
|  |     uint32_t m_lnaGain;      //!< Manual LAN gain
 | ||||||
|  |     uint32_t m_tiaGain;      //!< Manual TIA gain
 | ||||||
|  |     uint32_t m_pgaGain;      //!< Manual PGA gain
 | ||||||
| 
 | 
 | ||||||
|     LimeSDRInputSettings(); |     LimeSDRInputSettings(); | ||||||
|     void resetToDefaults(); |     void resetToDefaults(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user