mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 13:11:20 -05:00 
			
		
		
		
	ATV Demod: pass modulation type in the RF config
This commit is contained in:
		
							parent
							
								
									822610074d
								
							
						
					
					
						commit
						24d0e6a770
					
				@ -103,12 +103,14 @@ void ATVDemod::configureRF(
 | 
			
		||||
        MessageQueue* objMessageQueue,
 | 
			
		||||
        ATVModulation enmModulation,
 | 
			
		||||
        float fltRFBandwidth,
 | 
			
		||||
        float fltRFOppBandwidth)
 | 
			
		||||
        float fltRFOppBandwidth,
 | 
			
		||||
        bool blnFFTFiltering)
 | 
			
		||||
{
 | 
			
		||||
    Message* msgCmd = MsgConfigureRFATVDemod::create(
 | 
			
		||||
            enmModulation,
 | 
			
		||||
            fltRFBandwidth,
 | 
			
		||||
            fltRFOppBandwidth);
 | 
			
		||||
            fltRFOppBandwidth,
 | 
			
		||||
            blnFFTFiltering);
 | 
			
		||||
    objMessageQueue->push(msgCmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -188,7 +190,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
			
		||||
 | 
			
		||||
        fltNorm = sqrt(magSq);
 | 
			
		||||
 | 
			
		||||
        if ((m_objRunning.m_enmModulation == ATV_FM1) || (m_objRunning.m_enmModulation == ATV_FM2))
 | 
			
		||||
        if ((m_objRFRunning.m_enmModulation == ATV_FM1) || (m_objRFRunning.m_enmModulation == ATV_FM2))
 | 
			
		||||
        {
 | 
			
		||||
            //Amplitude FM
 | 
			
		||||
 | 
			
		||||
@ -198,7 +200,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
			
		||||
            //-2 > 2 : 0 -> 1 volt
 | 
			
		||||
            //0->0.3 synchro  0.3->1 image
 | 
			
		||||
 | 
			
		||||
            if (m_objRunning.m_enmModulation == ATV_FM1)
 | 
			
		||||
            if (m_objRFRunning.m_enmModulation == ATV_FM1)
 | 
			
		||||
            {
 | 
			
		||||
                //YDiff Cd
 | 
			
		||||
                fltVal = m_fltBufferI[0]*(fltNormQ - m_fltBufferQ[1]);
 | 
			
		||||
@ -237,7 +239,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
			
		||||
            m_fltBufferQ[0]=fltNormQ;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        else if ((m_objRunning.m_enmModulation == ATV_AM) || (m_objRunning.m_enmModulation == ATV_VAMU) || (m_objRunning.m_enmModulation == ATV_VAML))
 | 
			
		||||
        else if ((m_objRFRunning.m_enmModulation == ATV_AM) || (m_objRFRunning.m_enmModulation == ATV_VAMU) || (m_objRFRunning.m_enmModulation == ATV_VAML))
 | 
			
		||||
        {
 | 
			
		||||
            //Amplitude AM
 | 
			
		||||
            fltVal = fltNorm;
 | 
			
		||||
@ -423,7 +425,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
			
		||||
 | 
			
		||||
                m_intRowsLimit = m_intNumberOfLines-1;
 | 
			
		||||
 | 
			
		||||
                if (m_objRunning.m_enmModulation == ATV_AM)
 | 
			
		||||
                if (m_objRFRunning.m_enmModulation == ATV_AM)
 | 
			
		||||
                {
 | 
			
		||||
                    m_fltAmpMin=m_fltEffMin;
 | 
			
		||||
                    m_fltAmpMax=m_fltEffMax;
 | 
			
		||||
@ -520,6 +522,22 @@ bool ATVDemod::handleMessage(const Message& cmd)
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    else if (MsgConfigureRFATVDemod::match(cmd))
 | 
			
		||||
    {
 | 
			
		||||
        MsgConfigureRFATVDemod& objCfg = (MsgConfigureRFATVDemod&) cmd;
 | 
			
		||||
 | 
			
		||||
        m_objRFConfig = objCfg.m_objMsgConfig;
 | 
			
		||||
 | 
			
		||||
        qDebug()  << "ATVDemod::handleMessage: MsgConfigureRFATVDemod:"
 | 
			
		||||
                << " m_enmModulation" << m_objRFConfig.m_enmModulation
 | 
			
		||||
                << " m_fltRFBandwidth" << m_objRFConfig.m_fltRFBandwidth
 | 
			
		||||
                << " m_fltRFOppBandwidth" << m_objRFConfig.m_fltRFOppBandwidth
 | 
			
		||||
                << " m_blnFFTFiltering" << m_objRFConfig.m_blnFFTFiltering;
 | 
			
		||||
 | 
			
		||||
        applySettings();
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        return false;
 | 
			
		||||
@ -567,6 +585,8 @@ void ATVDemod::applySettings()
 | 
			
		||||
    m_objRunning.m_fltRatioOfRowsToDisplay = m_objConfig.m_fltRatioOfRowsToDisplay;
 | 
			
		||||
    m_objRunning.m_blnHSync = m_objConfig.m_blnHSync;
 | 
			
		||||
    m_objRunning.m_blnVSync = m_objConfig.m_blnVSync;
 | 
			
		||||
 | 
			
		||||
    m_objRFRunning = m_objRFConfig;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ATVDemod::getSampleRate()
 | 
			
		||||
 | 
			
		||||
@ -81,11 +81,13 @@ public:
 | 
			
		||||
        ATVModulation m_enmModulation;
 | 
			
		||||
        float         m_fltRFBandwidth;
 | 
			
		||||
        float         m_fltRFOppBandwidth;
 | 
			
		||||
        bool          m_blnFFTFiltering;
 | 
			
		||||
 | 
			
		||||
        ATVRFConfig() :
 | 
			
		||||
            m_enmModulation(ATV_FM1),
 | 
			
		||||
            m_fltRFBandwidth(0),
 | 
			
		||||
            m_fltRFOppBandwidth(0)
 | 
			
		||||
            m_fltRFOppBandwidth(0),
 | 
			
		||||
            m_blnFFTFiltering(false)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
@ -107,7 +109,8 @@ public:
 | 
			
		||||
    void configureRF(MessageQueue* objMessageQueue,
 | 
			
		||||
            ATVModulation enmModulation,
 | 
			
		||||
            float fltRFBandwidth,
 | 
			
		||||
            float fltRFOppBandwidth);
 | 
			
		||||
            float fltRFOppBandwidth,
 | 
			
		||||
            bool blnFFTFiltering);
 | 
			
		||||
 | 
			
		||||
	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
 | 
			
		||||
	virtual void start();
 | 
			
		||||
@ -183,12 +186,14 @@ private:
 | 
			
		||||
            static MsgConfigureRFATVDemod* create(
 | 
			
		||||
                    ATVModulation enmModulation,
 | 
			
		||||
                    float fltRFBandwidth,
 | 
			
		||||
                    float fltRFOppBandwidth)
 | 
			
		||||
                    float fltRFOppBandwidth,
 | 
			
		||||
                    bool blnFFTFiltering)
 | 
			
		||||
            {
 | 
			
		||||
                return new MsgConfigureRFATVDemod(
 | 
			
		||||
                        enmModulation,
 | 
			
		||||
                        fltRFBandwidth,
 | 
			
		||||
                        fltRFOppBandwidth);
 | 
			
		||||
                        fltRFOppBandwidth,
 | 
			
		||||
                        blnFFTFiltering);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            ATVRFConfig m_objMsgConfig;
 | 
			
		||||
@ -197,12 +202,14 @@ private:
 | 
			
		||||
            MsgConfigureRFATVDemod(
 | 
			
		||||
                    ATVModulation enmModulation,
 | 
			
		||||
                    float fltRFBandwidth,
 | 
			
		||||
                    float fltRFOppBandwidth) :
 | 
			
		||||
                    float fltRFOppBandwidth,
 | 
			
		||||
                    bool blnFFTFiltering) :
 | 
			
		||||
                Message()
 | 
			
		||||
            {
 | 
			
		||||
                m_objMsgConfig.m_enmModulation = enmModulation;
 | 
			
		||||
                m_objMsgConfig.m_fltRFBandwidth = fltRFBandwidth;
 | 
			
		||||
                m_objMsgConfig.m_fltRFOppBandwidth = fltRFOppBandwidth;
 | 
			
		||||
                m_objMsgConfig.m_blnFFTFiltering = blnFFTFiltering;
 | 
			
		||||
            }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -249,6 +256,9 @@ private:
 | 
			
		||||
    ATVConfig m_objRunning;
 | 
			
		||||
    ATVConfig m_objConfig;
 | 
			
		||||
 | 
			
		||||
    ATVRFConfig m_objRFRunning;
 | 
			
		||||
    ATVRFConfig m_objRFConfig;
 | 
			
		||||
 | 
			
		||||
    QMutex m_objSettingsMutex;
 | 
			
		||||
 | 
			
		||||
    static const float m_fltSecondToUs;
 | 
			
		||||
 | 
			
		||||
@ -298,6 +298,18 @@ void ATVDemodGUI::applySettings()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::applyRFSettings()
 | 
			
		||||
{
 | 
			
		||||
    if (m_blnDoApplySettings)
 | 
			
		||||
    {
 | 
			
		||||
        m_objATVDemod->configureRF(m_objATVDemod->getInputMessageQueue(),
 | 
			
		||||
                (ATVDemod::ATVModulation) ui->modulation->currentIndex(),
 | 
			
		||||
                ui->rfBW->value() * 100000.0f,
 | 
			
		||||
                ui->rfOppBW->value() * 100000.0f,
 | 
			
		||||
                ui->rfFFTFiltering->isChecked());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::leaveEvent(QEvent*)
 | 
			
		||||
{
 | 
			
		||||
    blockApplySettings(true);
 | 
			
		||||
@ -372,11 +384,6 @@ void ATVDemodGUI::on_halfImage_clicked()
 | 
			
		||||
    applySettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::on_modulation_currentIndexChanged(int index)
 | 
			
		||||
{
 | 
			
		||||
    applySettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::on_fps_currentIndexChanged(int index)
 | 
			
		||||
{
 | 
			
		||||
    applySettings();
 | 
			
		||||
@ -386,3 +393,25 @@ void ATVDemodGUI::on_reset_clicked(bool checked)
 | 
			
		||||
{
 | 
			
		||||
    resetToDefaults();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::on_modulation_currentIndexChanged(int index)
 | 
			
		||||
{
 | 
			
		||||
    applyRFSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::on_rfBW_valueChanged(int value)
 | 
			
		||||
{
 | 
			
		||||
    ui->rfBWText->setText(QString("%1 MHz").arg(value / 10.0, 0, 'f', 1));
 | 
			
		||||
    applyRFSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::on_rfOppBW_valueChanged(int value)
 | 
			
		||||
{
 | 
			
		||||
    ui->rfOppBWText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
 | 
			
		||||
    applyRFSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATVDemodGUI::on_rfFFTFiltering_toggled(bool checked)
 | 
			
		||||
{
 | 
			
		||||
    applyRFSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -72,6 +72,9 @@ private slots:
 | 
			
		||||
    void on_modulation_currentIndexChanged(int index);
 | 
			
		||||
    void on_fps_currentIndexChanged(int index);
 | 
			
		||||
    void on_reset_clicked(bool checked);
 | 
			
		||||
    void on_rfBW_valueChanged(int value);
 | 
			
		||||
    void on_rfOppBW_valueChanged(int value);
 | 
			
		||||
    void on_rfFFTFiltering_toggled(bool checked);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	Ui::ATVDemodGUI* ui;
 | 
			
		||||
@ -92,6 +95,7 @@ private:
 | 
			
		||||
 | 
			
		||||
    void blockApplySettings(bool blnBlock);
 | 
			
		||||
	void applySettings();
 | 
			
		||||
    void applyRFSettings();
 | 
			
		||||
 | 
			
		||||
	void leaveEvent(QEvent*);
 | 
			
		||||
	void enterEvent(QEvent*);
 | 
			
		||||
 | 
			
		||||
@ -187,7 +187,7 @@
 | 
			
		||||
    <item>
 | 
			
		||||
     <layout class="QHBoxLayout" name="rfSettings2Layout">
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="ButtonSwitch" name="toolButton">
 | 
			
		||||
       <widget class="ButtonSwitch" name="rfFFTFiltering">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string/>
 | 
			
		||||
        </property>
 | 
			
		||||
@ -195,6 +195,9 @@
 | 
			
		||||
         <iconset resource="../../../sdrbase/resources/res.qrc">
 | 
			
		||||
          <normaloff>:/filter_bandpass.png</normaloff>:/filter_bandpass.png</iconset>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="checkable">
 | 
			
		||||
         <bool>true</bool>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
@ -238,6 +241,9 @@
 | 
			
		||||
        <property name="maximum">
 | 
			
		||||
         <number>100</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="pageStep">
 | 
			
		||||
         <number>1</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="value">
 | 
			
		||||
         <number>10</number>
 | 
			
		||||
        </property>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user