mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
AFC: fixed transverter correction
This commit is contained in:
parent
6f4f7910f1
commit
c6699562f4
@ -260,7 +260,7 @@ void AFCWorker::processChannelSettings(
|
|||||||
if (mainCore->existsChannel(it.key()))
|
if (mainCore->existsChannel(it.key()))
|
||||||
{
|
{
|
||||||
int channelOffset = it.value().m_channelOffset + m_trackerChannelOffset - it.value().m_trackerOffset;
|
int channelOffset = it.value().m_channelOffset + m_trackerChannelOffset - it.value().m_trackerOffset;
|
||||||
updateChannelOffset(it.key(),it.value().m_channelDirection, channelOffset);
|
updateChannelOffset(it.key(), it.value().m_channelDirection, channelOffset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -286,7 +286,7 @@ void AFCWorker::processChannelSettings(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFCWorker::updateChannelOffset(ChannelAPI *channelAPI, int direction, int offset)
|
bool AFCWorker::updateChannelOffset(ChannelAPI *channelAPI, int direction, int offset)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGChannelSettings swgChannelSettings;
|
SWGSDRangel::SWGChannelSettings swgChannelSettings;
|
||||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||||
@ -315,9 +315,13 @@ void AFCWorker::updateChannelOffset(ChannelAPI *channelAPI, int direction, int o
|
|||||||
errorResponse
|
errorResponse
|
||||||
);
|
);
|
||||||
|
|
||||||
if (httpRC / 100 != 2) {
|
if (httpRC / 100 != 2)
|
||||||
|
{
|
||||||
qDebug() << "AFCWorker::updateChannelOffset: error code" << httpRC << ":" << *errorResponse.getMessage();
|
qDebug() << "AFCWorker::updateChannelOffset: error code" << httpRC << ":" << *errorResponse.getMessage();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFCWorker::updateTarget()
|
void AFCWorker::updateTarget()
|
||||||
@ -364,6 +368,7 @@ void AFCWorker::updateTarget()
|
|||||||
QJsonObject *jsonObj = resDevice.asJsonObject();
|
QJsonObject *jsonObj = resDevice.asJsonObject();
|
||||||
QJsonValue xverterFrequencyValue;
|
QJsonValue xverterFrequencyValue;
|
||||||
|
|
||||||
|
// adjust transverter
|
||||||
if (WebAPIUtils::extractValue(*jsonObj, "transverterDeltaFrequency", xverterFrequencyValue))
|
if (WebAPIUtils::extractValue(*jsonObj, "transverterDeltaFrequency", xverterFrequencyValue))
|
||||||
{
|
{
|
||||||
double xverterFrequency = xverterFrequencyValue.toDouble();
|
double xverterFrequency = xverterFrequencyValue.toDouble();
|
||||||
@ -374,6 +379,11 @@ void AFCWorker::updateTarget()
|
|||||||
qDebug() << "AFCWorker::initTrackerDeviceSet: cannot find device transverter frequency";
|
qDebug() << "AFCWorker::initTrackerDeviceSet: cannot find device transverter frequency";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adjust tracker offset
|
||||||
|
if (updateChannelOffset(m_freqTracker, 0, m_trackerChannelOffset + correction)) {
|
||||||
|
m_trackerChannelOffset += correction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // act on device
|
else // act on device
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ private:
|
|||||||
const QList<QString> &channelSettingsKeys,
|
const QList<QString> &channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings
|
||||||
);
|
);
|
||||||
void updateChannelOffset(ChannelAPI *channelAPI, int direction, int offset);
|
bool updateChannelOffset(ChannelAPI *channelAPI, int direction, int offset);
|
||||||
void updateTarget();
|
void updateTarget();
|
||||||
bool updateDeviceFrequency(DeviceSet *deviceSet, const QString& key, int64_t frequency);
|
bool updateDeviceFrequency(DeviceSet *deviceSet, const QString& key, int64_t frequency);
|
||||||
int getDeviceDirection(DeviceAPI *deviceAPI);
|
int getDeviceDirection(DeviceAPI *deviceAPI);
|
||||||
|
Loading…
Reference in New Issue
Block a user