mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	BFM demod: added pilot view option and pilot power display
This commit is contained in:
		
							parent
							
								
									f300b675bf
								
							
						
					
					
						commit
						fa2d9aecf5
					
				| @ -69,9 +69,15 @@ BFMDemod::~BFMDemod() | |||||||
| 	DSPEngine::instance()->removeAudioSink(&m_audioFifo); | 	DSPEngine::instance()->removeAudioSink(&m_audioFifo); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void BFMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo) | void BFMDemod::configure(MessageQueue* messageQueue, | ||||||
|  | 		Real rfBandwidth, | ||||||
|  | 		Real afBandwidth, | ||||||
|  | 		Real volume, | ||||||
|  | 		Real squelch, | ||||||
|  | 		bool audioStereo, | ||||||
|  | 		bool showPilot) | ||||||
| { | { | ||||||
| 	Message* cmd = MsgConfigureBFMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioStereo); | 	Message* cmd = MsgConfigureBFMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioStereo, showPilot); | ||||||
| 	messageQueue->push(cmd); | 	messageQueue->push(cmd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -123,17 +129,23 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto | |||||||
| 			m_m2Sample = m_m1Sample; | 			m_m2Sample = m_m1Sample; | ||||||
| 			m_m1Sample = rf[i]; | 			m_m1Sample = rf[i]; | ||||||
| 
 | 
 | ||||||
|  | 			if (!m_running.m_showPilot) | ||||||
|  | 			{ | ||||||
| 				m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0)); | 				m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0)); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			Real sampleStereo; | 			Real sampleStereo; | ||||||
| 
 | 
 | ||||||
| 			// Process stereo if stereo mode is selected
 | 			// Process stereo if stereo mode is selected
 | ||||||
| 
 | 
 | ||||||
| 			if (m_running.m_audioStereo) | 			if (m_running.m_audioStereo) | ||||||
| 			{ | 			{ | ||||||
| 				//Real pilotSample;
 |  | ||||||
| 				//m_pilotPLL.process(demod, pilotSample);
 |  | ||||||
| 				m_pilotPLL.process(demod, m_pilotPLLSamples); | 				m_pilotPLL.process(demod, m_pilotPLLSamples); | ||||||
| 				//m_sampleBuffer.push_back(Sample(pilotSample * (1<<15), 0.0)); // debug pilot
 | 
 | ||||||
|  | 				if (m_running.m_showPilot) | ||||||
|  | 				{ | ||||||
|  | 					m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * (1<<15), 0.0)); // debug 38 kHz pilot
 | ||||||
|  | 				} | ||||||
| 
 | 
 | ||||||
| 				Complex s(demod*2.0*m_pilotPLLSamples[1], 0); | 				Complex s(demod*2.0*m_pilotPLLSamples[1], 0); | ||||||
| 
 | 
 | ||||||
| @ -243,6 +255,7 @@ bool BFMDemod::handleMessage(const Message& cmd) | |||||||
| 		m_config.m_volume = cfg.getVolume(); | 		m_config.m_volume = cfg.getVolume(); | ||||||
| 		m_config.m_squelch = cfg.getSquelch(); | 		m_config.m_squelch = cfg.getSquelch(); | ||||||
| 		m_config.m_audioStereo = cfg.getAudioStereo(); | 		m_config.m_audioStereo = cfg.getAudioStereo(); | ||||||
|  | 		m_config.m_showPilot = cfg.getShowPilot(); | ||||||
| 
 | 
 | ||||||
| 		apply(); | 		apply(); | ||||||
| 
 | 
 | ||||||
| @ -250,7 +263,8 @@ bool BFMDemod::handleMessage(const Message& cmd) | |||||||
| 				<< " m_afBandwidth: " << m_config.m_afBandwidth | 				<< " m_afBandwidth: " << m_config.m_afBandwidth | ||||||
| 				<< " m_volume: " << m_config.m_volume | 				<< " m_volume: " << m_config.m_volume | ||||||
| 				<< " m_squelch: " << m_config.m_squelch | 				<< " m_squelch: " << m_config.m_squelch | ||||||
| 				<< " m_audioStereo: " << m_config.m_audioStereo; | 				<< " m_audioStereo: " << m_config.m_audioStereo | ||||||
|  | 				<< " m_showPilot: " << m_config.m_showPilot; | ||||||
| 
 | 
 | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @ -341,5 +355,6 @@ void BFMDemod::apply() | |||||||
