1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

AFC: fixed channel tracking

This commit is contained in:
f4exb 2020-10-26 00:39:25 +01:00
parent 573aa9b559
commit 797bbdbac5

View File

@ -287,20 +287,20 @@ void AFCWorker::processChannelSettings(
if (WebAPIUtils::extractValue(*jsonObj, "inputFrequencyOffset", channelOffsetValue)) if (WebAPIUtils::extractValue(*jsonObj, "inputFrequencyOffset", channelOffsetValue))
{ {
int channelOffset = channelOffsetValue.toInt();
if (*swgChannelSettings->getChannelType() == "FreqTracker") if (*swgChannelSettings->getChannelType() == "FreqTracker")
{ {
if (channelOffset != m_trackerChannelOffset) int trackerChannelOffset = channelOffsetValue.toInt();
if (trackerChannelOffset != m_trackerChannelOffset)
{ {
qDebug("AFCWorker::processChannelSettings: FreqTracker offset change: %d", channelOffset); qDebug("AFCWorker::processChannelSettings: FreqTracker offset change: %d", trackerChannelOffset);
QMap<ChannelAPI*, ChannelTracking>::iterator it = m_channelsMap.begin(); QMap<ChannelAPI*, ChannelTracking>::iterator it = m_channelsMap.begin();
for (; it != m_channelsMap.end(); ++it) for (; it != m_channelsMap.end(); ++it)
{ {
if (mainCore->existsChannel(it.key())) if (mainCore->existsChannel(it.key()))
{ {
int channelOffset = it.value().m_channelOffset + channelOffset - it.value().m_trackerOffset; int channelOffset = it.value().m_channelOffset + trackerChannelOffset - it.value().m_trackerOffset;
updateChannelOffset(it.key(), it.value().m_channelDirection, channelOffset); updateChannelOffset(it.key(), it.value().m_channelDirection, channelOffset);
} }
else else
@ -309,12 +309,10 @@ void AFCWorker::processChannelSettings(
} }
} }
m_trackerChannelOffset = channelOffset; m_trackerChannelOffset = trackerChannelOffset;
} }
} }
else if (m_channelsMap.contains(const_cast<ChannelAPI*>(channelAPI))) else if (m_channelsMap.contains(const_cast<ChannelAPI*>(channelAPI)))
{
if (WebAPIUtils::extractValue(*jsonObj, "inputFrequencyOffset", channelOffsetValue))
{ {
int channelOffset = channelOffsetValue.toInt(); int channelOffset = channelOffsetValue.toInt();
m_channelsMap[const_cast<ChannelAPI*>(channelAPI)].m_channelOffset = channelOffset; m_channelsMap[const_cast<ChannelAPI*>(channelAPI)].m_channelOffset = channelOffset;
@ -322,7 +320,6 @@ void AFCWorker::processChannelSettings(
} }
} }
} }
}
bool AFCWorker::updateChannelOffset(ChannelAPI *channelAPI, int direction, int offset, unsigned int blockCount) bool AFCWorker::updateChannelOffset(ChannelAPI *channelAPI, int direction, int offset, unsigned int blockCount)
{ {