diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddeviceeditdialog.cpp b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddeviceeditdialog.cpp index c155c33..fb72454 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddeviceeditdialog.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddeviceeditdialog.cpp @@ -27,7 +27,9 @@ CompoundDeviceEditDialog::CompoundDeviceEditDialog(CompoundDevice *cdev, QWidget }); for(int i=0;i<(int)LibreVNADriver::Synchronization::Last;i++) { ui->sync->addItem(CompoundDevice::SyncToString((LibreVNADriver::Synchronization) i)); - if((LibreVNADriver::Synchronization) i == LibreVNADriver::Synchronization::ExternalTrigger) { + switch((LibreVNADriver::Synchronization) i) { + case LibreVNADriver::Synchronization::Disabled: + case LibreVNADriver::Synchronization::Reserved: { // Disable for now auto *model = qobject_cast(ui->sync->model()); Q_ASSERT(model != nullptr); @@ -36,6 +38,10 @@ CompoundDeviceEditDialog::CompoundDeviceEditDialog(CompoundDevice *cdev, QWidget item->setFlags(disabled ? item->flags() & ~Qt::ItemIsEnabled : item->flags() | Qt::ItemIsEnabled); } + break; + default: + break; + } } connect(ui->sync, &QComboBox::currentTextChanged, [=](){ ldev.sync = CompoundDevice::SyncFromString(ui->sync->currentText()); diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.cpp b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.cpp index a8c071c..9e69c47 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.cpp @@ -6,6 +6,7 @@ #include "ui_compounddriversettingswidget.h" #include "compounddeviceeditdialog.h" #include "preferences.h" +#include "Device/LibreVNA/devicepacketlogview.h" #include @@ -16,6 +17,13 @@ CompoundDriver::CompoundDriver() drivers.push_back(new LibreVNAUSBDriver); drivers.push_back(new LibreVNATCPDriver); + auto log = new QAction("View Packet Log"); + connect(log, &QAction::triggered, this, [=](){ + auto d = new DevicePacketLogView(); + d->show(); + }); + specificActions.push_back(log); + auto &p = Preferences::getInstance(); for(auto d : drivers) { p.load(d->driverSpecificSettings()); @@ -91,7 +99,9 @@ bool CompoundDriver::connectTo(QString getSerial) device = new LibreVNAUSBDriver(); break; } else if(i == 1) { - device = new LibreVNATCPDriver(); + auto tcp = new LibreVNATCPDriver(); + tcp->copyDetectedDevices(*static_cast(drivers[i])); + device = tcp; break; } } @@ -287,6 +297,7 @@ bool CompoundDriver::setVNA(const DeviceDriver::VNASettings &s, std::function activeMapping; for(auto p : s.excitedPorts) { @@ -689,15 +700,17 @@ void CompoundDriver::datapointReceivecd(LibreVNADriver *dev, Protocol::VNADatapo // Clear this and all (incomplete) older datapoint buffers int pointNum = data->pointNum; - auto it = compoundVNABuffer.begin(); - while(it != compoundVNABuffer.end()) { - if(it->first <= pointNum) { - for(auto d : it->second) { - delete d.second; - } - it = compoundVNABuffer.erase(it); + while(compoundVNABuffer.count(pointNum)) { + auto &buf = compoundVNABuffer[pointNum]; + for(auto d : buf) { + delete d.second; + } + compoundVNABuffer.erase(pointNum); + // move on to previous point + if(pointNum > 0) { + pointNum--; } else { - it++; + pointNum = VNApoints - 1; } } } diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.h b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.h index 7e3a9f1..8439df0 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.h +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/Compound/compounddriver.h @@ -198,6 +198,7 @@ private: bool connected; std::vector devices; bool zerospan; + unsigned int VNApoints; unsigned int SApoints; // Driver specific settings diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.cpp b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.cpp index 7b4d637..9007a01 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.cpp @@ -153,6 +153,7 @@ void LibreVNATCPDriver::disconnect() transmissionTimer.stop(); transmissionQueue.clear(); transmissionActive = false; + dataSocket.flush(); dataSocket.close(); logSocket.close(); // delete dataSocket; diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.h b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.h index 43af223..fbc822b 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.h +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.h @@ -46,7 +46,11 @@ public: * If the device driver uses a queued signal/slot connection with custom data types, these types must be registered before emitting the signal. * Register them within this function with qRegisterMetaType("Name"); */ - virtual void registerTypes(); + virtual void registerTypes() override; + + void copyDetectedDevices(const LibreVNATCPDriver &other) { + detectedDevices = other.detectedDevices; + } private slots: void SSDPreceived(QUdpSocket *sock); diff --git a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.ui b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.ui index 9b6d2b8..8e987b8 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.ui +++ b/Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.ui @@ -467,13 +467,13 @@ 96 - 32000 + 16384 16 - 32000 + 16384