| 	m_running.m_volume = m_config.m_volume; | 	m_running.m_volume = m_config.m_volume; | ||||||
| 	m_running.m_audioSampleRate = m_config.m_audioSampleRate; | 	m_running.m_audioSampleRate = m_config.m_audioSampleRate; | ||||||
| 	m_running.m_audioStereo = m_config.m_audioStereo; | 	m_running.m_audioStereo = m_config.m_audioStereo; | ||||||
|  | 	m_running.m_showPilot = m_config.m_showPilot; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -38,7 +38,13 @@ public: | |||||||
| 	BFMDemod(SampleSink* sampleSink); | 	BFMDemod(SampleSink* sampleSink); | ||||||
| 	virtual ~BFMDemod(); | 	virtual ~BFMDemod(); | ||||||
| 
 | 
 | ||||||
| 	void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo); | 	void configure(MessageQueue* messageQueue, | ||||||
|  | 			Real rfBandwidth, | ||||||
|  | 			Real afBandwidth, | ||||||
|  | 			Real volume, | ||||||
|  | 			Real squelch, | ||||||
|  | 			bool audioStereo, | ||||||
|  | 			bool showPilot); | ||||||
| 
 | 
 | ||||||
| 	int getSampleRate() const { return m_config.m_inputSampleRate; } | 	int getSampleRate() const { return m_config.m_inputSampleRate; } | ||||||
| 	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); | 	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); | ||||||
| @ -60,10 +66,16 @@ private: | |||||||
| 		Real getVolume() const { return m_volume; } | 		Real getVolume() const { return m_volume; } | ||||||
| 		Real getSquelch() const { return m_squelch; } | 		Real getSquelch() const { return m_squelch; } | ||||||
| 		bool getAudioStereo() const { return m_audioStereo; } | 		bool getAudioStereo() const { return m_audioStereo; } | ||||||
|  | 		bool getShowPilot() const { return m_showPilot; } | ||||||
| 
 | 
 | ||||||
