mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	use ValueDial for NFM channel shift thus allowing fine tuning
This commit is contained in:
		
							parent
							
								
									95835fc8b7
								
							
						
					
					
						commit
						51a18d231a
					
				| @ -2,8 +2,6 @@ | |||||||
| #include <QMainWindow> | #include <QMainWindow> | ||||||
| #include "nfmdemodgui.h" | #include "nfmdemodgui.h" | ||||||
| #include "ui_nfmdemodgui.h" | #include "ui_nfmdemodgui.h" | ||||||
| #include "nfmdemodgui.h" |  | ||||||
| #include "ui_nfmdemodgui.h" |  | ||||||
| #include "dsp/threadedsamplesink.h" | #include "dsp/threadedsamplesink.h" | ||||||
| #include "dsp/channelizer.h" | #include "dsp/channelizer.h" | ||||||
| #include "nfmdemod.h" | #include "nfmdemod.h" | ||||||
| @ -13,6 +11,8 @@ | |||||||
| #include "util/simpleserializer.h" | #include "util/simpleserializer.h" | ||||||
| #include "gui/basicchannelsettingswidget.h" | #include "gui/basicchannelsettingswidget.h" | ||||||
| 
 | 
 | ||||||
|  | #include <iostream> | ||||||
|  | 
 | ||||||
