diff --git a/Documentation/UserManual/ProgrammingGuide.pdf b/Documentation/UserManual/ProgrammingGuide.pdf index 1b168ac..f2992f9 100644 Binary files a/Documentation/UserManual/ProgrammingGuide.pdf and b/Documentation/UserManual/ProgrammingGuide.pdf differ diff --git a/Documentation/UserManual/ProgrammingGuide.tex b/Documentation/UserManual/ProgrammingGuide.tex index 80fde3f..511fcfc 100644 --- a/Documentation/UserManual/ProgrammingGuide.tex +++ b/Documentation/UserManual/ProgrammingGuide.tex @@ -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}{} \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}{} diff --git a/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.cpp b/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.cpp index b1851f7..96e3008 100644 --- a/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.cpp @@ -4,6 +4,7 @@ #include "caldevice.h" #include "usbdevice.h" #include "Device/virtualdevice.h" +#include "CustomWidgets/informationbox.h" #include @@ -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; } diff --git a/Software/PC_Application/LibreVNA-GUI/Calibration/calibration.cpp b/Software/PC_Application/LibreVNA-GUI/Calibration/calibration.cpp index 9a0687d..523c3b8 100644 --- a/Software/PC_Application/LibreVNA-GUI/Calibration/calibration.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Calibration/calibration.cpp @@ -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()); })); diff --git a/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.cpp b/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.cpp index 22d2653..1ba3ac4 100644 --- a/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.cpp +++ b/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.cpp @@ -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"); diff --git a/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.h b/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.h index f43b5ca..38bc982 100644 --- a/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.h +++ b/Software/PC_Application/LibreVNA-GUI/CustomWidgets/informationbox.h @@ -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: diff --git a/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp b/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp index 3ff33b0..bbca69e 100644 --- a/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp +++ b/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp @@ -1649,6 +1649,10 @@ void VNA::ConfigureDevice(bool resetTraces, std::function cb) if(running) { if (resetTraces) { settings.activeSegment = 0; + average.reset(settings.npoints); + traceModel.clearLiveData(); + UpdateAverageCount(); + UpdateCalWidget(); } changingSettings = true; // assemble VNA protocol settings