| 		static MsgConfigureBFMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo) | 		static MsgConfigureBFMDemod* create(Real rfBandwidth, | ||||||
|  | 				Real afBandwidth, | ||||||
|  | 				Real volume, | ||||||
|  | 				Real squelch, | ||||||
|  | 				bool audioStereo, | ||||||
|  | 				bool showPilot) | ||||||
| 		{ | 		{ | ||||||
| 			return new MsgConfigureBFMDemod(rfBandwidth, afBandwidth, volume, squelch, audioStereo); | 			return new MsgConfigureBFMDemod(rfBandwidth, afBandwidth, volume, squelch, audioStereo, showPilot); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	private: | 	private: | ||||||
| @ -72,14 +84,21 @@ private: | |||||||
| 		Real m_volume; | 		Real m_volume; | ||||||
| 		Real m_squelch; | 		Real m_squelch; | ||||||
| 		bool m_audioStereo; | 		bool m_audioStereo; | ||||||
|  | 		bool m_showPilot; | ||||||
| 
 | 
 | ||||||
| 		MsgConfigureBFMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo) : | 		MsgConfigureBFMDemod(Real rfBandwidth, | ||||||
|  | 				Real afBandwidth, | ||||||
|  | 				Real volume, | ||||||
|  | 				Real squelch, | ||||||
|  | 				bool audioStereo, | ||||||
|  | 				bool showPilot) : | ||||||
| 			Message(), | 			Message(), | ||||||
| 			m_rfBandwidth(rfBandwidth), | 			m_rfBandwidth(rfBandwidth), | ||||||
| 			m_afBandwidth(afBandwidth), | 			m_afBandwidth(afBandwidth), | ||||||
| 			m_volume(volume), | 			m_volume(volume), | ||||||
| 			m_squelch(squelch), | 			m_squelch(squelch), | ||||||
| 			m_audioStereo(audioStereo) | 			m_audioStereo(audioStereo), | ||||||
|  | 			m_showPilot(showPilot) | ||||||
| 		{ } | 		{ } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| @ -103,6 +122,7 @@ private: | |||||||
| 		Real m_volume; | 		Real m_volume; | ||||||
| 		quint32 m_audioSampleRate; | 		quint32 m_audioSampleRate; | ||||||
| 		bool m_audioStereo; | 		bool m_audioStereo; | ||||||
|  | 		bool m_showPilot; | ||||||
| 
 | 
 | ||||||
| 		Config() : | 		Config() : | ||||||
| 			m_inputSampleRate(-1), | 			m_inputSampleRate(-1), | ||||||
| @ -112,7 +132,8 @@ private: | |||||||
| 			m_squelch(0), | 			m_squelch(0), | ||||||
| 			m_volume(0), | 			m_volume(0), | ||||||
| 			m_audioSampleRate(0), | 			m_audioSampleRate(0), | ||||||
| 			m_audioStereo(false) | 			m_audioStereo(false), | ||||||
|  | 			m_showPilot(false) | ||||||
| 		{ } | 		{ } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -232,6 +232,11 @@ void BFMDemodGUI::on_audioStereo_toggled(bool stereo) | |||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void BFMDemodGUI::on_showPilot_clicked() | ||||||
|  | { | ||||||
|  | 	applySettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) | void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) | ||||||
| { | { | ||||||
| } | } | ||||||
| @ -325,7 +330,8 @@ void BFMDemodGUI::applySettings() | |||||||
| 			ui->afBW->value() * 1000.0, | 			ui->afBW->value() * 1000.0, | ||||||
| 			ui->volume->value() / 10.0, | 			ui->volume->value() / 10.0, | ||||||
| 			ui->squelch->value(), | 			ui->squelch->value(), | ||||||
| 			ui->audioStereo->isChecked()); | 			ui->audioStereo->isChecked(), | ||||||
|  | 			ui->showPilot->isChecked()); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -349,6 +355,11 @@ void BFMDemodGUI::tick() | |||||||
| 	m_channelPowerDbAvg.feed(powDb); | 	m_channelPowerDbAvg.feed(powDb); | ||||||
| 	ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1)); | 	ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1)); | ||||||
| 
 | 
 | ||||||
|  | 	Real pilotPowDb =  CalcDb::dbPower(m_bfmDemod->getPilotLevel()); | ||||||
|  | 	QString pilotPowDbStr; | ||||||
|  | 	pilotPowDbStr.sprintf("%+02.1f", pilotPowDb); | ||||||
|  | 	ui->pilotPower->setText(pilotPowDbStr); | ||||||
|  | 
 | ||||||
