SCPI API for querying the sweep cursor

This commit is contained in:
Jan Käberich 2025-12-02 11:22:54 +01:00
parent d0c8a1ae8e
commit 65bc247a65
6 changed files with 62 additions and 0 deletions

View file

@ -64,6 +64,9 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
normalize.measure = nullptr;
normalize.enable = nullptr;
lastFreq = 0.0;
lastTime = 0.0;
configurationTimer.setSingleShot(true);
connect(&configurationTimer, &QTimer::timeout, this, [=](){
ConfigureDevice();
@ -584,6 +587,9 @@ void SpectrumAnalyzer::NewDatapoint(DeviceDriver::SAMeasurement m)
qWarning() << "Got point" << m_avg.pointNum << "but last received point was" << lastPoint << "("<<(m_avg.pointNum-lastPoint-1)<<"missed points)";
}
lastPoint = m_avg.pointNum;
lastFreq = m_avg.frequency;
lastTime = (double) m_avg.us / 1000000;
}
void SpectrumAnalyzer::SettingsChanged()
@ -1102,6 +1108,12 @@ void SpectrumAnalyzer::SetupSCPI()
}, [=](QStringList) -> QString {
return singleSweep ? SCPI::getResultName(SCPI::Result::True): SCPI::getResultName(SCPI::Result::False);
}));
scpi_acq->add(new SCPICommand("FREQuency", nullptr, [=](QStringList) -> QString {
return QString::number(lastFreq);
}));
scpi_acq->add(new SCPICommand("TIME", nullptr, [=](QStringList) -> QString {
return QString::number(lastTime);
}));
auto scpi_tg = new SCPINode("TRACKing");
SCPINode::add(scpi_tg);
scpi_tg->add(new SCPICommand("ENable", [=](QStringList params) -> QString {

View file

@ -132,6 +132,10 @@ private:
QList<QAction*> importActions;
QList<QAction*> exportActions;
// meta data from the last received datapoint
double lastFreq;
double lastTime;
signals:
void dataChanged();
void startFreqChanged(double freq);