diff --git a/Documentation/DeveloperInfo/Device_protocol_v13.pdf b/Documentation/DeveloperInfo/Device_protocol_v13.pdf index b61a3e1..1bffa75 100644 Binary files a/Documentation/DeveloperInfo/Device_protocol_v13.pdf and b/Documentation/DeveloperInfo/Device_protocol_v13.pdf differ diff --git a/Documentation/DeveloperInfo/Device_protocol_v13.tex b/Documentation/DeveloperInfo/Device_protocol_v13.tex index 11434d5..eb749d6 100644 --- a/Documentation/DeveloperInfo/Device_protocol_v13.tex +++ b/Documentation/DeveloperInfo/Device_protocol_v13.tex @@ -174,7 +174,7 @@ This document describes the device protocol of the LibreVNA. This is the protoco Depending on the LibreVNA, different hardware interfaces may be used for the implementation of this protocol. \subsection{USB device} -The LibreVNA implements a ``custom class'' USB device. It uses a VID of 0x0483 and a PID of 0x4121. The custom class contains a single interface with three bulk endpoints: +The LibreVNA implements a ``custom class'' USB device. It uses a VID of 0x1209 and a PID of 0x4121. The custom class contains a single interface with three bulk endpoints: \begin{itemize} \item \textbf{Endpoint 0x01:} Communication data from the USB host to the LibreVNA \item \textbf{Endpoint 0x81:} Communication data from the LibreVNA to the USB host @@ -766,7 +766,7 @@ The packet contains the following fields: %\insertTableNotes % tell LaTeX where to insert the table-related notes \endlastfoot -0 & 2 & UINT16 & ProtocolVersion & Set to 12. If another value is reported, refer to the corresponding protocol description.\\ +0 & 2 & UINT16 & ProtocolVersion & Set to 13. If another value is reported, refer to the corresponding protocol description.\\ 2 & 1 & UINT8 & FW\_major & Major firmware version \\ 3 & 1 & UINT8 & FW\_minor & Minor firmware version \\ 4 & 1 & UINT8 & FW\_patch & Patch of the firmware version \\ diff --git a/README.md b/README.md index aa03851..f2b4119 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This is the improved version of my [first attempt](https://www.github.com/jankae * Download the latest [Release](https://github.com/jankae/LibreVNA/releases) and unpack the zip file * Install the required libraries: ```console -sudo apt install libqt6widgets6 +sudo apt install libqt6widgets6 libqt6svg6 ``` * Install the udev rule (otherwise you don't have the permissions to access the USB device): ```console diff --git a/Software/PC_Application/51-vna.rules b/Software/PC_Application/51-vna.rules index a35c97c..4661e80 100644 --- a/Software/PC_Application/51-vna.rules +++ b/Software/PC_Application/51-vna.rules @@ -1,2 +1,3 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="564e", MODE:="0666" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="4121", MODE:="0666" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="4121", MODE:="0666" diff --git a/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.cpp b/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.cpp index f10ab3d..ea1c118 100644 --- a/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.cpp @@ -414,3 +414,14 @@ void Calkit::fromJSON(nlohmann::json j) standards.push_back(s); } } + +void Calkit::setIdealDefault() +{ + manufacturer = "LibreVNA"; + description = "Default calibration kit with ideal standards"; + clearStandards(); + addStandard(new CalStandard::Open("Ideal Open Standard", 50.0, 0, 0, 0, 0, 0, 0)); + addStandard(new CalStandard::Short("Ideal Short Standard", 50.0, 0, 0, 0, 0, 0, 0)); + addStandard(new CalStandard::Load("Ideal Load Standard", 50.0, 0, 0, 50.0, 0, 0)); + addStandard(new CalStandard::Through("Ideal Through Standard", 50.0, 0, 0)); +} diff --git a/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.h b/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.h index 0bea69b..71ccdac 100644 --- a/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.h +++ b/Software/PC_Application/LibreVNA-GUI/Calibration/calkit.h @@ -53,6 +53,8 @@ public: virtual nlohmann::json toJSON() override; virtual void fromJSON(nlohmann::json j) override; + void setIdealDefault(); + private: void clearStandards(); QString manufacturer, serialnumber, description; diff --git a/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp b/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp index 560e9da..9915599 100644 --- a/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp +++ b/Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp @@ -66,10 +66,8 @@ VNA::VNA(AppWindow *window, QString name) singleSweep = false; calMeasuring = false; calWaitFirst = false; - calDialog.reset(); - // A modal QProgressDialog calls processEvents() in setValue(). Needs to use a queued connection to update the progress - // value from within the NewDatapoint slot to prevent possible re-entrancy. - connect(this, &VNA::calibrationMeasurementPercentage, &calDialog, &QProgressDialog::setValue, Qt::QueuedConnection); + calDialog = nullptr; + changingSettings = false; settings.sweepType = SweepType::Frequency; settings.zerospan = false; @@ -157,6 +155,8 @@ VNA::VNA(AppWindow *window, QString name) } }); + cal.getKit().setIdealDefault(); + // portExtension.setCalkit(&cal.getCalibrationKit()); // De-embedding menu @@ -889,7 +889,7 @@ void VNA::NewDatapoint(DeviceDriver::VNAMeasurement m) if(m_avg.pointNum == settings.npoints - 1) { calMeasuring = false; cal.measurementsComplete(); - calDialog.reset(); + delete calDialog; } } } @@ -1247,18 +1247,24 @@ void VNA::StartCalibrationMeasurements(std::set m } else { text.append("multiple calibration standards."); } - calDialog.setLabelText(text); - calDialog.setCancelButtonText("Abort"); - calDialog.setWindowTitle("Taking calibration measurement..."); - calDialog.setValue(0); - calDialog.setWindowModality(Qt::ApplicationModal); + calDialog = new QProgressDialog(); + calDialog->setLabelText(text); + calDialog->setCancelButtonText("Abort"); + calDialog->setWindowTitle("Taking calibration measurement..."); + calDialog->setValue(0); + calDialog->setWindowModality(Qt::ApplicationModal); // always show the dialog - calDialog.setMinimumDuration(0); - connect(&calDialog, &QProgressDialog::canceled, [=]() { + calDialog->setMinimumDuration(0); + // A modal QProgressDialog calls processEvents() in setValue(). Needs to use a queued connection to update the progress + // value from within the NewDatapoint slot to prevent possible re-entrancy. + connect(this, &VNA::calibrationMeasurementPercentage, calDialog, &QProgressDialog::setValue, Qt::QueuedConnection); + + connect(calDialog, &QProgressDialog::canceled, this, [=]() { // the user aborted the calibration measurement calMeasuring = false; cal.clearMeasurements(calMeasurements); - }); + delete calDialog; + }, Qt::UniqueConnection); // Trigger sweep to start from beginning running = true; ConfigureDevice(true, [=](bool){ diff --git a/Software/PC_Application/LibreVNA-GUI/VNA/vna.h b/Software/PC_Application/LibreVNA-GUI/VNA/vna.h index a80f028..374e73c 100644 --- a/Software/PC_Application/LibreVNA-GUI/VNA/vna.h +++ b/Software/PC_Application/LibreVNA-GUI/VNA/vna.h @@ -150,7 +150,7 @@ private: std::set calMeasurements; bool calMeasuring; bool calWaitFirst; - QProgressDialog calDialog; + QProgressDialog *calDialog; Calibration::InterpolationType getCalInterpolation(); QString getCalStyle(); QString getCalToolTip(); diff --git a/Software/VNA_embedded/Application/VNA.cpp b/Software/VNA_embedded/Application/VNA.cpp index bd17870..c033f6b 100644 --- a/Software/VNA_embedded/Application/VNA.cpp +++ b/Software/VNA_embedded/Application/VNA.cpp @@ -109,6 +109,7 @@ static bool needs2LOshift(uint64_t f, uint32_t current2LO, uint32_t IFBW, uint32 bool VNA::Setup(Protocol::SweepSettings s) { VNA::Stop(); vTaskDelay(5); + data.clear(); HW::SetMode(HW::Mode::VNA); // Abort possible active sweep first FPGA::SetMode(FPGA::Mode::FPGA);