| 	if (m_bfmDemod->getPilotLock()) | 	if (m_bfmDemod->getPilotLock()) | ||||||
| 	{ | 	{ | ||||||
| 		if (ui->audioStereo->isChecked()) | 		if (ui->audioStereo->isChecked()) | ||||||
|  | |||||||
| @ -62,6 +62,7 @@ private slots: | |||||||
| 	void on_volume_valueChanged(int value); | 	void on_volume_valueChanged(int value); | ||||||
| 	void on_squelch_valueChanged(int value); | 	void on_squelch_valueChanged(int value); | ||||||
| 	void on_audioStereo_toggled(bool stereo); | 	void on_audioStereo_toggled(bool stereo); | ||||||
|  | 	void on_showPilot_clicked(); | ||||||
| 	void onWidgetRolled(QWidget* widget, bool rollDown); | 	void onWidgetRolled(QWidget* widget, bool rollDown); | ||||||
| 	void onMenuDoubleClicked(); | 	void onMenuDoubleClicked(); | ||||||
| 	void tick(); | 	void tick(); | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
|    <rect> |    <rect> | ||||||
|     <x>0</x> |     <x>0</x> | ||||||
|     <y>0</y> |     <y>0</y> | ||||||
|     <width>252</width> |     <width>308</width> | ||||||
|     <height>333</height> |     <height>333</height> | ||||||
|    </rect> |    </rect> | ||||||
|   </property> |   </property> | ||||||
| @ -21,7 +21,7 @@ | |||||||
|     <rect> |     <rect> | ||||||
|      <x>10</x> |      <x>10</x> | ||||||
|      <y>20</y> |      <y>20</y> | ||||||
|      <width>235</width> |      <width>281</width> | ||||||
|      <height>121</height> |      <height>121</height> | ||||||
|     </rect> |     </rect> | ||||||
|    </property> |    </property> | ||||||
| @ -160,6 +160,49 @@ | |||||||
|           </property> |           </property> | ||||||
|          </widget> |          </widget> | ||||||
|         </item> |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="ButtonSwitch" name="showPilot"> | ||||||
|  |           <property name="toolTip"> | ||||||
|  |            <string>Toggle demod/pilot spectrum display</string> | ||||||
|  |           </property> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string/> | ||||||
|  |           </property> | ||||||
|  |           <property name="icon"> | ||||||
|  |            <iconset resource="../../../sdrbase/resources/res.qrc"> | ||||||
|  |             <normaloff>:/carrier.png</normaloff>:/carrier.png</iconset> | ||||||
|  |           </property> | ||||||
|  |           <property name="checkable"> | ||||||
|  |            <bool>true</bool> | ||||||
|  |           </property> | ||||||
|  |           <property name="autoRaise"> | ||||||
|  |            <bool>true</bool> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="QLabel" name="pilotPower"> | ||||||
|  |           <property name="minimumSize"> | ||||||
|  |            <size> | ||||||
|  |             <width>30</width> | ||||||
|  |             <height>0</height> | ||||||
|  |            </size> | ||||||
|  |           </property> | ||||||
|  |           <property name="toolTip"> | ||||||
|  |            <string>Pilot power</string> | ||||||
|  |           </property> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string>0.0</string> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="QLabel" name="pilotPowerUnits"> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string>dB</string> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|        </layout> |        </layout> | ||||||
|       </item> |       </item> | ||||||
|      </layout> |      </layout> | ||||||
| @ -343,8 +386,8 @@ | |||||||
|     <rect> |     <rect> | ||||||
|      <x>10</x> |      <x>10</x> | ||||||
|      <y>160</y> |      <y>160</y> | ||||||
|      <width>231</width> |      <width>281</width> | ||||||
|      <height>156</height> |      <height>151</height> | ||||||
|     </rect> |     </rect> | ||||||
|    </property> |    </property> | ||||||
|    <property name="windowTitle"> |    <property name="windowTitle"> | ||||||
| @ -376,6 +419,11 @@ | |||||||
|   </widget> |   </widget> | ||||||
|  </widget> |  </widget> | ||||||
|  <customwidgets> |  <customwidgets> | ||||||
|  |   <customwidget> | ||||||
|  |    <class>ButtonSwitch</class> | ||||||
|  |    <extends>QToolButton</extends> | ||||||
|  |    <header>gui/buttonswitch.h</header> | ||||||
|  |   </customwidget> | ||||||
|   <customwidget> |   <customwidget> | ||||||
|    <class>RollupWidget</class> |    <class>RollupWidget</class> | ||||||
|    <extends>QWidget</extends> |    <extends>QWidget</extends> | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								sdrbase/resources/carrier.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrbase/resources/carrier.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 297 B | 
| @ -45,5 +45,6 @@ | |||||||
|         <file>usb.png</file> |         <file>usb.png</file> | ||||||
|         <file>flip_lr.png</file> |         <file>flip_lr.png</file> | ||||||
|         <file>flip_rl.png</file> |         <file>flip_rl.png</file> | ||||||
|  |         <file>carrier.png</file> | ||||||
|     </qresource> |     </qresource> | ||||||
| </RCC> | </RCC> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user