new command: :VNA:CAL:ACTIVE? + bugfixes in LibreCAL handling
This commit is contained in:
parent
879dfab882
commit
9b7f457aa5
Binary file not shown.
@ -505,6 +505,9 @@ $$ S_{11}...S_{1n},S_{21}...S_{2n},...,S_{n1}...S_{nn} $$
|
||||
\event{Activates a specific calibration. This command fails if the required measurements have not been taken yet}{VNA:CALibration:ACTivate}{<type>}
|
||||
\query{Queries the currently available calibration types}{VNA:CALibration:ACTivate?}{None}{comma-separated list of available calibration types}
|
||||
|
||||
\subsubsection{VNA:CALibration:ACTIVE}
|
||||
\query{Queries the currently active calibration type}{VNA:CALibration:ACTIVE?}{None}{Currently active calibration type}
|
||||
|
||||
\subsubsection{VNA:CALibration:NUMber}
|
||||
\query{Queries the number of available calibration measurements}{VNA:CALibration:NUMber?}{None}{<number of configured measurements>}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "caldevice.h"
|
||||
#include "usbdevice.h"
|
||||
#include "Device/virtualdevice.h"
|
||||
#include "CustomWidgets/informationbox.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
@ -27,8 +28,13 @@ LibreCALDialog::LibreCALDialog(Calibration *cal) :
|
||||
connect(ui->cbDevice, &QComboBox::currentTextChanged, [=](QString text) {
|
||||
if(device) {
|
||||
delete device;
|
||||
device = nullptr;
|
||||
}
|
||||
try {
|
||||
device = new CalDevice(text);
|
||||
} catch (exception &e) {
|
||||
device = nullptr;
|
||||
}
|
||||
device = new CalDevice(text);
|
||||
if(device) {
|
||||
createPortAssignmentUI();
|
||||
connect(device, &CalDevice::updateCoefficientsPercent, ui->progressCoeff, &QProgressBar::setValue);
|
||||
@ -376,8 +382,9 @@ void LibreCALDialog::startCalibration()
|
||||
ui->lCalibrationStatus->setText("Failed to activate calibration.");
|
||||
ui->lCalibrationStatus->setStyleSheet("QLabel { color : red; }");
|
||||
}
|
||||
// severe connection to this function
|
||||
// sever connection to this function
|
||||
disconnect(cal, &Calibration::measurementsUpdated, this, nullptr);
|
||||
setTerminationOnAllUsedPorts(CalDevice::Standard::None);
|
||||
enableUI();
|
||||
break;
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ Calibration::Calibration()
|
||||
// check if calibration can be activated
|
||||
if(canCompute(caltype)) {
|
||||
compute(caltype);
|
||||
return SCPI::getResultName(SCPI::Result::Empty);
|
||||
} else {
|
||||
return SCPI::getResultName(SCPI::Result::Error);
|
||||
}
|
||||
@ -75,6 +76,9 @@ Calibration::Calibration()
|
||||
}
|
||||
return ret;
|
||||
}));
|
||||
add(new SCPICommand("ACTIVE", nullptr, [=](QStringList) -> QString {
|
||||
return caltype.getShortString();
|
||||
}));
|
||||
add(new SCPICommand("NUMber", nullptr, [=](QStringList) -> QString {
|
||||
return QString::number(measurements.size());
|
||||
}));
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
bool InformationBox::has_gui = true;
|
||||
|
||||
void InformationBox::ShowMessage(QString title, QString message, QString messageID, bool block)
|
||||
void InformationBox::ShowMessage(QString title, QString message, QString messageID, bool block, QWidget *parent)
|
||||
{
|
||||
if(!has_gui) {
|
||||
// no gui option active, do not show any messages
|
||||
@ -23,7 +23,7 @@ void InformationBox::ShowMessage(QString title, QString message, QString message
|
||||
|
||||
QSettings s;
|
||||
if(!s.contains(hashToSettingsKey(hash))) {
|
||||
auto box = new InformationBox(title, message, QMessageBox::Information, hash, nullptr);
|
||||
auto box = new InformationBox(title, message, QMessageBox::Information, hash, parent);
|
||||
if(block) {
|
||||
box->exec();
|
||||
} else {
|
||||
@ -32,22 +32,22 @@ void InformationBox::ShowMessage(QString title, QString message, QString message
|
||||
}
|
||||
}
|
||||
|
||||
void InformationBox::ShowMessageBlocking(QString title, QString message, QString messageID)
|
||||
void InformationBox::ShowMessageBlocking(QString title, QString message, QString messageID, QWidget *parent)
|
||||
{
|
||||
ShowMessage(title, message, messageID, true);
|
||||
ShowMessage(title, message, messageID, true, parent);
|
||||
}
|
||||
|
||||
void InformationBox::ShowError(QString title, QString message)
|
||||
void InformationBox::ShowError(QString title, QString message, QWidget *parent)
|
||||
{
|
||||
if(!has_gui) {
|
||||
// no gui option active, do not show any messages
|
||||
return;
|
||||
}
|
||||
auto box = new InformationBox(title, message, QMessageBox::Information, 0, nullptr);
|
||||
auto box = new InformationBox(title, message, QMessageBox::Information, 0, parent);
|
||||
box->show();
|
||||
}
|
||||
|
||||
bool InformationBox::AskQuestion(QString title, QString question, bool defaultAnswer, QString messageID)
|
||||
bool InformationBox::AskQuestion(QString title, QString question, bool defaultAnswer, QString messageID, QWidget *parent)
|
||||
{
|
||||
if(!has_gui) {
|
||||
// no gui option active, do not show any messages
|
||||
@ -64,7 +64,7 @@ bool InformationBox::AskQuestion(QString title, QString question, bool defaultAn
|
||||
|
||||
QSettings s;
|
||||
if(!s.contains(hashToSettingsKey(hash))) {
|
||||
auto box = new InformationBox(title, question, QMessageBox::Question, hash, nullptr);
|
||||
auto box = new InformationBox(title, question, QMessageBox::Question, hash, parent);
|
||||
box->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
int ret = box->exec();
|
||||
if(ret == QMessageBox::Yes) {
|
||||
@ -90,6 +90,7 @@ InformationBox::InformationBox(QString title, QString message, Icon icon, unsign
|
||||
setWindowTitle(title);
|
||||
setText(message);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setModal(true);
|
||||
setIcon(icon);
|
||||
|
||||
auto cb = new QCheckBox("Do not show this message again");
|
||||
|
@ -7,11 +7,11 @@ class InformationBox : public QMessageBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void ShowMessage(QString title, QString message, QString messageID = QString(), bool block = false);
|
||||
static void ShowMessageBlocking(QString title, QString message, QString messageID = QString());
|
||||
static void ShowError(QString title, QString message);
|
||||
static void ShowMessage(QString title, QString message, QString messageID = QString(), bool block = false, QWidget *parent = nullptr);
|
||||
static void ShowMessageBlocking(QString title, QString message, QString messageID = QString(), QWidget *parent = nullptr);
|
||||
static void ShowError(QString title, QString message, QWidget *parent = nullptr);
|
||||
// Display a dialog with yes/no buttons. Returns true if yes is clicked, false otherwise. If the user has selected to never see this message again, defaultAnswer is returned instead
|
||||
static bool AskQuestion(QString title, QString question, bool defaultAnswer, QString messageID = QString());
|
||||
static bool AskQuestion(QString title, QString question, bool defaultAnswer, QString messageID = QString(), QWidget *parent = nullptr);
|
||||
|
||||
static void setGUI(bool enable);
|
||||
private:
|
||||
|
@ -1649,6 +1649,10 @@ void VNA::ConfigureDevice(bool resetTraces, std::function<void(bool)> cb)
|
||||
if(running) {
|
||||
if (resetTraces) {
|
||||
settings.activeSegment = 0;
|
||||
average.reset(settings.npoints);
|
||||
traceModel.clearLiveData();
|
||||
UpdateAverageCount();
|
||||
UpdateCalWidget();
|
||||
}
|
||||
changingSettings = true;
|
||||
// assemble VNA protocol settings
|
||||
|
Loading…
Reference in New Issue
Block a user