1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-25 03:24:18 -04:00

AFC: REST API: actions and report: implementation

This commit is contained in:
f4exb
2020-10-26 13:48:19 +01:00
parent 598cefa933
commit d0081b2af4
8 changed files with 97 additions and 33 deletions
+16 -2
View File
@@ -393,9 +393,10 @@ void AFCWorker::updateTarget()
int64_t trackerFrequency = m_trackerDeviceFrequency + m_trackerChannelOffset;
int64_t correction = m_settings.m_targetFrequency - trackerFrequency;
int64_t tolerance = m_settings.m_freqTolerance;
qDebug() << "AFCWorker::updateTarget: correction:" << correction << "tolerance:" << tolerance;
if ((correction > -tolerance) && (correction < tolerance)) {
if ((correction > -tolerance) && (correction < tolerance))
{
reportUpdateTarget(correction, false);
return;
}
@@ -420,6 +421,8 @@ void AFCWorker::updateTarget()
if (updateChannelOffset(m_freqTracker, 0, m_trackerChannelOffset + correction, 1)) {
m_trackerChannelOffset += correction;
}
reportUpdateTarget(correction, true);
}
else // act on device
{
@@ -436,6 +439,8 @@ void AFCWorker::updateTarget()
qDebug() << "AFCWorker::updateTarget: cannot find device transverter frequency";
return;
}
reportUpdateTarget(correction, true);
}
}
@@ -515,3 +520,12 @@ void AFCWorker::getDeviceSettingsKey(DeviceAPI *deviceAPI, QString& settingsKey)
}
}
}
void AFCWorker::reportUpdateTarget(int correction, bool done)
{
if (m_msgQueueToGUI)
{
AFCReport::MsgUpdateTarget *msg = AFCReport::MsgUpdateTarget::create(correction, done);
m_msgQueueToGUI->push(msg);
}
}