| const int NFMDemodGUI::m_rfBW[] = { | const int NFMDemodGUI::m_rfBW[] = { | ||||||
| 	5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000 | 	5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000 | ||||||
| }; | }; | ||||||
| @ -39,7 +39,7 @@ void NFMDemodGUI::resetToDefaults() | |||||||
| 	ui->afBW->setValue(3); | 	ui->afBW->setValue(3); | ||||||
| 	ui->volume->setValue(20); | 	ui->volume->setValue(20); | ||||||
| 	ui->squelch->setValue(-40); | 	ui->squelch->setValue(-40); | ||||||
| 	ui->fcenter->display(0); | 	ui->deltaFrequency->setValue(0); | ||||||
| 	ui->spectrumGUI->resetToDefaults(); | 	ui->spectrumGUI->resetToDefaults(); | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| @ -102,6 +102,26 @@ void NFMDemodGUI::viewChanged() | |||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void NFMDemodGUI::on_deltaMinus_clicked(bool minus) | ||||||
|  | { | ||||||
|  | 	int deltaFrequency = m_channelMarker->getCenterFrequency(); | ||||||
|  | 	bool minusDelta = (deltaFrequency < 0); | ||||||
|  | 
 | ||||||
|  | 	if (minus ^ minusDelta) // sign change
 | ||||||
|  | 	{ | ||||||
|  | 		m_channelMarker->setCenterFrequency(-deltaFrequency); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void NFMDemodGUI::on_deltaFrequency_changed(quint64 value) | ||||||
|  | { | ||||||
|  | 	if (ui->deltaMinus->isChecked()) { | ||||||
|  | 		m_channelMarker->setCenterFrequency(-value); | ||||||
|  | 	} else { | ||||||
|  | 		m_channelMarker->setCenterFrequency(value); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void NFMDemodGUI::on_rfBW_valueChanged(int value) | void NFMDemodGUI::on_rfBW_valueChanged(int value) | ||||||
| { | { | ||||||
| 	ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0)); | 	ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0)); | ||||||
| @ -203,7 +223,8 @@ void NFMDemodGUI::applySettings() | |||||||
| 	m_channelizer->configure(m_threadedSampleSink->getMessageQueue(), | 	m_channelizer->configure(m_threadedSampleSink->getMessageQueue(), | ||||||
| 		48000, | 		48000, | ||||||
| 		m_channelMarker->getCenterFrequency()); | 		m_channelMarker->getCenterFrequency()); | ||||||
| 	ui->fcenter->display(m_channelMarker->getCenterFrequency()); | 	ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency())); | ||||||
|  | 	ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0); | ||||||
| 	m_nfmDemod->configure(m_threadedSampleSink->getMessageQueue(), | 	m_nfmDemod->configure(m_threadedSampleSink->getMessageQueue(), | ||||||
| 		m_rfBW[ui->rfBW->value()], | 		m_rfBW[ui->rfBW->value()], | ||||||
| 		ui->afBW->value() * 1000.0, | 		ui->afBW->value() * 1000.0, | ||||||
|  | |||||||
| @ -34,6 +34,8 @@ public: | |||||||
| 
 | 
 | ||||||
| private slots: | private slots: | ||||||
| 	void viewChanged(); | 	void viewChanged(); | ||||||
|  | 	void on_deltaFrequency_changed(quint64 value); | ||||||
|  | 	void on_deltaMinus_clicked(bool minus); | ||||||
| 	void on_rfBW_valueChanged(int value); | 	void on_rfBW_valueChanged(int value); | ||||||
| 	void on_afBW_valueChanged(int value); | 	void on_afBW_valueChanged(int value); | ||||||
| 	void on_volume_valueChanged(int value); | 	void on_volume_valueChanged(int value); | ||||||
|  | |||||||
| @ -41,10 +41,16 @@ | |||||||
|     <property name="spacing"> |     <property name="spacing"> | ||||||
|      <number>3</number> |      <number>3</number> | ||||||
|     </property> |     </property> | ||||||
|     <item row="1" column="0"> |     <item row="3" column="1"> | ||||||
|      <widget class="QLabel" name="label"> |      <widget class="QSlider" name="volume"> | ||||||
|       <property name="text"> |       <property name="maximum"> | ||||||
|        <string>RF Bandwidth</string> |        <number>100</number> | ||||||
|  |       </property> | ||||||
|  |       <property name="value"> | ||||||
|  |        <number>20</number> | ||||||
|  |       </property> | ||||||
|  |       <property name="orientation"> | ||||||
|  |        <enum>Qt::Horizontal</enum> | ||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
| @ -64,6 +70,46 @@ | |||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
|  |     <item row="0" column="0"> | ||||||
|  |      <widget class="QRadioButton" name="deltaMinus"> | ||||||
|  |       <property name="layoutDirection"> | ||||||
|  |        <enum>Qt::RightToLeft</enum> | ||||||
|  |       </property> | ||||||
|  |       <property name="text"> | ||||||
|  |        <string>Minus</string> | ||||||
|  |       </property> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|  |     <item row="4" column="0"> | ||||||
|  |      <widget class="QLabel" name="label_4"> | ||||||
|  |       <property name="text"> | ||||||
|  |        <string>Squelch</string> | ||||||
|  |       </property> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|  |     <item row="2" column="0"> | ||||||
|  |      <widget class="QLabel" name="label_2"> | ||||||
|  |       <property name="text"> | ||||||
|  |        <string>AF Bandwidth</string> | ||||||
|  |       </property> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|  |     <item row="4" column="1"> | ||||||
|  |      <widget class="QSlider" name="squelch"> | ||||||
|  |       <property name="minimum"> | ||||||
|  |        <number>-100</number> | ||||||
|  |       </property> | ||||||
|  |       <property name="maximum"> | ||||||
|  |        <number>0</number> | ||||||
|  |       </property> | ||||||
|  |       <property name="value"> | ||||||
|  |        <number>-40</number> | ||||||
|  |       </property> | ||||||
|  |       <property name="orientation"> | ||||||
|  |        <enum>Qt::Horizontal</enum> | ||||||
|  |       </property> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|     <item row="1" column="2"> |     <item row="1" column="2"> | ||||||
|      <widget class="QLabel" name="rfBWText"> |      <widget class="QLabel" name="rfBWText"> | ||||||
|       <property name="minimumSize"> |       <property name="minimumSize"> | ||||||
| @ -80,10 +126,26 @@ | |||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
|     <item row="2" column="0"> |     <item row="1" column="0"> | ||||||
|      <widget class="QLabel" name="label_2"> |      <widget class="QLabel" name="label"> | ||||||
|       <property name="text"> |       <property name="text"> | ||||||
|        <string>AF Bandwidth</string> |        <string>RF Bandwidth</string> | ||||||
|  |       </property> | ||||||
|  |      </widget> | ||||||
|  |     </item> | ||||||
|  |     <item row="2" column="2"> | ||||||
|  |      <widget class="QLabel" name="afBWText"> | ||||||
|  |       <property name="minimumSize"> | ||||||
|  |        <size> | ||||||
|  |         <width>50</width> | ||||||
|  |         <height>0</height> | ||||||
|  |        </size> | ||||||
|  |       </property> | ||||||
|  |       <property name="text"> | ||||||
|  |        <string>3 kHz</string> | ||||||
|  |       </property> | ||||||
|  |       <property name="alignment"> | ||||||
|  |        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | ||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
| @ -106,15 +168,8 @@ | |||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
|     <item row="3" column="0"> |     <item row="4" column="2"> | ||||||
|      <widget class="QLabel" name="label_3"> |      <widget class="QLabel" name="squelchText"> | ||||||
|       <property name="text"> |  | ||||||
|        <string>Volume</string> |  | ||||||
|       </property> |  | ||||||
|      </widget> |  | ||||||
|     </item> |  | ||||||
|     <item row="2" column="2"> |  | ||||||
|      <widget class="QLabel" name="afBWText"> |  | ||||||
|       <property name="minimumSize"> |       <property name="minimumSize"> | ||||||
|        <size> |        <size> | ||||||
|         <width>50</width> |         <width>50</width> | ||||||
| @ -122,30 +177,17 @@ | |||||||
|        </size> |        </size> | ||||||
|       </property> |       </property> | ||||||
|       <property name="text"> |       <property name="text"> | ||||||
|        <string>3 kHz</string> |        <string>-40dB</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 row="4" column="0"> |     <item row="3" column="0"> | ||||||
|      <widget class="QLabel" name="label_4"> |      <widget class="QLabel" name="label_3"> | ||||||
|       <property name="text"> |       <property name="text"> | ||||||
|        <string>Squelch</string> |        <string>Volume</string> | ||||||
|       </property> |  | ||||||
|      </widget> |  | ||||||
|     </item> |  | ||||||
|     <item row="3" column="1"> |  | ||||||
|      <widget class="QSlider" name="volume"> |  | ||||||
|       <property name="maximum"> |  | ||||||
|        <number>100</number> |  | ||||||
|       </property> |  | ||||||
|       <property name="value"> |  | ||||||
|        <number>20</number> |  | ||||||
|       </property> |  | ||||||
|       <property name="orientation"> |  | ||||||
|        <enum>Qt::Horizontal</enum> |  | ||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
| @ -165,58 +207,38 @@ | |||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
|     <item row="4" column="1"> |     <item row="0" column="1"> | ||||||
|      <widget class="QSlider" name="squelch"> |      <widget class="ValueDial" name="deltaFrequency" native="true"> | ||||||
|       <property name="minimum"> |       <property name="sizePolicy"> | ||||||
|        <number>-100</number> |        <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> | ||||||
|  |         <horstretch>0</horstretch> | ||||||
|  |         <verstretch>0</verstretch> | ||||||
|  |        </sizepolicy> | ||||||
|       </property> |       </property> | ||||||
|       <property name="maximum"> |  | ||||||
|        <number>0</number> |  | ||||||
|       </property> |  | ||||||
|       <property name="value"> |  | ||||||
|        <number>-40</number> |  | ||||||
|       </property> |  | ||||||
|       <property name="orientation"> |  | ||||||
|        <enum>Qt::Horizontal</enum> |  | ||||||
|       </property> |  | ||||||
|      </widget> |  | ||||||
|     </item> |  | ||||||
|     <item row="4" column="2"> |  | ||||||
|      <widget class="QLabel" name="squelchText"> |  | ||||||
|       <property name="minimumSize"> |       <property name="minimumSize"> | ||||||
|        <size> |        <size> | ||||||
|         <width>50</width> |         <width>32</width> | ||||||
|         <height>0</height> |         <height>16</height> | ||||||
|        </size> |        </size> | ||||||
|       </property> |       </property> | ||||||
|       <property name="text"> |       <property name="font"> | ||||||
|        <string>-40dB</string> |        <font> | ||||||
|  |         <family>Monospace</family> | ||||||
|  |         <pointsize>12</pointsize> | ||||||
|  |        </font> | ||||||
|       </property> |       </property> | ||||||
|       <property name="alignment"> |       <property name="focusPolicy"> | ||||||
|        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |        <enum>Qt::StrongFocus</enum> | ||||||
|       </property> |       </property> | ||||||
|      </widget> |  | ||||||
|     </item> |  | ||||||
|     <item row="0" column="0"> |  | ||||||
|      <widget class="QLabel" name="flabel"> |  | ||||||
|       <property name="text"> |  | ||||||
|        <string>df (Hz)</string> |  | ||||||
|       </property> |  | ||||||
|      </widget> |  | ||||||
|     </item> |  | ||||||
|     <item row="0" column="1"> |  | ||||||
|      <widget class="QLCDNumber" name="fcenter"> |  | ||||||
|       <property name="toolTip"> |       <property name="toolTip"> | ||||||
|        <string><html><head/><body><p>Frequency shift from center frequency</p></body></html></string> |        <string>Demod shift frequency from center in Hz</string> | ||||||
|       </property> |       </property> | ||||||
|       <property name="smallDecimalPoint"> |      </widget> | ||||||
|        <bool>true</bool> |     </item> | ||||||
|       </property> |     <item row="0" column="2"> | ||||||
|       <property name="digitCount"> |      <widget class="QLabel" name="deltaUnits"> | ||||||
|        <number>7</number> |       <property name="text"> | ||||||
|       </property> |        <string>Hz</string> | ||||||
|       <property name="segmentStyle"> |  | ||||||
|        <enum>QLCDNumber::Flat</enum> |  | ||||||
|       </property> |       </property> | ||||||
|      </widget> |      </widget> | ||||||
|     </item> |     </item> | ||||||
| @ -292,6 +314,12 @@ | |||||||
|    <header>gui/rollupwidget.h</header> |    <header>gui/rollupwidget.h</header> | ||||||
|    <container>1</container> |    <container>1</container> | ||||||
|   </customwidget> |   </customwidget> | ||||||
|  |   <customwidget> | ||||||
|  |    <class>ValueDial</class> | ||||||
|  |    <extends>QWidget</extends> | ||||||
|  |    <header>gui/valuedial.h</header> | ||||||
|  |    <container>1</container> | ||||||
|  |   </customwidget> | ||||||
|  </customwidgets> |  </customwidgets> | ||||||
|  <resources/> |  <resources/> | ||||||
|  <connections/> |  <connections/> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user