kopia lustrzana https://github.com/f4exb/sdrangel
				
				
				
			AirspyHF: implemented LO ppm correction
							rodzic
							
								
									a793a74dd2
								
							
						
					
					
						commit
						dd67b95fcd
					
				| 
						 | 
				
			
			@ -217,9 +217,9 @@ void AirspyHFGui::displaySettings()
 | 
			
		|||
    ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
 | 
			
		||||
    ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode);
 | 
			
		||||
	ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
 | 
			
		||||
 | 
			
		||||
	ui->LOppm->setValue(m_settings.m_LOppmTenths);
 | 
			
		||||
	ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
 | 
			
		||||
	ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
 | 
			
		||||
 | 
			
		||||
	ui->decim->setCurrentIndex(m_settings.m_log2Decim);
 | 
			
		||||
    ui->band->blockSignals(false);
 | 
			
		||||
    blockApplySettings(false);
 | 
			
		||||
| 
						 | 
				
			
			@ -265,6 +265,18 @@ void AirspyHFGui::on_centerFrequency_changed(quint64 value)
 | 
			
		|||
	sendSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AirspyHFGui::on_LOppm_valueChanged(int value)
 | 
			
		||||
{
 | 
			
		||||
    m_settings.m_LOppmTenths = value;
 | 
			
		||||
    ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
 | 
			
		||||
    sendSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AirspyHFGui::on_resetLOppm_clicked()
 | 
			
		||||
{
 | 
			
		||||
    ui->LOppm->setValue(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AirspyHFGui::on_sampleRate_currentIndexChanged(int index)
 | 
			
		||||
{
 | 
			
		||||
	m_settings.m_devSampleRateIndex = index;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,6 +77,8 @@ private:
 | 
			
		|||
 | 
			
		||||
private slots:
 | 
			
		||||
	void on_centerFrequency_changed(quint64 value);
 | 
			
		||||
    void on_LOppm_valueChanged(int value);
 | 
			
		||||
    void on_resetLOppm_clicked();
 | 
			
		||||
	void on_sampleRate_currentIndexChanged(int index);
 | 
			
		||||
	void on_decim_currentIndexChanged(int index);
 | 
			
		||||
	void on_startStop_toggled(bool checked);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@
 | 
			
		|||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>324</width>
 | 
			
		||||
    <height>120</height>
 | 
			
		||||
    <height>132</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="sizePolicy">
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@
 | 
			
		|||
  <property name="minimumSize">
 | 
			
		||||
   <size>
 | 
			
		||||
    <width>320</width>
 | 
			
		||||
    <height>120</height>
 | 
			
		||||
    <height>132</height>
 | 
			
		||||
   </size>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="font">
 | 
			
		||||
| 
						 | 
				
			
			@ -172,6 +172,71 @@
 | 
			
		|||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="loCorrectionLayout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="LOppmLabel">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>LO ppm</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QSlider" name="LOppm">
 | 
			
		||||
       <property name="toolTip">
 | 
			
		||||
        <string>Local Oscillator ppm correction</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="minimum">
 | 
			
		||||
        <number>-100</number>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="maximum">
 | 
			
		||||
        <number>100</number>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="pageStep">
 | 
			
		||||
        <number>1</number>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Horizontal</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="LOppmText">
 | 
			
		||||
       <property name="minimumSize">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>36</width>
 | 
			
		||||
         <height>0</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="toolTip">
 | 
			
		||||
        <string>LO correction value (ppm)</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>-00.0</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="alignment">
 | 
			
		||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QPushButton" name="resetLOppm">
 | 
			
		||||
       <property name="maximumSize">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>24</width>
 | 
			
		||||
         <height>16777215</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="toolTip">
 | 
			
		||||
        <string>Rest LO ppm correction</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>R</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="Line" name="line_freq">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
| 
						 | 
				
			
			@ -190,10 +255,10 @@
 | 
			
		|||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QComboBox" name="band">
 | 
			
		||||
       <property name="maximumSize">
 | 
			
		||||
       <property name="minimumSize">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>50</width>
 | 
			
		||||
         <height>16777215</height>
 | 
			
		||||
         <width>56</width>
 | 
			
		||||
         <height>0</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="toolTip">
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +412,7 @@
 | 
			
		|||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="paddingLayout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <spacer name="verticalPaddingSpacer">
 | 
			
		||||
      <spacer name="verticalSpacer">
 | 
			
		||||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Vertical</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -384,6 +384,23 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
 | 
			
		||||
	{
 | 
			
		||||
	    if (m_dev != 0)
 | 
			
		||||
	    {
 | 
			
		||||
	        rc = (airspyhf_error) airspyhf_set_calibration(m_dev, settings.m_LOppmTenths * 100);
 | 
			
		||||
 | 
			
		||||
	        if (rc != AIRSPYHF_SUCCESS)
 | 
			
		||||
            {
 | 
			
		||||
                qCritical("AirspyHFInput::applySettings: could not set LO ppm correction to %f", settings.m_LOppmTenths / 10.0f);
 | 
			
		||||
            }
 | 
			
		||||
            else if (m_airspyHFThread != 0)
 | 
			
		||||
            {
 | 
			
		||||
                qDebug("AirspyHFInput::applySettings: LO ppm correction set to %f", settings.m_LOppmTenths / 10.0f);
 | 
			
		||||
            }
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
 | 
			
		||||
	        || (m_settings.m_transverterMode != settings.m_transverterMode)
 | 
			
		||||
	        || (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,7 @@ AirspyHFSettings::AirspyHFSettings()
 | 
			
		|||
void AirspyHFSettings::resetToDefaults()
 | 
			
		||||
{
 | 
			
		||||
	m_centerFrequency = 7150*1000;
 | 
			
		||||
	m_LOppmTenths = 0;
 | 
			
		||||
	m_devSampleRateIndex = 0;
 | 
			
		||||
	m_log2Decim = 0;
 | 
			
		||||
    m_transverterMode = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +39,7 @@ QByteArray AirspyHFSettings::serialize() const
 | 
			
		|||
	SimpleSerializer s(1);
 | 
			
		||||
 | 
			
		||||
	s.writeU32(1, m_devSampleRateIndex);
 | 
			
		||||
	s.writeS32(2, m_LOppmTenths);
 | 
			
		||||
	s.writeU32(3, m_log2Decim);
 | 
			
		||||
    s.writeBool(7, m_transverterMode);
 | 
			
		||||
    s.writeS64(8, m_transverterDeltaFrequency);
 | 
			
		||||
| 
						 | 
				
			
			@ -62,6 +64,7 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
 | 
			
		|||
		quint32 uintval;
 | 
			
		||||
 | 
			
		||||
		d.readU32(1, &m_devSampleRateIndex, 0);
 | 
			
		||||
        d.readS32(2, &m_LOppmTenths, 0);
 | 
			
		||||
		d.readU32(3, &m_log2Decim, 0);
 | 
			
		||||
		d.readS32(4, &intval, 0);
 | 
			
		||||
        d.readBool(7, &m_transverterMode, false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@
 | 
			
		|||
struct AirspyHFSettings
 | 
			
		||||
{
 | 
			
		||||
	quint64 m_centerFrequency;
 | 
			
		||||
    qint32  m_LOppmTenths;
 | 
			
		||||
	quint32 m_devSampleRateIndex;
 | 
			
		||||
	quint32 m_log2Decim;
 | 
			
		||||
    bool m_transverterMode;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue