mirror of
https://github.com/jankae/LibreVNA.git
synced 2025-12-06 07:12:10 +01:00
SCPI API for querying the sweep cursor
This commit is contained in:
parent
d0c8a1ae8e
commit
65bc247a65
Binary file not shown.
|
|
@ -462,6 +462,21 @@ If single sweep is enabled, the acquisition is stopped when the required number
|
|||
\item Issue the command again (i.e. VNA:ACQ:SINGLE TRUE always triggers a new sweep)
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{VNA:ACQuisition:FREQuency}
|
||||
\query{Returns the current frequency of the sweep}{VNA:ACQuisition:FREQuency?}{None}{<Frequency in Hz>}
|
||||
|
||||
This command only returns valid data when a sweep is running and the the sweep is a frequency sweep.
|
||||
|
||||
\subsubsection{VNA:ACQuisition:POWer}
|
||||
\query{Returns the current power of the sweep}{VNA:ACQuisition:POWer?}{None}{<Power in dBm>}
|
||||
|
||||
This command only returns valid data when a sweep is running and the the sweep is a power sweep.
|
||||
|
||||
\subsubsection{VNA:ACQuisition:TIME}
|
||||
\query{Returns the current time of the sweep}{VNA:ACQuisition:TIME?}{None}{<Time in seconds>}
|
||||
|
||||
This command only returns valid data when a sweep is running and the the sweep is a zero-span sweep.
|
||||
|
||||
\subsubsection{VNA:STIMulus:LVL}
|
||||
\event{Sets the output power of the stimulus signal when sweep type is frequency}{VNA:STIMulus:LVL}{<power>, in dBm}
|
||||
\query{Queries the currently selected output power}{VNA:STIMulus:LVL?}{None}{power in dBm}
|
||||
|
|
@ -783,6 +798,16 @@ If single sweep is enabled, the acquisition is stopped when the required number
|
|||
\event{Enables/disables signal identification}{SA:ACQuisition:SIGid}{<enabled>, option are TRUE, FALSE, 1 or 0}
|
||||
\query{Queries whether signal identification is enabled}{SA:ACQuisition:SIGid?}{None}{TRUE or FALSE}
|
||||
|
||||
\subsubsection{SA:ACQuisition:FREQuency}
|
||||
\query{Returns the current frequency of the sweep}{SA:ACQuisition:FREQuency?}{None}{<Frequency in Hz>}
|
||||
|
||||
This command only returns valid data when a sweep is running and the the sweep is a frequency sweep.
|
||||
|
||||
\subsubsection{SA:ACQuisition:TIME}
|
||||
\query{Returns the current time of the sweep}{SA:ACQuisition:TIME?}{None}{<Time in seconds>}
|
||||
|
||||
This command only returns valid data when a sweep is running and the the sweep is a zero-span sweep.
|
||||
|
||||
\subsubsection{SA:TRACKing:ENable}
|
||||
\event{Enables/disables the tracking generator}{SA:TRACKing:ENable}{<enabled>, option are TRUE, FALSE, 1 or 0}
|
||||
\query{Queries whether tracking generator is enabled}{SA:TRACKing:ENable?}{None}{TRUE or FALSE}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ VNA::VNA(AppWindow *window, QString name)
|
|||
calWaitFirst = false;
|
||||
calDialog = nullptr;
|
||||
|
||||
lastFreq = 0.0;
|
||||
lastPower = 0.0;
|
||||
lastTime = 0.0;
|
||||
|
||||
changingSettings = false;
|
||||
settings.sweepType = SweepType::Frequency;
|
||||
settings.zerospan = false;
|
||||
|
|
@ -1015,6 +1019,10 @@ void VNA::NewDatapoint(DeviceDriver::VNAMeasurement m)
|
|||
}
|
||||
}
|
||||
|
||||
lastFreq = m_avg.frequency;
|
||||
lastPower = m_avg.dBm;
|
||||
lastTime = (double) m_avg.us / 1000000;
|
||||
|
||||
window->addStreamingData(m_avg, AppWindow::VNADataType::Raw, settings.zerospan);
|
||||
|
||||
if(average.settled()) {
|
||||
|
|
@ -1592,6 +1600,15 @@ void VNA::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("POWer", nullptr, [=](QStringList) -> QString {
|
||||
return QString::number(lastPower);
|
||||
}));
|
||||
scpi_acq->add(new SCPICommand("TIME", nullptr, [=](QStringList) -> QString {
|
||||
return QString::number(lastTime);
|
||||
}));
|
||||
auto scpi_stim = new SCPINode("STIMulus");
|
||||
SCPINode::add(scpi_stim);
|
||||
scpi_stim->add(new SCPICommand("LVL", [=](QStringList params) -> QString {
|
||||
|
|
|
|||
|
|
@ -201,6 +201,10 @@ private:
|
|||
// Statistics for detecting missing points and sweep time
|
||||
QDateTime lastStart;
|
||||
int lastPoint;
|
||||
// meta data from the last received datapoint
|
||||
double lastFreq;
|
||||
double lastPower;
|
||||
double lastTime;
|
||||
|
||||
signals:
|
||||
void deviceInitialized();
|
||||
|
|
|
|||
Loading…
Reference in a new issue