From 6e2079fcfb2ca0c4b0aa1ac2307592e8d69e6a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Thu, 23 Oct 2025 12:57:49 +0200 Subject: [PATCH] menu entry to run internal alignment if supported by hardware version --- .../Device/LibreVNA/librevnadriver.cpp | 19 ++++++++++++++++++- .../Application/Communication/Protocol.hpp | 6 +++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp index dd07fe8..70919f3 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp @@ -206,6 +206,23 @@ LibreVNADriver::LibreVNADriver() }); specificActions.push_back(freqcal); + auto internalAlignment = new QAction("Run Internal Alignment"); + connect(internalAlignment, &QAction::triggered, this, [=](){ + emit acquireControl(); + Protocol::PacketInfo p; + p.type = Protocol::PacketType::PerformAction; + p.performAction.action = Protocol::Action::InternalAlignment; + SendPacket(p, [=](TransmissionResult res){ + if(res == TransmissionResult::Ack) { + InformationBox::ShowMessage("Success", "Internal alignment completed"); + } else { + InformationBox::ShowError("Error", "Running internal alignment failed"); + } + emit releaseControl(); + }, 5000); + }); + specificActions.push_back(internalAlignment); + auto sep2 = new QAction(); sep2->setSeparator(true); specificActions.push_back(sep2); @@ -220,7 +237,7 @@ LibreVNADriver::LibreVNADriver() // set available actions for each hardware version availableActions[0x01] = {manual, config, update, sep, srccal, recvcal, freqcal, sep2, log}; availableActions[0xD0] = {manual, update, sep, srccal, recvcal, freqcal, sep2, log}; - availableActions[0xE0] = {manual, update, sep, srccal, recvcal, freqcal, sep2, log}; + availableActions[0xE0] = {manual, update, sep, srccal, recvcal, freqcal, internalAlignment, sep2, log}; availableActions[0xFD] = {manual, update, sep, srccal, recvcal, freqcal, sep2, log}; availableActions[0xFE] = {manual, config, update, sep, srccal, recvcal, freqcal, sep2, log}; availableActions[0xFF] = {manual, config, update, sep, srccal, recvcal, freqcal, sep2, log}; diff --git a/Software/VNA_embedded/Application/Communication/Protocol.hpp b/Software/VNA_embedded/Application/Communication/Protocol.hpp index d3dd77c..b614dd9 100644 --- a/Software/VNA_embedded/Application/Communication/Protocol.hpp +++ b/Software/VNA_embedded/Application/Communication/Protocol.hpp @@ -544,8 +544,12 @@ using DeviceConfig = struct _deviceconfig { }; }; +enum class Action : uint16_t { + InternalAlignment = 0x0000, +}; + using PerformAction = struct _performaction { - uint16_t action; + Action action; uint8_t additional_information[128]; };