mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-26 02:20: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); | ||||
| } | ||||
| 
 | ||||
| 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); | ||||
| } | ||||
| 
 | ||||
| @ -123,17 +129,23 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto | ||||
| 			m_m2Sample = m_m1Sample; | ||||
| 			m_m1Sample = rf[i]; | ||||
| 
 | ||||
| 			if (!m_running.m_showPilot) | ||||
| 			{ | ||||
| 				m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0)); | ||||
| 			} | ||||
| 
 | ||||
| 			Real sampleStereo; | ||||
| 
 | ||||
| 			// Process stereo if stereo mode is selected
 | ||||
| 
 | ||||
| 			if (m_running.m_audioStereo) | ||||
| 			{ | ||||
| 				//Real pilotSample;
 | ||||
| 				//m_pilotPLL.process(demod, pilotSample);
 | ||||
| 				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); | ||||
| 
 | ||||
| @ -243,6 +255,7 @@ bool BFMDemod::handleMessage(const Message& cmd) | ||||
| 		m_config.m_volume = cfg.getVolume(); | ||||
| 		m_config.m_squelch = cfg.getSquelch(); | ||||
| 		m_config.m_audioStereo = cfg.getAudioStereo(); | ||||
| 		m_config.m_showPilot = cfg.getShowPilot(); | ||||
| 
 | ||||
| 		apply(); | ||||
| 
 | ||||
| @ -250,7 +263,8 @@ bool BFMDemod::handleMessage(const Message& cmd) | ||||
| 				<< " m_afBandwidth: " << m_config.m_afBandwidth | ||||
| 				<< " m_volume: " << m_config.m_volume | ||||
| 				<< " 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; | ||||
| 	} | ||||
| @ -341,5 +355,6 @@ void BFMDemod::apply() | ||||
| 	m_running.m_volume = m_config.m_volume; | ||||
| 	m_running.m_audioSampleRate = m_config.m_audioSampleRate; | ||||
| 	m_running.m_audioStereo = m_config.m_audioStereo; | ||||
| 	m_running.m_showPilot = m_config.m_showPilot; | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -38,7 +38,13 @@ public: | ||||
| 	BFMDemod(SampleSink* sampleSink); | ||||
| 	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; } | ||||
| 	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 getSquelch() const { return m_squelch; } | ||||
| 		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: | ||||
| @ -72,14 +84,21 @@ private: | ||||
| 		Real m_volume; | ||||
| 		Real m_squelch; | ||||
| 		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(), | ||||
| 			m_rfBandwidth(rfBandwidth), | ||||
| 			m_afBandwidth(afBandwidth), | ||||
| 			m_volume(volume), | ||||
| 			m_squelch(squelch), | ||||
| 			m_audioStereo(audioStereo) | ||||
| 			m_audioStereo(audioStereo), | ||||
| 			m_showPilot(showPilot) | ||||
| 		{ } | ||||
| 	}; | ||||
| 
 | ||||
| @ -103,6 +122,7 @@ private: | ||||
| 		Real m_volume; | ||||
| 		quint32 m_audioSampleRate; | ||||
| 		bool m_audioStereo; | ||||
| 		bool m_showPilot; | ||||
| 
 | ||||
| 		Config() : | ||||
| 			m_inputSampleRate(-1), | ||||
| @ -112,7 +132,8 @@ private: | ||||
| 			m_squelch(0), | ||||
| 			m_volume(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(); | ||||
| } | ||||
| 
 | ||||
| void BFMDemodGUI::on_showPilot_clicked() | ||||
| { | ||||
| 	applySettings(); | ||||
| } | ||||
| 
 | ||||
| void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) | ||||
| { | ||||
| } | ||||
| @ -325,7 +330,8 @@ void BFMDemodGUI::applySettings() | ||||
| 			ui->afBW->value() * 1000.0, | ||||
| 			ui->volume->value() / 10.0, | ||||
| 			ui->squelch->value(), | ||||
| 			ui->audioStereo->isChecked()); | ||||
| 			ui->audioStereo->isChecked(), | ||||
| 			ui->showPilot->isChecked()); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @ -349,6 +355,11 @@ void BFMDemodGUI::tick() | ||||
| 	m_channelPowerDbAvg.feed(powDb); | ||||
| 	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 (ui->audioStereo->isChecked()) | ||||
|  | ||||
| @ -62,6 +62,7 @@ private slots: | ||||
| 	void on_volume_valueChanged(int value); | ||||
| 	void on_squelch_valueChanged(int value); | ||||
| 	void on_audioStereo_toggled(bool stereo); | ||||
| 	void on_showPilot_clicked(); | ||||
| 	void onWidgetRolled(QWidget* widget, bool rollDown); | ||||
| 	void onMenuDoubleClicked(); | ||||
| 	void tick(); | ||||
|  | ||||
| @ -6,7 +6,7 @@ | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>252</width> | ||||
|     <width>308</width> | ||||
|     <height>333</height> | ||||
|    </rect> | ||||
|   </property> | ||||
| @ -21,7 +21,7 @@ | ||||
|     <rect> | ||||
|      <x>10</x> | ||||
|      <y>20</y> | ||||
|      <width>235</width> | ||||
|      <width>281</width> | ||||
|      <height>121</height> | ||||
|     </rect> | ||||
|    </property> | ||||
| @ -160,6 +160,49 @@ | ||||
|           </property> | ||||
|          </widget> | ||||
|         </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> | ||||
|       </item> | ||||
|      </layout> | ||||
| @ -343,8 +386,8 @@ | ||||
|     <rect> | ||||
|      <x>10</x> | ||||
|      <y>160</y> | ||||
|      <width>231</width> | ||||
|      <height>156</height> | ||||
|      <width>281</width> | ||||
|      <height>151</height> | ||||
|     </rect> | ||||
|    </property> | ||||
|    <property name="windowTitle"> | ||||
| @ -376,6 +419,11 @@ | ||||
|   </widget> | ||||
|  </widget> | ||||
|  <customwidgets> | ||||
|   <customwidget> | ||||
|    <class>ButtonSwitch</class> | ||||
|    <extends>QToolButton</extends> | ||||
|    <header>gui/buttonswitch.h</header> | ||||
|   </customwidget> | ||||
|   <customwidget> | ||||
|    <class>RollupWidget</class> | ||||
|    <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>flip_lr.png</file> | ||||
|         <file>flip_rl.png</file> | ||||
|         <file>carrier.png</file> | ||||
|     </qresource> | ||||
| </RCC> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user