1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

SDRPlay plugin: use mixer buffer gain in AM bands in place of LNA

This commit is contained in:
f4exb 2016-11-19 23:25:57 +01:00
parent f7b52cfcc6
commit 0a618e9f0b

View File

@ -236,7 +236,7 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
forceGainSetting = true;
}
if (m_settings.m_tunerGainMode)
if (m_settings.m_tunerGainMode) // auto
{
if ((m_settings.m_tunerGain != settings.m_tunerGain) || forceGainSetting)
{
@ -252,24 +252,52 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
}
else
{
int lnaGain;
if (m_settings.m_frequencyBandIndex < 3) // bands using AM mode
{
lnaGain = mirisdr_get_mixbuffer_gain(m_dev);
}
else
{
lnaGain = mirisdr_get_lna_gain(m_dev);
}
MsgReportSDRPlayGains *message = MsgReportSDRPlayGains::create(
mirisdr_get_lna_gain(m_dev),
lnaGain,
mirisdr_get_mixer_gain(m_dev),
mirisdr_get_baseband_gain(m_dev),
mirisdr_get_tuner_gain(m_dev)
);
getOutputMessageQueueToGUI()->push(message);
}
}
}
}
else
else // manual
{
bool anyChange = false;
if ((m_settings.m_lnaOn != settings.m_lnaOn) || forceGainSetting)
{
if(m_dev != 0)
{
if (m_settings.m_frequencyBandIndex < 3) // bands using AM mode
{
int r = mirisdr_set_mixbuffer_gain(m_dev, settings.m_lnaOn ? 0 : 1); // mirisdr_set_mixbuffer_gain takes gain reduction
if (r != 0)
{
qDebug("SDRPlayInput::applySettings: could not set mixer buffer gain");
}
else
{
m_settings.m_lnaOn = settings.m_lnaOn;
anyChange = true;
}
}
else
{
int r = mirisdr_set_lna_gain(m_dev, settings.m_lnaOn ? 0 : 1); // mirisdr_set_lna_gain takes gain reduction
@ -284,6 +312,7 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
}
}
}
}
if ((m_settings.m_mixerAmpOn != settings.m_mixerAmpOn) || forceGainSetting)
{
@ -323,8 +352,19 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
if (anyChange)
{
int lnaGain;
if (m_settings.m_frequencyBandIndex < 3) // bands using AM mode
{
lnaGain = mirisdr_get_mixbuffer_gain(m_dev);
}
else
{
mirisdr_get_lna_gain(m_dev);
}
MsgReportSDRPlayGains *message = MsgReportSDRPlayGains::create(
mirisdr_get_lna_gain(m_dev),
lnaGain,
mirisdr_get_mixer_gain(m_dev),
mirisdr_get_baseband_gain(m_dev),
mirisdr_get_tuner_gain(m_dev)