Renaming packet types, implementing different packet contents per hardware version
This commit is contained in:
parent
83dbfadf20
commit
9b4865dceb
@ -160,16 +160,16 @@ QString CompoundDriver::getSerial()
|
|||||||
std::set<DeviceDriver::Flag> CompoundDriver::getFlags()
|
std::set<DeviceDriver::Flag> CompoundDriver::getFlags()
|
||||||
{
|
{
|
||||||
std::set<DeviceDriver::Flag> ret;
|
std::set<DeviceDriver::Flag> ret;
|
||||||
if(lastStatus.extRefInUse) {
|
if(lastStatus.V1.extRefInUse) {
|
||||||
ret.insert(Flag::ExtRef);
|
ret.insert(Flag::ExtRef);
|
||||||
}
|
}
|
||||||
if(!lastStatus.source_locked || !lastStatus.LO1_locked) {
|
if(!lastStatus.V1.source_locked || !lastStatus.V1.LO1_locked) {
|
||||||
ret.insert(Flag::Unlocked);
|
ret.insert(Flag::Unlocked);
|
||||||
}
|
}
|
||||||
if(lastStatus.unlevel) {
|
if(lastStatus.V1.unlevel) {
|
||||||
ret.insert(Flag::Unlevel);
|
ret.insert(Flag::Unlevel);
|
||||||
}
|
}
|
||||||
if(lastStatus.ADC_overload) {
|
if(lastStatus.V1.ADC_overload) {
|
||||||
ret.insert(Flag::Overload);
|
ret.insert(Flag::Overload);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -181,13 +181,13 @@ QString CompoundDriver::getStatus()
|
|||||||
ret.append("HW Rev.");
|
ret.append("HW Rev.");
|
||||||
ret.append(info.hardware_version);
|
ret.append(info.hardware_version);
|
||||||
ret.append(" FW "+info.firmware_version);
|
ret.append(" FW "+info.firmware_version);
|
||||||
ret.append(" Temps: "+QString::number(lastStatus.temp_source)+"°C/"+QString::number(lastStatus.temp_LO1)+"°C/"+QString::number(lastStatus.temp_MCU)+"°C");
|
ret.append(" Temps: "+QString::number(lastStatus.V1.temp_source)+"°C/"+QString::number(lastStatus.V1.temp_LO1)+"°C/"+QString::number(lastStatus.V1.temp_MCU)+"°C");
|
||||||
ret.append(" Reference:");
|
ret.append(" Reference:");
|
||||||
if(lastStatus.extRefInUse) {
|
if(lastStatus.V1.extRefInUse) {
|
||||||
ret.append("External");
|
ret.append("External");
|
||||||
} else {
|
} else {
|
||||||
ret.append("Internal");
|
ret.append("Internal");
|
||||||
if(lastStatus.extRefAvailable) {
|
if(lastStatus.V1.extRefAvailable) {
|
||||||
ret.append(" (External available)");
|
ret.append(" (External available)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,8 +495,8 @@ void CompoundDriver::createCompoundJSON()
|
|||||||
void CompoundDriver::incomingPacket(LibreVNADriver *device, const Protocol::PacketInfo &p)
|
void CompoundDriver::incomingPacket(LibreVNADriver *device, const Protocol::PacketInfo &p)
|
||||||
{
|
{
|
||||||
switch(p.type) {
|
switch(p.type) {
|
||||||
case Protocol::PacketType::DeviceStatusV1:
|
case Protocol::PacketType::DeviceStatus:
|
||||||
updatedStatus(device, p.statusV1);
|
updatedStatus(device, p.status);
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::VNADatapoint:
|
case Protocol::PacketType::VNADatapoint:
|
||||||
datapointReceivecd(device, p.VNAdatapoint);
|
datapointReceivecd(device, p.VNAdatapoint);
|
||||||
@ -557,7 +557,7 @@ void CompoundDriver::updatedInfo(LibreVNADriver *device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompoundDriver::updatedStatus(LibreVNADriver *device, const Protocol::DeviceStatusV1 &status)
|
void CompoundDriver::updatedStatus(LibreVNADriver *device, const Protocol::DeviceStatus &status)
|
||||||
{
|
{
|
||||||
deviceStatus[device] = status;
|
deviceStatus[device] = status;
|
||||||
if(deviceStatus.size() == devices.size()) {
|
if(deviceStatus.size() == devices.size()) {
|
||||||
@ -567,16 +567,16 @@ void CompoundDriver::updatedStatus(LibreVNADriver *device, const Protocol::Devic
|
|||||||
if(i==0) {
|
if(i==0) {
|
||||||
lastStatus = devStat;
|
lastStatus = devStat;
|
||||||
} else {
|
} else {
|
||||||
lastStatus.extRefAvailable &= devStat.extRefAvailable;
|
lastStatus.V1.extRefAvailable &= devStat.V1.extRefAvailable;
|
||||||
lastStatus.extRefInUse |= devStat.extRefInUse;
|
lastStatus.V1.extRefInUse |= devStat.V1.extRefInUse;
|
||||||
lastStatus.FPGA_configured &= devStat.FPGA_configured;
|
lastStatus.V1.FPGA_configured &= devStat.V1.FPGA_configured;
|
||||||
lastStatus.source_locked &= devStat.source_locked;
|
lastStatus.V1.source_locked &= devStat.V1.source_locked;
|
||||||
lastStatus.LO1_locked &= devStat.LO1_locked;
|
lastStatus.V1.LO1_locked &= devStat.V1.LO1_locked;
|
||||||
lastStatus.ADC_overload |= devStat.ADC_overload;
|
lastStatus.V1.ADC_overload |= devStat.V1.ADC_overload;
|
||||||
lastStatus.unlevel |= devStat.unlevel;
|
lastStatus.V1.unlevel |= devStat.V1.unlevel;
|
||||||
lastStatus.temp_source = std::max(lastStatus.temp_source, devStat.temp_source);
|
lastStatus.V1.temp_source = std::max(lastStatus.V1.temp_source, devStat.V1.temp_source);
|
||||||
lastStatus.temp_LO1 = std::max(lastStatus.temp_LO1, devStat.temp_LO1);
|
lastStatus.V1.temp_LO1 = std::max(lastStatus.V1.temp_LO1, devStat.V1.temp_LO1);
|
||||||
lastStatus.temp_MCU = std::max(lastStatus.temp_MCU, devStat.temp_MCU);
|
lastStatus.V1.temp_MCU = std::max(lastStatus.V1.temp_MCU, devStat.V1.temp_MCU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit StatusUpdated();
|
emit StatusUpdated();
|
||||||
|
@ -174,16 +174,16 @@ private:
|
|||||||
void createCompoundJSON();
|
void createCompoundJSON();
|
||||||
void incomingPacket(LibreVNADriver *device, const Protocol::PacketInfo &p);
|
void incomingPacket(LibreVNADriver *device, const Protocol::PacketInfo &p);
|
||||||
void updatedInfo(LibreVNADriver *device);
|
void updatedInfo(LibreVNADriver *device);
|
||||||
void updatedStatus(LibreVNADriver *device, const Protocol::DeviceStatusV1 &status);
|
void updatedStatus(LibreVNADriver *device, const Protocol::DeviceStatus &status);
|
||||||
void datapointReceivecd(LibreVNADriver *dev, Protocol::VNADatapoint<32> *data);
|
void datapointReceivecd(LibreVNADriver *dev, Protocol::VNADatapoint<32> *data);
|
||||||
void spectrumResultReceived(LibreVNADriver *dev, Protocol::SpectrumAnalyzerResult res);
|
void spectrumResultReceived(LibreVNADriver *dev, Protocol::SpectrumAnalyzerResult res);
|
||||||
|
|
||||||
Info info;
|
Info info;
|
||||||
std::map<LibreVNADriver*, Info> deviceInfos;
|
std::map<LibreVNADriver*, Info> deviceInfos;
|
||||||
std::map<LibreVNADriver*, Protocol::DeviceStatusV1> deviceStatus;
|
std::map<LibreVNADriver*, Protocol::DeviceStatus> deviceStatus;
|
||||||
std::map<int, std::map<LibreVNADriver*, Protocol::VNADatapoint<32>*>> compoundVNABuffer;
|
std::map<int, std::map<LibreVNADriver*, Protocol::VNADatapoint<32>*>> compoundVNABuffer;
|
||||||
std::map<int, std::map<LibreVNADriver*, Protocol::SpectrumAnalyzerResult>> compoundSABuffer;
|
std::map<int, std::map<LibreVNADriver*, Protocol::SpectrumAnalyzerResult>> compoundSABuffer;
|
||||||
Protocol::DeviceStatusV1 lastStatus;
|
Protocol::DeviceStatus lastStatus;
|
||||||
|
|
||||||
// Parsed configuration of compound devices (as extracted from compoundJSONString
|
// Parsed configuration of compound devices (as extracted from compoundJSONString
|
||||||
std::vector<CompoundDevice*> configuredDevices;
|
std::vector<CompoundDevice*> configuredDevices;
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
#include "deviceconfigurationdialogv1.h"
|
||||||
|
#include "ui_deviceconfigurationdialogv1.h"
|
||||||
|
|
||||||
|
DeviceConfigurationDialogV1::DeviceConfigurationDialogV1(LibreVNADriver &dev, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::DeviceConfigurationDialogV1),
|
||||||
|
dev(dev)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
emit dev.acquireControl();
|
||||||
|
|
||||||
|
|
||||||
|
auto updateADCRate = [=]() {
|
||||||
|
// update ADC rate, see FPGA protocol for calculation
|
||||||
|
ui->ADCRate->setValue(102400000.0 / ui->ADCpresc->value());
|
||||||
|
};
|
||||||
|
auto updateIF2 = [=]() {
|
||||||
|
auto ADCrate = ui->ADCRate->value();
|
||||||
|
ui->IF2->setValue(ADCrate * ui->ADCphaseInc->value() / 4096);
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(ui->ADCpresc, qOverload<int>(&QSpinBox::valueChanged), updateADCRate);
|
||||||
|
connect(ui->ADCpresc, qOverload<int>(&QSpinBox::valueChanged), updateIF2);
|
||||||
|
connect(ui->ADCphaseInc, qOverload<int>(&QSpinBox::valueChanged), updateIF2);
|
||||||
|
|
||||||
|
ui->IF1->setUnit("Hz");
|
||||||
|
ui->IF1->setPrefixes(" kM");
|
||||||
|
ui->IF1->setPrecision(5);
|
||||||
|
ui->ADCRate->setUnit("Hz");
|
||||||
|
ui->ADCRate->setPrefixes(" kM");
|
||||||
|
ui->ADCRate->setPrecision(5);
|
||||||
|
ui->IF2->setUnit("Hz");
|
||||||
|
ui->IF2->setPrefixes(" kM");
|
||||||
|
ui->IF2->setPrecision(5);
|
||||||
|
ui->IF1->setValue(62000000);
|
||||||
|
ui->ADCpresc->setValue(128);
|
||||||
|
ui->ADCphaseInc->setValue(1280);
|
||||||
|
|
||||||
|
updateADCRate();
|
||||||
|
updateIF2();
|
||||||
|
|
||||||
|
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p) {
|
||||||
|
if(p.type == Protocol::PacketType::DeviceConfiguration) {
|
||||||
|
updateGUI(p.deviceConfig);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dev.sendWithoutPayload(Protocol::PacketType::RequestDeviceConfiguration);
|
||||||
|
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=](){
|
||||||
|
updateDevice();
|
||||||
|
accept();
|
||||||
|
});
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceConfigurationDialogV1::~DeviceConfigurationDialogV1()
|
||||||
|
{
|
||||||
|
dev.releaseControl();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceConfigurationDialogV1::updateGUI(const Protocol::DeviceConfig &c)
|
||||||
|
{
|
||||||
|
ui->IF1->setEnabled(false);
|
||||||
|
ui->IF1->setValue(c.V1.IF1);
|
||||||
|
ui->IF1->setEnabled(true);
|
||||||
|
ui->ADCpresc->setValue(c.V1.ADCprescaler);
|
||||||
|
ui->ADCphaseInc->setValue(c.V1.DFTphaseInc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceConfigurationDialogV1::updateDevice()
|
||||||
|
{
|
||||||
|
Protocol::PacketInfo p;
|
||||||
|
p.type = Protocol::PacketType::DeviceConfiguration;
|
||||||
|
p.deviceConfig.V1.IF1 = ui->IF1->value();
|
||||||
|
p.deviceConfig.V1.ADCprescaler = ui->ADCpresc->value();
|
||||||
|
p.deviceConfig.V1.DFTphaseInc = ui->ADCphaseInc->value();
|
||||||
|
dev.SendPacket(p);
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef DEVICECONFIGURATIONDIALOGV1_H
|
||||||
|
#define DEVICECONFIGURATIONDIALOGV1_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DeviceConfigurationDialogV1;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeviceConfigurationDialogV1 : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DeviceConfigurationDialogV1(LibreVNADriver &dev, QWidget *parent = nullptr);
|
||||||
|
~DeviceConfigurationDialogV1();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateGUI(const Protocol::DeviceConfig &c);
|
||||||
|
void updateDevice();
|
||||||
|
|
||||||
|
Ui::DeviceConfigurationDialogV1 *ui;
|
||||||
|
LibreVNADriver &dev;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DEVICECONFIGURATIONDIALOGV1_H
|
@ -0,0 +1,159 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DeviceConfigurationDialogV1</class>
|
||||||
|
<widget class="QDialog" name="DeviceConfigurationDialogV1">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>497</width>
|
||||||
|
<height>297</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Device Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_15">
|
||||||
|
<property name="title">
|
||||||
|
<string>IF frequencies</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_34">
|
||||||
|
<property name="text">
|
||||||
|
<string>This section contains advanced system settings. It is recommended to leave them at default values unless you know what you are doing. Slight changes of the IF frequencies can be used to shift possible spikes to less problematic frequencies. Large changes of these frequencies may severely impact device performance.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_29">
|
||||||
|
<property name="text">
|
||||||
|
<string>IF 1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="SIUnitEdit" name="IF1">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Frequency of the first IF</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_30">
|
||||||
|
<property name="text">
|
||||||
|
<string>ADC prescaler:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="ADCpresc">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>ADC prescaler in FPGA. The ADC sample rate is determined by 102.4MHz/prescaler</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>112</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>255</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>128</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_31">
|
||||||
|
<property name="text">
|
||||||
|
<string>ADC sample rate:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="SIUnitEdit" name="ADCRate">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_32">
|
||||||
|
<property name="text">
|
||||||
|
<string>Phase increment:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="ADCphaseInc">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Phase increment per ADC sample. Together with the ADC sample rate this determines the frequency of the second IF</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>4095</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1280</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_33">
|
||||||
|
<property name="text">
|
||||||
|
<string>IF 2:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="SIUnitEdit" name="IF2">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SIUnitEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>CustomWidgets/siunitedit.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -0,0 +1,80 @@
|
|||||||
|
#include "deviceconfigurationdialogvff.h"
|
||||||
|
#include "ui_deviceconfigurationdialogvff.h"
|
||||||
|
|
||||||
|
#include <QtEndian>
|
||||||
|
|
||||||
|
DeviceConfigurationDialogVFF::DeviceConfigurationDialogVFF(LibreVNADriver &dev, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::DeviceConfigurationDialogVFF),
|
||||||
|
dev(dev)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
emit dev.acquireControl();
|
||||||
|
|
||||||
|
auto updateAddress = [](QLineEdit* line, QHostAddress &address) {
|
||||||
|
auto newAddress = QHostAddress(line->text());
|
||||||
|
if(newAddress.isNull()) {
|
||||||
|
// address is invalid, set edit to old address
|
||||||
|
line->setText(address.toString());
|
||||||
|
} else {
|
||||||
|
// input is valid, store new address
|
||||||
|
address = newAddress;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(ui->ip, &QLineEdit::editingFinished, this, [=](){
|
||||||
|
updateAddress(ui->ip, ip);
|
||||||
|
});
|
||||||
|
connect(ui->mask, &QLineEdit::editingFinished, this, [=](){
|
||||||
|
updateAddress(ui->mask, mask);
|
||||||
|
});
|
||||||
|
connect(ui->gateway, &QLineEdit::editingFinished, this, [=](){
|
||||||
|
updateAddress(ui->gateway, gateway);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p) {
|
||||||
|
if(p.type == Protocol::PacketType::DeviceConfiguration) {
|
||||||
|
updateGUI(p.deviceConfig);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dev.sendWithoutPayload(Protocol::PacketType::RequestDeviceConfiguration);
|
||||||
|
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=](){
|
||||||
|
updateDevice();
|
||||||
|
accept();
|
||||||
|
});
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceConfigurationDialogVFF::~DeviceConfigurationDialogVFF()
|
||||||
|
{
|
||||||
|
dev.releaseControl();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceConfigurationDialogVFF::updateGUI(const Protocol::DeviceConfig &c)
|
||||||
|
{
|
||||||
|
ui->dhcp->setChecked(c.VFF.dhcp);
|
||||||
|
ip = QHostAddress(qFromBigEndian(c.VFF.ip));
|
||||||
|
ui->ip->setText(ip.toString());
|
||||||
|
mask = QHostAddress(qFromBigEndian(c.VFF.mask));
|
||||||
|
ui->mask->setText(mask.toString());
|
||||||
|
gateway = QHostAddress(qFromBigEndian(c.VFF.gw));
|
||||||
|
ui->gateway->setText(gateway.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceConfigurationDialogVFF::updateDevice()
|
||||||
|
{
|
||||||
|
Protocol::PacketInfo p;
|
||||||
|
p.type = Protocol::PacketType::DeviceConfiguration;
|
||||||
|
p.deviceConfig.VFF.dhcp = ui->dhcp->isChecked() ? 1 : 0;
|
||||||
|
p.deviceConfig.VFF.ip = qToBigEndian(ip.toIPv4Address());
|
||||||
|
p.deviceConfig.VFF.mask = qToBigEndian(mask.toIPv4Address());
|
||||||
|
p.deviceConfig.VFF.gw = qToBigEndian(gateway.toIPv4Address());
|
||||||
|
dev.SendPacket(p);
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef DEVICECONFIGURATIONDIALOGVFF_H
|
||||||
|
#define DEVICECONFIGURATIONDIALOGVFF_H
|
||||||
|
|
||||||
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DeviceConfigurationDialogVFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeviceConfigurationDialogVFF : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DeviceConfigurationDialogVFF(LibreVNADriver &dev, QWidget *parent = nullptr);
|
||||||
|
~DeviceConfigurationDialogVFF();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateGUI(const Protocol::DeviceConfig &c);
|
||||||
|
void updateDevice();
|
||||||
|
|
||||||
|
Ui::DeviceConfigurationDialogVFF *ui;
|
||||||
|
LibreVNADriver &dev;
|
||||||
|
|
||||||
|
QHostAddress ip, mask, gateway;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DEVICECONFIGURATIONDIALOGVFF_H
|
@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DeviceConfigurationDialogVFF</class>
|
||||||
|
<widget class="QDialog" name="DeviceConfigurationDialogVFF">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>389</width>
|
||||||
|
<height>224</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Device Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Address configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="dhcp">
|
||||||
|
<property name="text">
|
||||||
|
<string>DHCP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Static/DHCP fallback</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>IP:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="ip"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mask:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="mask"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Gateway:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="gateway"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -10,6 +10,8 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QHostAddress>
|
||||||
|
#include <QtEndian>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -105,11 +107,11 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
|
|||||||
if(e.type == DevicePacketLog::LogEntry::Type::Packet) {
|
if(e.type == DevicePacketLog::LogEntry::Type::Packet) {
|
||||||
item->setData(2, Qt::DisplayRole, "Packet");
|
item->setData(2, Qt::DisplayRole, "Packet");
|
||||||
|
|
||||||
static const QStringList packetNames = {"None", "Datapoint", "SweepSettings", "ManualStatusV1", "ManualControlV1", "DeviceInfo", "FirmwarePacket", "Ack",
|
static const QStringList packetNames = {"None", "Datapoint", "SweepSettings", "ManualStatus", "ManualControl", "DeviceInfo", "FirmwarePacket", "Ack",
|
||||||
"ClearFlash", "PerformFirmwareUpdate", "Nack", "Reference", "Generator", "SpectrumAnalyzerSettings",
|
"ClearFlash", "PerformFirmwareUpdate", "Nack", "Reference", "Generator", "SpectrumAnalyzerSettings",
|
||||||
"SpectrumAnalyzerResult", "RequestDeviceInfo", "RequestSourceCal", "RequestReceiverCal", "SourceCalPoint",
|
"SpectrumAnalyzerResult", "RequestDeviceInfo", "RequestSourceCal", "RequestReceiverCal", "SourceCalPoint",
|
||||||
"ReceiverCalPoint", "SetIdle", "RequestFrequencyCorrection", "FrequencyCorrection", "RequestAcquisitionFrequencySettings",
|
"ReceiverCalPoint", "SetIdle", "RequestFrequencyCorrection", "FrequencyCorrection", "RequestDeviceConfiguration",
|
||||||
"AcquisitionFrequencySettings", "DeviceStatusV1", "RequestDeviceStatus", "VNADatapoint", "SetTrigger", "ClearTrigger"};
|
"DeviceConfiguration", "DeviceStatus", "RequestDeviceStatus", "VNADatapoint", "SetTrigger", "ClearTrigger"};
|
||||||
|
|
||||||
item->setData(3, Qt::DisplayRole, "Type "+QString::number((int)e.p->type)+"("+packetNames[(int)e.p->type]+")");
|
item->setData(3, Qt::DisplayRole, "Type "+QString::number((int)e.p->type)+"("+packetNames[(int)e.p->type]+")");
|
||||||
auto addDouble = [=](QTreeWidgetItem *parent, QString name, double value, QString unit = "", int precision = 8) {
|
auto addDouble = [=](QTreeWidgetItem *parent, QString name, double value, QString unit = "", int precision = 8) {
|
||||||
@ -177,18 +179,31 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
|
|||||||
addInteger(item, "Active port", s.activePort);
|
addInteger(item, "Active port", s.activePort);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::DeviceStatusV1: {
|
case Protocol::PacketType::DeviceStatus: {
|
||||||
Protocol::DeviceStatusV1 s = e.p->statusV1;
|
auto s = e.p->status.V1;
|
||||||
addBool(item, "External reference available", s.extRefAvailable);
|
auto V1 = new QTreeWidgetItem();
|
||||||
addBool(item, "External reference in use", s.extRefInUse);
|
V1->setData(2, Qt::DisplayRole, "V1");
|
||||||
addBool(item, "FPGA configured", s.FPGA_configured);
|
item->addChild(V1);
|
||||||
addBool(item, "Source locked", s.source_locked);
|
addBool(V1, "External reference available", s.extRefAvailable);
|
||||||
addBool(item, "1.LO locked", s.LO1_locked);
|
addBool(V1, "External reference in use", s.extRefInUse);
|
||||||
addBool(item, "ADC overload", s.ADC_overload);
|
addBool(V1, "FPGA configured", s.FPGA_configured);
|
||||||
addBool(item, "Unlevel", s.unlevel);
|
addBool(V1, "Source locked", s.source_locked);
|
||||||
addInteger(item, "Source temperature", s.temp_source);
|
addBool(V1, "1.LO locked", s.LO1_locked);
|
||||||
addInteger(item, "1.LO temperature", s.temp_LO1);
|
addBool(V1, "ADC overload", s.ADC_overload);
|
||||||
addInteger(item, "MCU temperature", s.temp_MCU);
|
addBool(V1, "Unlevel", s.unlevel);
|
||||||
|
addInteger(V1, "Source temperature", s.temp_source);
|
||||||
|
addInteger(V1, "1.LO temperature", s.temp_LO1);
|
||||||
|
addInteger(V1, "MCU temperature", s.temp_MCU);
|
||||||
|
|
||||||
|
auto sFF = e.p->status.VFF;
|
||||||
|
auto VFF = new QTreeWidgetItem();
|
||||||
|
VFF->setData(2, Qt::DisplayRole, "VFF");
|
||||||
|
item->addChild(VFF);
|
||||||
|
addBool(VFF, "Source locked", sFF.source_locked);
|
||||||
|
addBool(VFF, "LO locked", sFF.LO_locked);
|
||||||
|
addBool(VFF, "ADC overload", sFF.ADC_overload);
|
||||||
|
addBool(VFF, "Unlevel", sFF.unlevel);
|
||||||
|
addInteger(VFF, "MCU temperature", s.temp_MCU);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::DeviceInfo: {
|
case Protocol::PacketType::DeviceInfo: {
|
||||||
@ -212,8 +227,8 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
|
|||||||
addDouble(item, "Maximum harmonic frequency", s.limits_maxFreqHarmonic, "Hz");
|
addDouble(item, "Maximum harmonic frequency", s.limits_maxFreqHarmonic, "Hz");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::ManualControlV1:
|
case Protocol::PacketType::ManualControl:
|
||||||
case Protocol::PacketType::ManualStatusV1:
|
case Protocol::PacketType::ManualStatus:
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::SpectrumAnalyzerSettings: {
|
case Protocol::PacketType::SpectrumAnalyzerSettings: {
|
||||||
@ -295,11 +310,23 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
|
|||||||
addDouble(item, "ppm", s.ppm, "");
|
addDouble(item, "ppm", s.ppm, "");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::AcquisitionFrequencySettings: {
|
case Protocol::PacketType::DeviceConfiguration: {
|
||||||
Protocol::AcquisitionFrequencySettings s = e.p->acquisitionFrequencySettings;
|
auto s1 = e.p->deviceConfig.V1;
|
||||||
addDouble(item, "1.IF", s.IF1, "Hz");
|
auto V1 = new QTreeWidgetItem();
|
||||||
addInteger(item, "ADC prescaler", s.ADCprescaler);
|
V1->setData(2, Qt::DisplayRole, "V1");
|
||||||
addInteger(item, "DFT phase increment", s.DFTphaseInc);
|
item->addChild(V1);
|
||||||
|
addDouble(V1, "1.IF", s1.IF1, "Hz");
|
||||||
|
addInteger(V1, "ADC prescaler", s1.ADCprescaler);
|
||||||
|
addInteger(V1, "DFT phase increment", s1.DFTphaseInc);
|
||||||
|
|
||||||
|
auto sFF = e.p->deviceConfig.VFF;
|
||||||
|
auto VFF = new QTreeWidgetItem();
|
||||||
|
VFF->setData(2, Qt::DisplayRole, "VFF");
|
||||||
|
item->addChild(VFF);
|
||||||
|
addBool(VFF, "DHCP enabled", sFF.dhcp);
|
||||||
|
addString(VFF, "IP", QHostAddress(qFromBigEndian(sFF.ip)).toString());
|
||||||
|
addString(VFF, "Mask", QHostAddress(qFromBigEndian(sFF.mask)).toString());
|
||||||
|
addString(VFF, "Gateway", QHostAddress(qFromBigEndian(sFF.gw)).toString());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "librevnadriver.h"
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
#include "manualcontroldialog.h"
|
#include "manualcontroldialogV1.h"
|
||||||
|
#include "manualcontroldialogvff.h"
|
||||||
|
#include "deviceconfigurationdialogv1.h"
|
||||||
|
#include "deviceconfigurationdialogvff.h"
|
||||||
#include "firmwareupdatedialog.h"
|
#include "firmwareupdatedialog.h"
|
||||||
#include "frequencycaldialog.h"
|
#include "frequencycaldialog.h"
|
||||||
#include "sourcecaldialog.h"
|
#include "sourcecaldialog.h"
|
||||||
@ -113,11 +116,38 @@ LibreVNADriver::LibreVNADriver()
|
|||||||
|
|
||||||
auto manual = new QAction("Manual Control");
|
auto manual = new QAction("Manual Control");
|
||||||
connect(manual, &QAction::triggered, this, [=](){
|
connect(manual, &QAction::triggered, this, [=](){
|
||||||
auto d = new ManualControlDialog(*this);
|
QDialog *d = nullptr;
|
||||||
|
switch(hardwareVersion) {
|
||||||
|
case 1:
|
||||||
|
d = new ManualControlDialogV1(*this);
|
||||||
|
break;
|
||||||
|
case 0xFF:
|
||||||
|
d = new ManualControlDialogVFF(*this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(d) {
|
||||||
d->show();
|
d->show();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
specificActions.push_back(manual);
|
specificActions.push_back(manual);
|
||||||
|
|
||||||
|
auto config = new QAction("Configuration");
|
||||||
|
connect(config, &QAction::triggered, this, [=](){
|
||||||
|
QDialog *d = nullptr;
|
||||||
|
switch(hardwareVersion) {
|
||||||
|
case 1:
|
||||||
|
d = new DeviceConfigurationDialogV1(*this);
|
||||||
|
break;
|
||||||
|
case 0xFF:
|
||||||
|
d = new DeviceConfigurationDialogVFF(*this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(d) {
|
||||||
|
d->show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
specificActions.push_back(config);
|
||||||
|
|
||||||
auto update = new QAction("Firmware Update");
|
auto update = new QAction("Firmware Update");
|
||||||
connect(update, &QAction::triggered, this, [=](){
|
connect(update, &QAction::triggered, this, [=](){
|
||||||
auto d = new FirmwareUpdateDialog(this);
|
auto d = new FirmwareUpdateDialog(this);
|
||||||
@ -165,18 +195,33 @@ LibreVNADriver::LibreVNADriver()
|
|||||||
std::set<DeviceDriver::Flag> LibreVNADriver::getFlags()
|
std::set<DeviceDriver::Flag> LibreVNADriver::getFlags()
|
||||||
{
|
{
|
||||||
std::set<DeviceDriver::Flag> ret;
|
std::set<DeviceDriver::Flag> ret;
|
||||||
if(lastStatus.extRefInUse) {
|
switch(hardwareVersion) {
|
||||||
|
case 1:
|
||||||
|
if(lastStatus.V1.extRefInUse) {
|
||||||
ret.insert(Flag::ExtRef);
|
ret.insert(Flag::ExtRef);
|
||||||
}
|
}
|
||||||
if(!lastStatus.source_locked || !lastStatus.LO1_locked) {
|
if(!lastStatus.V1.source_locked || !lastStatus.V1.LO1_locked) {
|
||||||
ret.insert(Flag::Unlocked);
|
ret.insert(Flag::Unlocked);
|
||||||
}
|
}
|
||||||
if(lastStatus.unlevel) {
|
if(lastStatus.V1.unlevel) {
|
||||||
ret.insert(Flag::Unlevel);
|
ret.insert(Flag::Unlevel);
|
||||||
}
|
}
|
||||||
if(lastStatus.ADC_overload) {
|
if(lastStatus.V1.ADC_overload) {
|
||||||
ret.insert(Flag::Overload);
|
ret.insert(Flag::Overload);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 0xFF:
|
||||||
|
if(!lastStatus.VFF.source_locked || !lastStatus.VFF.LO_locked) {
|
||||||
|
ret.insert(Flag::Unlocked);
|
||||||
|
}
|
||||||
|
if(lastStatus.VFF.unlevel) {
|
||||||
|
ret.insert(Flag::Unlevel);
|
||||||
|
}
|
||||||
|
if(lastStatus.VFF.ADC_overload) {
|
||||||
|
ret.insert(Flag::Overload);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,16 +231,23 @@ QString LibreVNADriver::getStatus()
|
|||||||
ret.append("HW ");
|
ret.append("HW ");
|
||||||
ret.append(info.hardware_version);
|
ret.append(info.hardware_version);
|
||||||
ret.append(" FW "+info.firmware_version);
|
ret.append(" FW "+info.firmware_version);
|
||||||
ret.append(" Temps: "+QString::number(lastStatus.temp_source)+"°C/"+QString::number(lastStatus.temp_LO1)+"°C/"+QString::number(lastStatus.temp_MCU)+"°C");
|
switch (hardwareVersion) {
|
||||||
|
case 1:
|
||||||
|
ret.append(" Temps: "+QString::number(lastStatus.V1.temp_source)+"°C/"+QString::number(lastStatus.V1.temp_LO1)+"°C/"+QString::number(lastStatus.V1.temp_MCU)+"°C");
|
||||||
ret.append(" Reference:");
|
ret.append(" Reference:");
|
||||||
if(lastStatus.extRefInUse) {
|
if(lastStatus.V1.extRefInUse) {
|
||||||
ret.append("External");
|
ret.append("External");
|
||||||
} else {
|
} else {
|
||||||
ret.append("Internal");
|
ret.append("Internal");
|
||||||
if(lastStatus.extRefAvailable) {
|
if(lastStatus.V1.extRefAvailable) {
|
||||||
ret.append(" (External available)");
|
ret.append(" (External available)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 0xFF:
|
||||||
|
ret.append("MCU Temp: "+QString::number(lastStatus.VFF.temp_MCU)+"°C");
|
||||||
|
break;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,35 +271,6 @@ QWidget *LibreVNADriver::createSettingsWidget()
|
|||||||
ui->DFTlimitRBW->setPrecision(3);
|
ui->DFTlimitRBW->setPrecision(3);
|
||||||
ui->DFTlimitRBW->setValue(SARBWLimitForDFT);
|
ui->DFTlimitRBW->setValue(SARBWLimitForDFT);
|
||||||
|
|
||||||
auto updateADCRate = [=]() {
|
|
||||||
// update ADC rate, see FPGA protocol for calculation
|
|
||||||
ui->ADCRate->setValue(102400000.0 / ui->ADCpresc->value());
|
|
||||||
};
|
|
||||||
auto updateIF2 = [=]() {
|
|
||||||
auto ADCrate = ui->ADCRate->value();
|
|
||||||
ui->IF2->setValue(ADCrate * ui->ADCphaseInc->value() / 4096);
|
|
||||||
};
|
|
||||||
|
|
||||||
connect(ui->ADCpresc, qOverload<int>(&QSpinBox::valueChanged), updateADCRate);
|
|
||||||
connect(ui->ADCpresc, qOverload<int>(&QSpinBox::valueChanged), updateIF2);
|
|
||||||
connect(ui->ADCphaseInc, qOverload<int>(&QSpinBox::valueChanged), updateIF2);
|
|
||||||
|
|
||||||
ui->IF1->setUnit("Hz");
|
|
||||||
ui->IF1->setPrefixes(" kM");
|
|
||||||
ui->IF1->setPrecision(5);
|
|
||||||
ui->ADCRate->setUnit("Hz");
|
|
||||||
ui->ADCRate->setPrefixes(" kM");
|
|
||||||
ui->ADCRate->setPrecision(5);
|
|
||||||
ui->IF2->setUnit("Hz");
|
|
||||||
ui->IF2->setPrefixes(" kM");
|
|
||||||
ui->IF2->setPrecision(5);
|
|
||||||
ui->IF1->setValue(IF1);
|
|
||||||
ui->ADCpresc->setValue(ADCprescaler);
|
|
||||||
ui->ADCphaseInc->setValue(DFTPhaseInc);
|
|
||||||
|
|
||||||
updateADCRate();
|
|
||||||
updateIF2();
|
|
||||||
|
|
||||||
connect(ui->UseHarmonicMixing, &QCheckBox::toggled, [=](bool enabled) {
|
connect(ui->UseHarmonicMixing, &QCheckBox::toggled, [=](bool enabled) {
|
||||||
if(enabled) {
|
if(enabled) {
|
||||||
InformationBox::ShowMessage("Harmonic Mixing", "When harmonic mixing is enabled, the frequency range of the VNA is (theoretically) extended up to 18GHz "
|
InformationBox::ShowMessage("Harmonic Mixing", "When harmonic mixing is enabled, the frequency range of the VNA is (theoretically) extended up to 18GHz "
|
||||||
@ -280,15 +303,6 @@ QWidget *LibreVNADriver::createSettingsWidget()
|
|||||||
connect(ui->DFTlimitRBW, &SIUnitEdit::valueChanged, this, [=](){
|
connect(ui->DFTlimitRBW, &SIUnitEdit::valueChanged, this, [=](){
|
||||||
SARBWLimitForDFT = ui->DFTlimitRBW->value();
|
SARBWLimitForDFT = ui->DFTlimitRBW->value();
|
||||||
});
|
});
|
||||||
connect(ui->IF1, &SIUnitEdit::valueChanged, this, [=](){
|
|
||||||
IF1 = ui->IF1->value();
|
|
||||||
});
|
|
||||||
connect(ui->ADCpresc, qOverload<int>(&QSpinBox::valueChanged), this, [=](){
|
|
||||||
ADCprescaler = ui->ADCpresc->value();
|
|
||||||
});
|
|
||||||
connect(ui->ADCphaseInc, qOverload<int>(&QSpinBox::valueChanged), this, [=](){
|
|
||||||
DFTPhaseInc = ui->ADCphaseInc->value();
|
|
||||||
});
|
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@ -593,8 +607,8 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
|
|||||||
emit InfoUpdated();
|
emit InfoUpdated();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::DeviceStatusV1:
|
case Protocol::PacketType::DeviceStatus:
|
||||||
lastStatus = packet.statusV1;
|
lastStatus = packet.status;
|
||||||
emit StatusUpdated();
|
emit StatusUpdated();
|
||||||
emit FlagsUpdated();
|
emit FlagsUpdated();
|
||||||
break;
|
break;
|
||||||
@ -650,16 +664,6 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibreVNADriver::updateIFFrequencies()
|
|
||||||
{
|
|
||||||
Protocol::PacketInfo p;
|
|
||||||
p.type = Protocol::PacketType::AcquisitionFrequencySettings;
|
|
||||||
p.acquisitionFrequencySettings.IF1 = IF1;
|
|
||||||
p.acquisitionFrequencySettings.ADCprescaler = ADCprescaler;
|
|
||||||
p.acquisitionFrequencySettings.DFTphaseInc = DFTPhaseInc;
|
|
||||||
SendPacket(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LibreVNADriver::hardwareVersionToString(uint8_t version)
|
QString LibreVNADriver::hardwareVersionToString(uint8_t version)
|
||||||
{
|
{
|
||||||
switch(version) {
|
switch(version) {
|
||||||
|
@ -191,7 +191,6 @@ signals:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void handleReceivedPacket(const Protocol::PacketInfo& packet);
|
void handleReceivedPacket(const Protocol::PacketInfo& packet);
|
||||||
protected:
|
protected:
|
||||||
void updateIFFrequencies();
|
|
||||||
QString hardwareVersionToString(uint8_t version);
|
QString hardwareVersionToString(uint8_t version);
|
||||||
|
|
||||||
bool connected;
|
bool connected;
|
||||||
@ -200,7 +199,7 @@ protected:
|
|||||||
uint8_t hardwareVersion;
|
uint8_t hardwareVersion;
|
||||||
unsigned int limits_maxAmplitudePoints;
|
unsigned int limits_maxAmplitudePoints;
|
||||||
|
|
||||||
Protocol::DeviceStatusV1 lastStatus;
|
Protocol::DeviceStatus lastStatus;
|
||||||
|
|
||||||
bool skipOwnPacketHandling;
|
bool skipOwnPacketHandling;
|
||||||
bool zerospan;
|
bool zerospan;
|
||||||
@ -219,9 +218,6 @@ protected:
|
|||||||
double SARBWLimitForDFT;
|
double SARBWLimitForDFT;
|
||||||
bool VNASuppressInvalidPeaks;
|
bool VNASuppressInvalidPeaks;
|
||||||
bool VNAAdjustPowerLevel;
|
bool VNAAdjustPowerLevel;
|
||||||
double IF1;
|
|
||||||
unsigned int ADCprescaler;
|
|
||||||
unsigned int DFTPhaseInc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Protocol::PacketInfo)
|
Q_DECLARE_METATYPE(Protocol::PacketInfo)
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>615</width>
|
<width>545</width>
|
||||||
<height>598</height>
|
<height>417</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -100,115 +100,17 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_15">
|
<spacer name="verticalSpacer">
|
||||||
<property name="title">
|
<property name="orientation">
|
||||||
<string>IF frequencies</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<widget class="QLabel" name="label_34">
|
<width>20</width>
|
||||||
<property name="text">
|
<height>40</height>
|
||||||
<string>This section contains advanced system settings. It is recommended to leave them at default values unless you know what you are doing. Slight changes of the IF frequencies can be used to shift possible spikes to less problematic frequencies. Large changes of these frequencies may severely impact device performance.</string>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
</spacer>
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_29">
|
|
||||||
<property name="text">
|
|
||||||
<string>IF 1:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="SIUnitEdit" name="IF1">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Frequency of the first IF</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_30">
|
|
||||||
<property name="text">
|
|
||||||
<string>ADC prescaler:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="ADCpresc">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>ADC prescaler in FPGA. The ADC sample rate is determined by 102.4MHz/prescaler</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>112</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>255</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>128</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_31">
|
|
||||||
<property name="text">
|
|
||||||
<string>ADC sample rate:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="SIUnitEdit" name="ADCRate">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_32">
|
|
||||||
<property name="text">
|
|
||||||
<string>Phase increment:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QSpinBox" name="ADCphaseInc">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Phase increment per ADC sample. Together with the ADC sample rate this determines the frequency of the second IF</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>4095</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>1280</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_33">
|
|
||||||
<property name="text">
|
|
||||||
<string>IF 2:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="SIUnitEdit" name="IF2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -52,9 +52,6 @@ LibreVNATCPDriver::LibreVNATCPDriver()
|
|||||||
specificSettings.push_back(Savable::SettingDescription(&VNAAdjustPowerLevel, "LibreVNATCPDriver.adjustPowerLevel", false));
|
specificSettings.push_back(Savable::SettingDescription(&VNAAdjustPowerLevel, "LibreVNATCPDriver.adjustPowerLevel", false));
|
||||||
specificSettings.push_back(Savable::SettingDescription(&SAUseDFT, "LibreVNATCPDriver.useDFT", true));
|
specificSettings.push_back(Savable::SettingDescription(&SAUseDFT, "LibreVNATCPDriver.useDFT", true));
|
||||||
specificSettings.push_back(Savable::SettingDescription(&SARBWLimitForDFT, "LibreVNATCPDriver.RBWlimitDFT", 3000));
|
specificSettings.push_back(Savable::SettingDescription(&SARBWLimitForDFT, "LibreVNATCPDriver.RBWlimitDFT", 3000));
|
||||||
specificSettings.push_back(Savable::SettingDescription(&IF1, "LibreVNATCPDriver.IF1", 62000000));
|
|
||||||
specificSettings.push_back(Savable::SettingDescription(&ADCprescaler, "LibreVNATCPDriver.ADCprescaler", 128));
|
|
||||||
specificSettings.push_back(Savable::SettingDescription(&DFTPhaseInc, "LibreVNATCPDriver.DFTPhaseInc", 1280));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LibreVNATCPDriver::getDriverName()
|
QString LibreVNATCPDriver::getDriverName()
|
||||||
@ -74,7 +71,9 @@ std::set<QString> LibreVNATCPDriver::GetAvailableDevices()
|
|||||||
data.append("\r\n"
|
data.append("\r\n"
|
||||||
"\r\n");
|
"\r\n");
|
||||||
|
|
||||||
pruneDetectedDevices();
|
// just delete everything instead of keeping old entries (they will answer again if they are still available)
|
||||||
|
detectedDevices.clear();
|
||||||
|
// pruneDetectedDevices();
|
||||||
for(auto s : ssdpSockets) {
|
for(auto s : ssdpSockets) {
|
||||||
s->writeDatagram(data.data(), SSDPaddress, SSDPport);
|
s->writeDatagram(data.data(), SSDPaddress, SSDPport);
|
||||||
}
|
}
|
||||||
@ -144,7 +143,7 @@ bool LibreVNATCPDriver::connectTo(QString serial)
|
|||||||
|
|
||||||
sendWithoutPayload(Protocol::PacketType::RequestDeviceInfo);
|
sendWithoutPayload(Protocol::PacketType::RequestDeviceInfo);
|
||||||
sendWithoutPayload(Protocol::PacketType::RequestDeviceStatus);
|
sendWithoutPayload(Protocol::PacketType::RequestDeviceStatus);
|
||||||
updateIFFrequencies();
|
// updateIFFrequencies();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,9 +134,6 @@ LibreVNAUSBDriver::LibreVNAUSBDriver()
|
|||||||
specificSettings.push_back(Savable::SettingDescription(&VNAAdjustPowerLevel, "LibreVNAUSBDriver.adjustPowerLevel", false));
|
specificSettings.push_back(Savable::SettingDescription(&VNAAdjustPowerLevel, "LibreVNAUSBDriver.adjustPowerLevel", false));
|
||||||
specificSettings.push_back(Savable::SettingDescription(&SAUseDFT, "LibreVNAUSBDriver.useDFT", true));
|
specificSettings.push_back(Savable::SettingDescription(&SAUseDFT, "LibreVNAUSBDriver.useDFT", true));
|
||||||
specificSettings.push_back(Savable::SettingDescription(&SARBWLimitForDFT, "LibreVNAUSBDriver.RBWlimitDFT", 3000));
|
specificSettings.push_back(Savable::SettingDescription(&SARBWLimitForDFT, "LibreVNAUSBDriver.RBWlimitDFT", 3000));
|
||||||
specificSettings.push_back(Savable::SettingDescription(&IF1, "LibreVNAUSBDriver.IF1", 62000000));
|
|
||||||
specificSettings.push_back(Savable::SettingDescription(&ADCprescaler, "LibreVNAUSBDriver.ADCprescaler", 128));
|
|
||||||
specificSettings.push_back(Savable::SettingDescription(&DFTPhaseInc, "LibreVNAUSBDriver.DFTPhaseInc", 1280));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LibreVNAUSBDriver::getDriverName()
|
QString LibreVNAUSBDriver::getDriverName()
|
||||||
@ -230,7 +227,7 @@ bool LibreVNAUSBDriver::connectTo(QString serial)
|
|||||||
|
|
||||||
sendWithoutPayload(Protocol::PacketType::RequestDeviceInfo);
|
sendWithoutPayload(Protocol::PacketType::RequestDeviceInfo);
|
||||||
sendWithoutPayload(Protocol::PacketType::RequestDeviceStatus);
|
sendWithoutPayload(Protocol::PacketType::RequestDeviceStatus);
|
||||||
updateIFFrequencies();
|
// updateIFFrequencies();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "manualcontroldialog.h"
|
#include "manualcontroldialogV1.h"
|
||||||
|
|
||||||
#include "ui_manualcontroldialog.h"
|
#include "ui_manualcontroldialogV1.h"
|
||||||
#include "Util/util.h"
|
#include "Util/util.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ManualControlDialog::ManualControlDialog(LibreVNADriver &dev, QWidget *parent) :
|
ManualControlDialogV1::ManualControlDialogV1(LibreVNADriver &dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::ManualControlDialog),
|
ui(new Ui::ManualControlDialogV1),
|
||||||
dev(dev)
|
dev(dev)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -152,8 +152,8 @@ ManualControlDialog::ManualControlDialog(LibreVNADriver &dev, QWidget *parent) :
|
|||||||
MakeReadOnly(ui->refphase);
|
MakeReadOnly(ui->refphase);
|
||||||
|
|
||||||
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p){
|
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p){
|
||||||
if(p.type == Protocol::PacketType::ManualStatusV1) {
|
if(p.type == Protocol::PacketType::ManualStatus) {
|
||||||
NewStatus(p.manualStatusV1);
|
NewStatus(p.manualStatus);
|
||||||
}
|
}
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
|
|
||||||
@ -189,38 +189,38 @@ ManualControlDialog::ManualControlDialog(LibreVNADriver &dev, QWidget *parent) :
|
|||||||
UpdateDevice();
|
UpdateDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
ManualControlDialog::~ManualControlDialog()
|
ManualControlDialogV1::~ManualControlDialogV1()
|
||||||
{
|
{
|
||||||
emit dev.releaseControl();
|
emit dev.releaseControl();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setHighSourceChipEnable(bool enable)
|
void ManualControlDialogV1::setHighSourceChipEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->SourceCE->setChecked(enable);
|
ui->SourceCE->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getHighSourceChipEnable()
|
bool ManualControlDialogV1::getHighSourceChipEnable()
|
||||||
{
|
{
|
||||||
return ui->SourceCE->isChecked();
|
return ui->SourceCE->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setHighSourceRFEnable(bool enable)
|
void ManualControlDialogV1::setHighSourceRFEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->SourceRFEN->setChecked(enable);
|
ui->SourceRFEN->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getHighSourceRFEnable()
|
bool ManualControlDialogV1::getHighSourceRFEnable()
|
||||||
{
|
{
|
||||||
return ui->SourceRFEN->isChecked();
|
return ui->SourceRFEN->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getHighSourceLocked()
|
bool ManualControlDialogV1::getHighSourceLocked()
|
||||||
{
|
{
|
||||||
return ui->SourceLocked->isChecked();
|
return ui->SourceLocked->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::setHighSourcePower(int dBm)
|
bool ManualControlDialogV1::setHighSourcePower(int dBm)
|
||||||
{
|
{
|
||||||
switch(dBm) {
|
switch(dBm) {
|
||||||
case -4:
|
case -4:
|
||||||
@ -242,23 +242,23 @@ bool ManualControlDialog::setHighSourcePower(int dBm)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getHighSourcePower()
|
int ManualControlDialogV1::getHighSourcePower()
|
||||||
{
|
{
|
||||||
int powers[4] = {-4,-1,2,5};
|
int powers[4] = {-4,-1,2,5};
|
||||||
return powers[ui->SourceHighPower->currentIndex()];
|
return powers[ui->SourceHighPower->currentIndex()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setHighSourceFrequency(double f)
|
void ManualControlDialogV1::setHighSourceFrequency(double f)
|
||||||
{
|
{
|
||||||
ui->SourceHighFrequency->setValue(f);
|
ui->SourceHighFrequency->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getHighSourceFrequency()
|
double ManualControlDialogV1::getHighSourceFrequency()
|
||||||
{
|
{
|
||||||
return ui->SourceHighFrequency->value();
|
return ui->SourceHighFrequency->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setHighSourceLPF(ManualControlDialog::LPF lpf)
|
void ManualControlDialogV1::setHighSourceLPF(ManualControlDialogV1::LPF lpf)
|
||||||
{
|
{
|
||||||
switch(lpf) {
|
switch(lpf) {
|
||||||
case LPF::M947:
|
case LPF::M947:
|
||||||
@ -276,23 +276,23 @@ void ManualControlDialog::setHighSourceLPF(ManualControlDialog::LPF lpf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ManualControlDialog::LPF ManualControlDialog::getHighSourceLPF()
|
ManualControlDialogV1::LPF ManualControlDialogV1::getHighSourceLPF()
|
||||||
{
|
{
|
||||||
LPF lpfs[4] = {LPF::M947, LPF::M1880, LPF::M3500, LPF::None};
|
LPF lpfs[4] = {LPF::M947, LPF::M1880, LPF::M3500, LPF::None};
|
||||||
return lpfs[ui->SourceLowpass->currentIndex()];
|
return lpfs[ui->SourceLowpass->currentIndex()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLowSourceEnable(bool enable)
|
void ManualControlDialogV1::setLowSourceEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->SourceLowEnable->setChecked(enable);
|
ui->SourceLowEnable->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getLowSourceEnable()
|
bool ManualControlDialogV1::getLowSourceEnable()
|
||||||
{
|
{
|
||||||
return ui->SourceLowEnable->isChecked();
|
return ui->SourceLowEnable->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::setLowSourcePower(int mA)
|
bool ManualControlDialogV1::setLowSourcePower(int mA)
|
||||||
{
|
{
|
||||||
switch(mA) {
|
switch(mA) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -314,23 +314,23 @@ bool ManualControlDialog::setLowSourcePower(int mA)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getLowSourcePower()
|
int ManualControlDialogV1::getLowSourcePower()
|
||||||
{
|
{
|
||||||
int powers[4] = {2,4,6,8};
|
int powers[4] = {2,4,6,8};
|
||||||
return powers[ui->SourceLowPower->currentIndex()];
|
return powers[ui->SourceLowPower->currentIndex()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLowSourceFrequency(double f)
|
void ManualControlDialogV1::setLowSourceFrequency(double f)
|
||||||
{
|
{
|
||||||
ui->SourceLowFrequency->setValue(f);
|
ui->SourceLowFrequency->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getLowSourceFrequency()
|
double ManualControlDialogV1::getLowSourceFrequency()
|
||||||
{
|
{
|
||||||
return ui->SourceLowFrequency->value();
|
return ui->SourceLowFrequency->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setHighband(bool high)
|
void ManualControlDialogV1::setHighband(bool high)
|
||||||
{
|
{
|
||||||
if(high) {
|
if(high) {
|
||||||
ui->SwitchHighband->setChecked(true);
|
ui->SwitchHighband->setChecked(true);
|
||||||
@ -339,32 +339,32 @@ void ManualControlDialog::setHighband(bool high)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getHighband()
|
bool ManualControlDialogV1::getHighband()
|
||||||
{
|
{
|
||||||
return ui->SwitchHighband->isChecked();
|
return ui->SwitchHighband->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setAttenuator(double att)
|
void ManualControlDialogV1::setAttenuator(double att)
|
||||||
{
|
{
|
||||||
ui->Attenuator->setValue(att);
|
ui->Attenuator->setValue(att);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getAttenuator()
|
double ManualControlDialogV1::getAttenuator()
|
||||||
{
|
{
|
||||||
return ui->Attenuator->value();
|
return ui->Attenuator->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setAmplifierEnable(bool enable)
|
void ManualControlDialogV1::setAmplifierEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->AmplifierEnable->setChecked(enable);
|
ui->AmplifierEnable->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getAmplifierEnable()
|
bool ManualControlDialogV1::getAmplifierEnable()
|
||||||
{
|
{
|
||||||
return ui->AmplifierEnable->isChecked();
|
return ui->AmplifierEnable->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::setPortSwitch(int port)
|
bool ManualControlDialogV1::setPortSwitch(int port)
|
||||||
{
|
{
|
||||||
switch(port) {
|
switch(port) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -380,7 +380,7 @@ bool ManualControlDialog::setPortSwitch(int port)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getPortSwitch()
|
int ManualControlDialogV1::getPortSwitch()
|
||||||
{
|
{
|
||||||
if(ui->Port1Switch->isChecked()) {
|
if(ui->Port1Switch->isChecked()) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -389,223 +389,223 @@ int ManualControlDialog::getPortSwitch()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLO1ChipEnable(bool enable)
|
void ManualControlDialogV1::setLO1ChipEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->LO1CE->setChecked(enable);
|
ui->LO1CE->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getLO1ChipEnable()
|
bool ManualControlDialogV1::getLO1ChipEnable()
|
||||||
{
|
{
|
||||||
return ui->LO1CE->isChecked();
|
return ui->LO1CE->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLO1RFEnable(bool enable)
|
void ManualControlDialogV1::setLO1RFEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->LO1RFEN->setChecked(enable);
|
ui->LO1RFEN->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getLO1RFEnable()
|
bool ManualControlDialogV1::getLO1RFEnable()
|
||||||
{
|
{
|
||||||
return ui->LO1RFEN->isChecked();
|
return ui->LO1RFEN->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getLO1Locked()
|
bool ManualControlDialogV1::getLO1Locked()
|
||||||
{
|
{
|
||||||
return ui->LO1locked->isChecked();
|
return ui->LO1locked->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLO1Frequency(double f)
|
void ManualControlDialogV1::setLO1Frequency(double f)
|
||||||
{
|
{
|
||||||
ui->LO1FreqType->setCurrentIndex(1);
|
ui->LO1FreqType->setCurrentIndex(1);
|
||||||
ui->LO1Frequency->setValue(f);
|
ui->LO1Frequency->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getLO1Frequency()
|
double ManualControlDialogV1::getLO1Frequency()
|
||||||
{
|
{
|
||||||
return ui->LO1Frequency->value();
|
return ui->LO1Frequency->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setIF1Frequency(double f)
|
void ManualControlDialogV1::setIF1Frequency(double f)
|
||||||
{
|
{
|
||||||
ui->LO1FreqType->setCurrentIndex(0);
|
ui->LO1FreqType->setCurrentIndex(0);
|
||||||
ui->IF1->setValue(f);
|
ui->IF1->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getIF1Frequency()
|
double ManualControlDialogV1::getIF1Frequency()
|
||||||
{
|
{
|
||||||
return ui->IF1->value();
|
return ui->IF1->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLO2Enable(bool enable)
|
void ManualControlDialogV1::setLO2Enable(bool enable)
|
||||||
{
|
{
|
||||||
ui->LO2EN->setChecked(enable);
|
ui->LO2EN->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getLO2Enable()
|
bool ManualControlDialogV1::getLO2Enable()
|
||||||
{
|
{
|
||||||
return ui->LO2EN->isChecked();
|
return ui->LO2EN->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setLO2Frequency(double f)
|
void ManualControlDialogV1::setLO2Frequency(double f)
|
||||||
{
|
{
|
||||||
ui->LO2FreqType->setCurrentIndex(1);
|
ui->LO2FreqType->setCurrentIndex(1);
|
||||||
ui->LO2Frequency->setValue(f);
|
ui->LO2Frequency->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getLO2Frequency()
|
double ManualControlDialogV1::getLO2Frequency()
|
||||||
{
|
{
|
||||||
return ui->LO2Frequency->value();
|
return ui->LO2Frequency->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setIF2Frequency(double f)
|
void ManualControlDialogV1::setIF2Frequency(double f)
|
||||||
{
|
{
|
||||||
ui->LO2FreqType->setCurrentIndex(0);
|
ui->LO2FreqType->setCurrentIndex(0);
|
||||||
ui->IF2->setValue(f);
|
ui->IF2->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getIF2Frequency()
|
double ManualControlDialogV1::getIF2Frequency()
|
||||||
{
|
{
|
||||||
return ui->IF2->value();
|
return ui->IF2->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setPort1Enable(bool enable)
|
void ManualControlDialogV1::setPort1Enable(bool enable)
|
||||||
{
|
{
|
||||||
ui->Port1Enable->setChecked(enable);
|
ui->Port1Enable->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getPort1Enable()
|
bool ManualControlDialogV1::getPort1Enable()
|
||||||
{
|
{
|
||||||
return ui->Port1Enable->isChecked();
|
return ui->Port1Enable->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setPort2Enable(bool enable)
|
void ManualControlDialogV1::setPort2Enable(bool enable)
|
||||||
{
|
{
|
||||||
ui->Port2Enable->setChecked(enable);
|
ui->Port2Enable->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getPort2Enable()
|
bool ManualControlDialogV1::getPort2Enable()
|
||||||
{
|
{
|
||||||
return ui->Port2Enable->isChecked();
|
return ui->Port2Enable->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setRefEnable(bool enable)
|
void ManualControlDialogV1::setRefEnable(bool enable)
|
||||||
{
|
{
|
||||||
ui->RefEnable->setChecked(enable);
|
ui->RefEnable->setChecked(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualControlDialog::getRefEnable()
|
bool ManualControlDialogV1::getRefEnable()
|
||||||
{
|
{
|
||||||
return ui->RefEnable->isChecked();
|
return ui->RefEnable->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setNumSamples(int samples)
|
void ManualControlDialogV1::setNumSamples(int samples)
|
||||||
{
|
{
|
||||||
ui->Samples->setValue(samples);
|
ui->Samples->setValue(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getNumSamples()
|
int ManualControlDialogV1::getNumSamples()
|
||||||
{
|
{
|
||||||
return ui->Samples->value();
|
return ui->Samples->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::setWindow(ManualControlDialog::Window w)
|
void ManualControlDialogV1::setWindow(ManualControlDialogV1::Window w)
|
||||||
{
|
{
|
||||||
ui->cbWindow->setCurrentIndex((int) w);
|
ui->cbWindow->setCurrentIndex((int) w);
|
||||||
}
|
}
|
||||||
|
|
||||||
ManualControlDialog::Window ManualControlDialog::getWindow()
|
ManualControlDialogV1::Window ManualControlDialogV1::getWindow()
|
||||||
{
|
{
|
||||||
return (Window) ui->cbWindow->currentIndex();
|
return (Window) ui->cbWindow->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getPort1MinADC()
|
int ManualControlDialogV1::getPort1MinADC()
|
||||||
{
|
{
|
||||||
return ui->port1min->text().toInt();
|
return ui->port1min->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getPort1MaxADC()
|
int ManualControlDialogV1::getPort1MaxADC()
|
||||||
{
|
{
|
||||||
return ui->port1max->text().toInt();
|
return ui->port1max->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getPort1Magnitude()
|
double ManualControlDialogV1::getPort1Magnitude()
|
||||||
{
|
{
|
||||||
return ui->port1mag->text().toDouble();
|
return ui->port1mag->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getPort1Phase()
|
double ManualControlDialogV1::getPort1Phase()
|
||||||
{
|
{
|
||||||
return ui->port1phase->text().toDouble();
|
return ui->port1phase->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::complex<double> ManualControlDialog::getPort1Referenced()
|
std::complex<double> ManualControlDialogV1::getPort1Referenced()
|
||||||
{
|
{
|
||||||
return port1referenced;
|
return port1referenced;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getPort2MinADC()
|
int ManualControlDialogV1::getPort2MinADC()
|
||||||
{
|
{
|
||||||
return ui->port2min->text().toInt();
|
return ui->port2min->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getPort2MaxADC()
|
int ManualControlDialogV1::getPort2MaxADC()
|
||||||
{
|
{
|
||||||
return ui->port2max->text().toInt();
|
return ui->port2max->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getPort2Magnitude()
|
double ManualControlDialogV1::getPort2Magnitude()
|
||||||
{
|
{
|
||||||
return ui->port2mag->text().toDouble();
|
return ui->port2mag->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getPort2Phase()
|
double ManualControlDialogV1::getPort2Phase()
|
||||||
{
|
{
|
||||||
return ui->port2phase->text().toDouble();
|
return ui->port2phase->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::complex<double> ManualControlDialog::getPort2Referenced()
|
std::complex<double> ManualControlDialogV1::getPort2Referenced()
|
||||||
{
|
{
|
||||||
return port2referenced;
|
return port2referenced;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getRefMinADC()
|
int ManualControlDialogV1::getRefMinADC()
|
||||||
{
|
{
|
||||||
return ui->refmin->text().toInt();
|
return ui->refmin->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManualControlDialog::getRefMaxADC()
|
int ManualControlDialogV1::getRefMaxADC()
|
||||||
{
|
{
|
||||||
return ui->refmax->text().toInt();
|
return ui->refmax->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getRefMagnitude()
|
double ManualControlDialogV1::getRefMagnitude()
|
||||||
{
|
{
|
||||||
return ui->refmag->text().toDouble();
|
return ui->refmag->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ManualControlDialog::getRefPhase()
|
double ManualControlDialogV1::getRefPhase()
|
||||||
{
|
{
|
||||||
return ui->refphase->text().toDouble();
|
return ui->refphase->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::NewStatus(Protocol::ManualStatusV1 status)
|
void ManualControlDialogV1::NewStatus(Protocol::ManualStatus status)
|
||||||
{
|
{
|
||||||
// ADC values
|
// ADC values
|
||||||
ui->port1min->setText(QString::number(status.port1min));
|
ui->port1min->setText(QString::number(status.V1.port1min));
|
||||||
ui->port1max->setText(QString::number(status.port1max));
|
ui->port1max->setText(QString::number(status.V1.port1max));
|
||||||
auto port1 = complex<double>(status.port1real, status.port1imag);
|
auto port1 = complex<double>(status.V1.port1real, status.V1.port1imag);
|
||||||
ui->port1mag->setText(QString::number(abs(port1)));
|
ui->port1mag->setText(QString::number(abs(port1)));
|
||||||
ui->port1phase->setText(QString::number(arg(port1)*180/M_PI));
|
ui->port1phase->setText(QString::number(arg(port1)*180/M_PI));
|
||||||
|
|
||||||
ui->port2min->setText(QString::number(status.port2min));
|
ui->port2min->setText(QString::number(status.V1.port2min));
|
||||||
ui->port2max->setText(QString::number(status.port2max));
|
ui->port2max->setText(QString::number(status.V1.port2max));
|
||||||
auto port2 = complex<double>(status.port2real, status.port2imag);
|
auto port2 = complex<double>(status.V1.port2real, status.V1.port2imag);
|
||||||
ui->port2mag->setText(QString::number(abs(port2)));
|
ui->port2mag->setText(QString::number(abs(port2)));
|
||||||
ui->port2phase->setText(QString::number(arg(port2)*180/M_PI));
|
ui->port2phase->setText(QString::number(arg(port2)*180/M_PI));
|
||||||
|
|
||||||
ui->refmin->setText(QString::number(status.refmin));
|
ui->refmin->setText(QString::number(status.V1.refmin));
|
||||||
ui->refmax->setText(QString::number(status.refmax));
|
ui->refmax->setText(QString::number(status.V1.refmax));
|
||||||
auto ref = complex<double>(status.refreal, status.refimag);
|
auto ref = complex<double>(status.V1.refreal, status.V1.refimag);
|
||||||
ui->refmag->setText(QString::number(abs(ref)));
|
ui->refmag->setText(QString::number(abs(ref)));
|
||||||
ui->refphase->setText(QString::number(arg(ref)*180/M_PI));
|
ui->refphase->setText(QString::number(arg(ref)*180/M_PI));
|
||||||
|
|
||||||
@ -618,15 +618,15 @@ void ManualControlDialog::NewStatus(Protocol::ManualStatusV1 status)
|
|||||||
ui->port2referenced->setText(QString::number(port2db, 'f', 1) + "db@" + QString::number(arg(port2referenced)*180/M_PI, 'f', 0) + "°");
|
ui->port2referenced->setText(QString::number(port2db, 'f', 1) + "db@" + QString::number(arg(port2referenced)*180/M_PI, 'f', 0) + "°");
|
||||||
|
|
||||||
// PLL state
|
// PLL state
|
||||||
ui->SourceLocked->setChecked(status.source_locked);
|
ui->SourceLocked->setChecked(status.V1.source_locked);
|
||||||
ui->LO1locked->setChecked(status.LO_locked);
|
ui->LO1locked->setChecked(status.V1.LO_locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControlDialog::UpdateDevice()
|
void ManualControlDialogV1::UpdateDevice()
|
||||||
{
|
{
|
||||||
Protocol::PacketInfo p;
|
Protocol::PacketInfo p;
|
||||||
p.type = Protocol::PacketType::ManualControlV1;
|
p.type = Protocol::PacketType::ManualControl;
|
||||||
Protocol::ManualControlV1 &m = p.manual;
|
auto &m = p.manual.V1;
|
||||||
// Source highband
|
// Source highband
|
||||||
m.SourceHighCE = ui->SourceCE->isChecked();
|
m.SourceHighCE = ui->SourceCE->isChecked();
|
||||||
m.SourceHighRFEN = ui->SourceRFEN->isChecked();
|
m.SourceHighRFEN = ui->SourceRFEN->isChecked();
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef MANUALCONTROLDIALOG_H
|
#ifndef MANUALCONTROLDIALOGV1_H
|
||||||
#define MANUALCONTROLDIALOG_H
|
#define MANUALCONTROLDIALOGV1_H
|
||||||
|
|
||||||
#include "librevnadriver.h"
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
@ -7,16 +7,16 @@
|
|||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ManualControlDialog;
|
class ManualControlDialogV1;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ManualControlDialog : public QDialog
|
class ManualControlDialogV1 : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ManualControlDialog(LibreVNADriver &dev, QWidget *parent = nullptr);
|
explicit ManualControlDialogV1(LibreVNADriver &dev, QWidget *parent = nullptr);
|
||||||
~ManualControlDialog();
|
~ManualControlDialogV1();
|
||||||
|
|
||||||
void setHighSourceChipEnable(bool enable);
|
void setHighSourceChipEnable(bool enable);
|
||||||
bool getHighSourceChipEnable();
|
bool getHighSourceChipEnable();
|
||||||
@ -103,14 +103,14 @@ public:
|
|||||||
double getRefPhase();
|
double getRefPhase();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void NewStatus(Protocol::ManualStatusV1 status);
|
void NewStatus(Protocol::ManualStatus status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateDevice();
|
void UpdateDevice();
|
||||||
Ui::ManualControlDialog *ui;
|
Ui::ManualControlDialogV1 *ui;
|
||||||
LibreVNADriver &dev;
|
LibreVNADriver &dev;
|
||||||
std::complex<double> port1referenced;
|
std::complex<double> port1referenced;
|
||||||
std::complex<double> port2referenced;
|
std::complex<double> port2referenced;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MANUALCONTROLDIALOG_H
|
#endif // MANUALCONTROLDIALOGV1_H
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ManualControlDialog</class>
|
<class>ManualControlDialogV1</class>
|
||||||
<widget class="QDialog" name="ManualControlDialog">
|
<widget class="QDialog" name="ManualControlDialogV1">
|
||||||
<property name="windowModality">
|
<property name="windowModality">
|
||||||
<enum>Qt::ApplicationModal</enum>
|
<enum>Qt::ApplicationModal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -776,7 +776,7 @@
|
|||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="PortSwitchGroup"/>
|
|
||||||
<buttongroup name="SourceSwitchGroup"/>
|
<buttongroup name="SourceSwitchGroup"/>
|
||||||
|
<buttongroup name="PortSwitchGroup"/>
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
@ -0,0 +1,432 @@
|
|||||||
|
#include "manualcontroldialogvff.h"
|
||||||
|
|
||||||
|
#include "ui_manualcontroldialogvff.h"
|
||||||
|
#include "Util/util.h"
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <complex>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
ManualControlDialogVFF::ManualControlDialogVFF(LibreVNADriver &dev, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::ManualControlDialogVFF),
|
||||||
|
dev(dev)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
emit dev.acquireControl();
|
||||||
|
|
||||||
|
ui->SourceFrequency->setUnit("Hz");
|
||||||
|
ui->SourceFrequency->setPrefixes(" kMG");
|
||||||
|
ui->SourceFrequency->setPrecision(6);
|
||||||
|
ui->SourceFrequency->setValueQuiet(1000000000);
|
||||||
|
|
||||||
|
ui->IF->setUnit("Hz");
|
||||||
|
ui->IF->setPrefixes(" kM");
|
||||||
|
ui->IF->setPrecision(6);
|
||||||
|
|
||||||
|
ui->LOFrequency->setUnit("Hz");
|
||||||
|
ui->LOFrequency->setPrefixes(" kMG");
|
||||||
|
ui->LOFrequency->setPrecision(6);
|
||||||
|
|
||||||
|
auto UpdateLO = [=]() {
|
||||||
|
double sourceFreq = ui->SourceFrequency->value();
|
||||||
|
if (ui->LOFreqType->currentIndex() == 0) {
|
||||||
|
// fixed IF mode
|
||||||
|
ui->LOFrequency->setValueQuiet(sourceFreq + ui->IF->value());
|
||||||
|
} else {
|
||||||
|
// Manual Frequency mode
|
||||||
|
ui->IF->setValueQuiet(ui->LOFrequency->value() - sourceFreq);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(ui->IF, &SIUnitEdit::valueChanged, [=](double) {
|
||||||
|
UpdateLO();
|
||||||
|
});
|
||||||
|
connect(ui->LOFrequency, &SIUnitEdit::valueChanged, [=](double) {
|
||||||
|
UpdateLO();
|
||||||
|
});
|
||||||
|
connect(ui->SourceFrequency, &SIUnitEdit::valueChanged, [=](double) {
|
||||||
|
UpdateLO();
|
||||||
|
});
|
||||||
|
|
||||||
|
ui->IF->setValue(100000);
|
||||||
|
|
||||||
|
// LO mode switch connections
|
||||||
|
connect(ui->LOFreqType, qOverload<int>(&QComboBox::activated), [=](int index) {
|
||||||
|
switch(index) {
|
||||||
|
case 0:
|
||||||
|
ui->LOFrequency->setEnabled(false);
|
||||||
|
ui->IF->setEnabled(true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ui->LOFrequency->setEnabled(true);
|
||||||
|
ui->IF->setEnabled(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Readonly widgets
|
||||||
|
auto MakeReadOnly = [](QWidget* w) {
|
||||||
|
w->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
w->setFocusPolicy(Qt::NoFocus);
|
||||||
|
};
|
||||||
|
MakeReadOnly(ui->SourceLocked);
|
||||||
|
MakeReadOnly(ui->LOlocked);
|
||||||
|
MakeReadOnly(ui->portmin);
|
||||||
|
MakeReadOnly(ui->portmax);
|
||||||
|
MakeReadOnly(ui->portmag);
|
||||||
|
MakeReadOnly(ui->portphase);
|
||||||
|
MakeReadOnly(ui->portreferenced);
|
||||||
|
MakeReadOnly(ui->refmin);
|
||||||
|
MakeReadOnly(ui->refmax);
|
||||||
|
MakeReadOnly(ui->refmag);
|
||||||
|
MakeReadOnly(ui->refphase);
|
||||||
|
|
||||||
|
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p){
|
||||||
|
if(p.type == Protocol::PacketType::ManualStatus) {
|
||||||
|
NewStatus(p.manualStatus);
|
||||||
|
}
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(ui->SourceCE, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->SourceRFEN, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->LOCE, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->LORFEN, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->SourceAmplifierEnable, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->Port1Enable, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->RefEnable, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->portgain, qOverload<int>(&QComboBox::currentIndexChanged), [=](int) { UpdateDevice(); });
|
||||||
|
connect(ui->refgain, qOverload<int>(&QComboBox::currentIndexChanged), [=](int) { UpdateDevice(); });
|
||||||
|
|
||||||
|
connect(ui->SourcePower, qOverload<int>(&QComboBox::currentIndexChanged), [=](int) { UpdateDevice(); });
|
||||||
|
connect(ui->SourceFrequency, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
|
||||||
|
connect(ui->LOAmplifierEnable, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->LOExternal, &QRadioButton::toggled, [=](bool) { UpdateDevice(); });
|
||||||
|
connect(ui->LOFrequency, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
|
||||||
|
connect(ui->IF, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
|
||||||
|
|
||||||
|
connect(ui->Attenuator, qOverload<double>(&QDoubleSpinBox::valueChanged), [=](double) { UpdateDevice(); });
|
||||||
|
connect(ui->Samples, qOverload<int>(&QSpinBox::valueChanged), [=](double) { UpdateDevice(); });
|
||||||
|
connect(ui->cbWindow, qOverload<int>(&QComboBox::activated), [=](int) { UpdateDevice(); });
|
||||||
|
|
||||||
|
UpdateDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
ManualControlDialogVFF::~ManualControlDialogVFF()
|
||||||
|
{
|
||||||
|
emit dev.releaseControl();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setSourceChipEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->SourceCE->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getSourceChipEnable()
|
||||||
|
{
|
||||||
|
return ui->SourceCE->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setSourceRFEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->SourceRFEN->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getSourceRFEnable()
|
||||||
|
{
|
||||||
|
return ui->SourceRFEN->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getSourceLocked()
|
||||||
|
{
|
||||||
|
return ui->SourceLocked->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr double powers[8] = {-1, +1, +2.5, +3.5, +4.5, +5.5, +6.5, +7};
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::setSourcePower(double dBm)
|
||||||
|
{
|
||||||
|
for(unsigned int i=0;i<8;i++) {
|
||||||
|
if(dBm == powers[i]) {
|
||||||
|
ui->SourcePower->setCurrentIndex(i);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// invalid power setting
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getSourcePower()
|
||||||
|
{
|
||||||
|
return powers[ui->SourcePower->currentIndex()];
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setSourceFrequency(double f)
|
||||||
|
{
|
||||||
|
ui->SourceFrequency->setValue(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getSourceFrequency()
|
||||||
|
{
|
||||||
|
return ui->SourceFrequency->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setAttenuator(double att)
|
||||||
|
{
|
||||||
|
ui->Attenuator->setValue(att);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getAttenuator()
|
||||||
|
{
|
||||||
|
return ui->Attenuator->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setSourceAmplifierEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->SourceAmplifierEnable->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getSourceAmplifierEnable()
|
||||||
|
{
|
||||||
|
return ui->SourceAmplifierEnable->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setLOAmplifierEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->LOAmplifierEnable->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getLOAmplifierEnable()
|
||||||
|
{
|
||||||
|
return ui->LOAmplifierEnable->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setLOPath(bool external)
|
||||||
|
{
|
||||||
|
if(external) {
|
||||||
|
ui->LOExternal->setChecked(true);
|
||||||
|
} else {
|
||||||
|
ui->LOInternal->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getLOPath()
|
||||||
|
{
|
||||||
|
return ui->LOExternal->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setLOChipEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->LOCE->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getLOChipEnable()
|
||||||
|
{
|
||||||
|
return ui->LOCE->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setLORFEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->LORFEN->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getLORFEnable()
|
||||||
|
{
|
||||||
|
return ui->LORFEN->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getLOLocked()
|
||||||
|
{
|
||||||
|
return ui->LOlocked->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setLOFrequency(double f)
|
||||||
|
{
|
||||||
|
ui->LOFreqType->setCurrentIndex(1);
|
||||||
|
ui->LOFrequency->setValue(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getLOFrequency()
|
||||||
|
{
|
||||||
|
return ui->LOFrequency->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setIFFrequency(double f)
|
||||||
|
{
|
||||||
|
ui->LOFreqType->setCurrentIndex(0);
|
||||||
|
ui->IF->setValue(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getIFFrequency()
|
||||||
|
{
|
||||||
|
return ui->IF->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setPortEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->Port1Enable->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getPortEnable()
|
||||||
|
{
|
||||||
|
return ui->Port1Enable->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setRefEnable(bool enable)
|
||||||
|
{
|
||||||
|
ui->RefEnable->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ManualControlDialogVFF::getRefEnable()
|
||||||
|
{
|
||||||
|
return ui->RefEnable->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setPortGain(Gain g)
|
||||||
|
{
|
||||||
|
ui->portgain->setCurrentIndex((int) g);
|
||||||
|
}
|
||||||
|
|
||||||
|
ManualControlDialogVFF::Gain ManualControlDialogVFF::getPortGain()
|
||||||
|
{
|
||||||
|
return (Gain) ui->portgain->currentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setRefGain(Gain g)
|
||||||
|
{
|
||||||
|
ui->refgain->setCurrentIndex((int) g);
|
||||||
|
}
|
||||||
|
|
||||||
|
ManualControlDialogVFF::Gain ManualControlDialogVFF::getRefGain()
|
||||||
|
{
|
||||||
|
return (Gain) ui->refgain->currentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setNumSamples(int samples)
|
||||||
|
{
|
||||||
|
ui->Samples->setValue(samples);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ManualControlDialogVFF::getNumSamples()
|
||||||
|
{
|
||||||
|
return ui->Samples->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::setWindow(ManualControlDialogVFF::Window w)
|
||||||
|
{
|
||||||
|
ui->cbWindow->setCurrentIndex((int) w);
|
||||||
|
}
|
||||||
|
|
||||||
|
ManualControlDialogVFF::Window ManualControlDialogVFF::getWindow()
|
||||||
|
{
|
||||||
|
return (Window) ui->cbWindow->currentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ManualControlDialogVFF::getPortMinADC()
|
||||||
|
{
|
||||||
|
return ui->portmin->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ManualControlDialogVFF::getPortMaxADC()
|
||||||
|
{
|
||||||
|
return ui->portmax->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getPortMagnitude()
|
||||||
|
{
|
||||||
|
return ui->portmag->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getPortPhase()
|
||||||
|
{
|
||||||
|
return ui->portphase->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::complex<double> ManualControlDialogVFF::getPortReferenced()
|
||||||
|
{
|
||||||
|
return portreferenced;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ManualControlDialogVFF::getRefMinADC()
|
||||||
|
{
|
||||||
|
return ui->refmin->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ManualControlDialogVFF::getRefMaxADC()
|
||||||
|
{
|
||||||
|
return ui->refmax->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getRefMagnitude()
|
||||||
|
{
|
||||||
|
return ui->refmag->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
double ManualControlDialogVFF::getRefPhase()
|
||||||
|
{
|
||||||
|
return ui->refphase->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::NewStatus(Protocol::ManualStatus status)
|
||||||
|
{
|
||||||
|
// ADC values
|
||||||
|
ui->portmin->setText(QString::number(status.VFF.portmin));
|
||||||
|
ui->portmax->setText(QString::number(status.VFF.portmax));
|
||||||
|
auto port = complex<double>(status.VFF.portreal, status.VFF.portimag);
|
||||||
|
ui->portmag->setText(QString::number(abs(port)));
|
||||||
|
ui->portphase->setText(QString::number(arg(port)*180/M_PI));
|
||||||
|
|
||||||
|
ui->refmin->setText(QString::number(status.VFF.refmin));
|
||||||
|
ui->refmax->setText(QString::number(status.VFF.refmax));
|
||||||
|
auto ref = complex<double>(status.VFF.refreal, status.VFF.refimag);
|
||||||
|
ui->refmag->setText(QString::number(abs(ref)));
|
||||||
|
ui->refphase->setText(QString::number(arg(ref)*180/M_PI));
|
||||||
|
|
||||||
|
portreferenced = port / ref;
|
||||||
|
auto portdb = Util::SparamTodB(portreferenced);
|
||||||
|
|
||||||
|
ui->portreferenced->setText(QString::number(portdb, 'f', 1) + "db@" + QString::number(arg(portreferenced)*180/M_PI, 'f', 0) + "°");
|
||||||
|
|
||||||
|
// PLL state
|
||||||
|
ui->SourceLocked->setChecked(status.VFF.source_locked);
|
||||||
|
ui->LOlocked->setChecked(status.VFF.LO_locked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManualControlDialogVFF::UpdateDevice()
|
||||||
|
{
|
||||||
|
Protocol::PacketInfo p;
|
||||||
|
p.type = Protocol::PacketType::ManualControl;
|
||||||
|
auto &m = p.manual.VFF;
|
||||||
|
// Source highband
|
||||||
|
m.SourceCE = ui->SourceCE->isChecked();
|
||||||
|
m.SourceRFEN = ui->SourceRFEN->isChecked();
|
||||||
|
m.SourcePower = ui->SourcePower->currentIndex();
|
||||||
|
m.SourceFrequency = ui->SourceFrequency->value();
|
||||||
|
m.SourceAmplifierEN = ui->SourceAmplifierEnable->isChecked();
|
||||||
|
m.attenuator = -ui->Attenuator->value() / 0.25;
|
||||||
|
// LO
|
||||||
|
m.LOCE = ui->LOCE->isChecked();
|
||||||
|
m.LORFEN = ui->LORFEN->isChecked();
|
||||||
|
m.LOAmplifierEN = ui->LOAmplifierEnable->isChecked();
|
||||||
|
m.LOexternal = ui->LOExternal->isChecked();
|
||||||
|
m.LOFrequency = ui->LOFrequency->value();
|
||||||
|
|
||||||
|
// Acquisition
|
||||||
|
m.PortEN = ui->Port1Enable->isChecked();
|
||||||
|
m.PortGain = ui->portgain->currentIndex();
|
||||||
|
m.RefEN = ui->RefEnable->isChecked();
|
||||||
|
m.RefGain = ui->refgain->currentIndex();
|
||||||
|
m.Samples = ui->Samples->value();
|
||||||
|
m.WindowType = ui->cbWindow->currentIndex();
|
||||||
|
|
||||||
|
qDebug() << "Updating manual control state";
|
||||||
|
|
||||||
|
dev.SendPacket(p);
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
#ifndef MANUALCONTROLDIALOGVFF_H
|
||||||
|
#define MANUALCONTROLDIALOGVFF_H
|
||||||
|
|
||||||
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <complex>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ManualControlDialogVFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ManualControlDialogVFF : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ManualControlDialogVFF(LibreVNADriver &dev, QWidget *parent = nullptr);
|
||||||
|
~ManualControlDialogVFF();
|
||||||
|
|
||||||
|
void setSourceChipEnable(bool enable);
|
||||||
|
bool getSourceChipEnable();
|
||||||
|
void setSourceRFEnable(bool enable);
|
||||||
|
bool getSourceRFEnable();
|
||||||
|
bool getSourceLocked();
|
||||||
|
bool setSourcePower(double dBm);
|
||||||
|
double getSourcePower();
|
||||||
|
void setSourceFrequency(double f);
|
||||||
|
double getSourceFrequency();
|
||||||
|
|
||||||
|
void setAttenuator(double att);
|
||||||
|
double getAttenuator();
|
||||||
|
void setSourceAmplifierEnable(bool enable);
|
||||||
|
bool getSourceAmplifierEnable();
|
||||||
|
void setLOAmplifierEnable(bool enable);
|
||||||
|
bool getLOAmplifierEnable();
|
||||||
|
|
||||||
|
void setLOPath(bool external);
|
||||||
|
bool getLOPath();
|
||||||
|
|
||||||
|
void setLOChipEnable(bool enable);
|
||||||
|
bool getLOChipEnable();
|
||||||
|
void setLORFEnable(bool enable);
|
||||||
|
bool getLORFEnable();
|
||||||
|
bool getLOLocked();
|
||||||
|
void setLOFrequency(double f);
|
||||||
|
double getLOFrequency();
|
||||||
|
void setIFFrequency(double f);
|
||||||
|
double getIFFrequency();
|
||||||
|
void setPortEnable(bool enable);
|
||||||
|
bool getPortEnable();
|
||||||
|
void setRefEnable(bool enable);
|
||||||
|
bool getRefEnable();
|
||||||
|
|
||||||
|
enum class Gain {
|
||||||
|
G1 = 0,
|
||||||
|
G10 = 1,
|
||||||
|
G20 = 2,
|
||||||
|
G30 = 3,
|
||||||
|
G40 = 4,
|
||||||
|
G60 = 5,
|
||||||
|
G80 = 6,
|
||||||
|
G120 = 7,
|
||||||
|
G157 = 8,
|
||||||
|
G0_25 = 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
void setPortGain(Gain g);
|
||||||
|
Gain getPortGain();
|
||||||
|
void setRefGain(Gain g);
|
||||||
|
Gain getRefGain();
|
||||||
|
|
||||||
|
void setNumSamples(int samples);
|
||||||
|
int getNumSamples();
|
||||||
|
|
||||||
|
enum class Window {
|
||||||
|
None = 0,
|
||||||
|
Kaiser = 1,
|
||||||
|
Hann = 2,
|
||||||
|
FlatTop = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
void setWindow(Window w);
|
||||||
|
Window getWindow();
|
||||||
|
|
||||||
|
int getPortMinADC();
|
||||||
|
int getPortMaxADC();
|
||||||
|
double getPortMagnitude();
|
||||||
|
double getPortPhase();
|
||||||
|
std::complex<double> getPortReferenced();
|
||||||
|
|
||||||
|
int getRefMinADC();
|
||||||
|
int getRefMaxADC();
|
||||||
|
double getRefMagnitude();
|
||||||
|
double getRefPhase();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void NewStatus(Protocol::ManualStatus status);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void UpdateDevice();
|
||||||
|
Ui::ManualControlDialogVFF *ui;
|
||||||
|
LibreVNADriver &dev;
|
||||||
|
std::complex<double> portreferenced;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MANUALCONTROLDIALOGVFF_H
|
@ -0,0 +1,676 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ManualControlDialogVFF</class>
|
||||||
|
<widget class="QDialog" name="ManualControlDialogVFF">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>724</width>
|
||||||
|
<height>464</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Manual System Control</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_10">
|
||||||
|
<property name="title">
|
||||||
|
<string>Signal Generation</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Source</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="SourceCE">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chip Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="SourceRFEN">
|
||||||
|
<property name="text">
|
||||||
|
<string>RF Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="SourceLocked">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Locked</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Power:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="SourcePower">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>-1dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+1dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+2.5dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+3.5dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+4.5dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+5.5dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+6.5dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>+7dBm</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Frequency:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="SIUnitEdit" name="SourceFrequency"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
<property name="title">
|
||||||
|
<string>Attenuator</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="Attenuator">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>db</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-31.750000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>0.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.250000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Amplifier</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="SourceAmplifierEnable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_11">
|
||||||
|
<property name="title">
|
||||||
|
<string>Signal Analysis</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="title">
|
||||||
|
<string>LO</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="LOCE">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chip Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="LORFEN">
|
||||||
|
<property name="text">
|
||||||
|
<string>RF Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="LOlocked">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Locked</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Freq. Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="LOFreqType">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>IF</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Absolute</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Frequency:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="SIUnitEdit" name="LOFrequency">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>IF1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="SIUnitEdit" name="IF"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>Amplifier</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="LOAmplifierEnable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Path</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="LOInternal">
|
||||||
|
<property name="text">
|
||||||
|
<string>Internal</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="LOExternal">
|
||||||
|
<property name="text">
|
||||||
|
<string>External</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_9">
|
||||||
|
<property name="title">
|
||||||
|
<string>Aquisition</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="Port1Enable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Port Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="RefEnable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reference Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_5">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="portgain">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>10V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>20V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>30V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>40V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>60V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>80V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>120V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>157V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>0.25V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="refgain">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>10V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>20V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>30V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>40V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>60V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>80V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>120V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>157V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>0.25V/V</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Samples:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="Samples">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>96</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>32000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>32000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="text">
|
||||||
|
<string>Window:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="cbWindow">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Kaiser</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hann</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Flat Top</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reference PGA gain:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Port PGA gain:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_12">
|
||||||
|
<property name="title">
|
||||||
|
<string>Measurements</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_16">
|
||||||
|
<property name="title">
|
||||||
|
<string>Port</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_9">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_25">
|
||||||
|
<property name="text">
|
||||||
|
<string>ADC min:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="portmin"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_26">
|
||||||
|
<property name="text">
|
||||||
|
<string>ADC max:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="portmax"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_27">
|
||||||
|
<property name="text">
|
||||||
|
<string>Magnitude:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="portmag"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_28">
|
||||||
|
<property name="text">
|
||||||
|
<string>Phase:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="portphase"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Referenced:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLineEdit" name="portreferenced"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_15">
|
||||||
|
<property name="title">
|
||||||
|
<string>Reference</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_8">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_21">
|
||||||
|
<property name="text">
|
||||||
|
<string>ADC min:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="refmin"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_22">
|
||||||
|
<property name="text">
|
||||||
|
<string>ADC max:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="refmax"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_23">
|
||||||
|
<property name="text">
|
||||||
|
<string>Magnitude:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="refmag"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_24">
|
||||||
|
<property name="text">
|
||||||
|
<string>Phase:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="refphase"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SIUnitEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>CustomWidgets/siunitedit.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="buttonGroup"/>
|
||||||
|
</buttongroups>
|
||||||
|
</ui>
|
@ -23,6 +23,8 @@ HEADERS += \
|
|||||||
Device/LibreVNA/Compound/compounddeviceeditdialog.h \
|
Device/LibreVNA/Compound/compounddeviceeditdialog.h \
|
||||||
Device/LibreVNA/Compound/compounddriver.h \
|
Device/LibreVNA/Compound/compounddriver.h \
|
||||||
Device/LibreVNA/amplitudecaldialog.h \
|
Device/LibreVNA/amplitudecaldialog.h \
|
||||||
|
Device/LibreVNA/deviceconfigurationdialogv1.h \
|
||||||
|
Device/LibreVNA/deviceconfigurationdialogvff.h \
|
||||||
Device/LibreVNA/devicepacketlog.h \
|
Device/LibreVNA/devicepacketlog.h \
|
||||||
Device/LibreVNA/devicepacketlogview.h \
|
Device/LibreVNA/devicepacketlogview.h \
|
||||||
Device/LibreVNA/firmwareupdatedialog.h \
|
Device/LibreVNA/firmwareupdatedialog.h \
|
||||||
@ -30,7 +32,8 @@ HEADERS += \
|
|||||||
Device/LibreVNA/librevnadriver.h \
|
Device/LibreVNA/librevnadriver.h \
|
||||||
Device/LibreVNA/librevnatcpdriver.h \
|
Device/LibreVNA/librevnatcpdriver.h \
|
||||||
Device/LibreVNA/librevnausbdriver.h \
|
Device/LibreVNA/librevnausbdriver.h \
|
||||||
Device/LibreVNA/manualcontroldialog.h \
|
Device/LibreVNA/manualcontroldialogV1.h \
|
||||||
|
Device/LibreVNA/manualcontroldialogvff.h \
|
||||||
Device/LibreVNA/receivercaldialog.h \
|
Device/LibreVNA/receivercaldialog.h \
|
||||||
Device/LibreVNA/sourcecaldialog.h \
|
Device/LibreVNA/sourcecaldialog.h \
|
||||||
Device/SSA3000X/ssa3000xdriver.h \
|
Device/SSA3000X/ssa3000xdriver.h \
|
||||||
@ -177,6 +180,8 @@ SOURCES += \
|
|||||||
Device/LibreVNA/Compound/compounddeviceeditdialog.cpp \
|
Device/LibreVNA/Compound/compounddeviceeditdialog.cpp \
|
||||||
Device/LibreVNA/Compound/compounddriver.cpp \
|
Device/LibreVNA/Compound/compounddriver.cpp \
|
||||||
Device/LibreVNA/amplitudecaldialog.cpp \
|
Device/LibreVNA/amplitudecaldialog.cpp \
|
||||||
|
Device/LibreVNA/deviceconfigurationdialogv1.cpp \
|
||||||
|
Device/LibreVNA/deviceconfigurationdialogvff.cpp \
|
||||||
Device/LibreVNA/devicepacketlog.cpp \
|
Device/LibreVNA/devicepacketlog.cpp \
|
||||||
Device/LibreVNA/devicepacketlogview.cpp \
|
Device/LibreVNA/devicepacketlogview.cpp \
|
||||||
Device/LibreVNA/firmwareupdatedialog.cpp \
|
Device/LibreVNA/firmwareupdatedialog.cpp \
|
||||||
@ -184,7 +189,8 @@ SOURCES += \
|
|||||||
Device/LibreVNA/librevnadriver.cpp \
|
Device/LibreVNA/librevnadriver.cpp \
|
||||||
Device/LibreVNA/librevnatcpdriver.cpp \
|
Device/LibreVNA/librevnatcpdriver.cpp \
|
||||||
Device/LibreVNA/librevnausbdriver.cpp \
|
Device/LibreVNA/librevnausbdriver.cpp \
|
||||||
Device/LibreVNA/manualcontroldialog.cpp \
|
Device/LibreVNA/manualcontroldialogV1.cpp \
|
||||||
|
Device/LibreVNA/manualcontroldialogvff.cpp \
|
||||||
Device/LibreVNA/receivercaldialog.cpp \
|
Device/LibreVNA/receivercaldialog.cpp \
|
||||||
Device/LibreVNA/sourcecaldialog.cpp \
|
Device/LibreVNA/sourcecaldialog.cpp \
|
||||||
Device/SSA3000X/ssa3000xdriver.cpp \
|
Device/SSA3000X/ssa3000xdriver.cpp \
|
||||||
@ -321,11 +327,14 @@ FORMS += \
|
|||||||
Device/LibreVNA/addamplitudepointsdialog.ui \
|
Device/LibreVNA/addamplitudepointsdialog.ui \
|
||||||
Device/LibreVNA/amplitudecaldialog.ui \
|
Device/LibreVNA/amplitudecaldialog.ui \
|
||||||
Device/LibreVNA/automaticamplitudedialog.ui \
|
Device/LibreVNA/automaticamplitudedialog.ui \
|
||||||
|
Device/LibreVNA/deviceconfigurationdialogv1.ui \
|
||||||
|
Device/LibreVNA/deviceconfigurationdialogvff.ui \
|
||||||
Device/LibreVNA/devicepacketlogview.ui \
|
Device/LibreVNA/devicepacketlogview.ui \
|
||||||
Device/LibreVNA/firmwareupdatedialog.ui \
|
Device/LibreVNA/firmwareupdatedialog.ui \
|
||||||
Device/LibreVNA/frequencycaldialog.ui \
|
Device/LibreVNA/frequencycaldialog.ui \
|
||||||
Device/LibreVNA/librevnadriversettingswidget.ui \
|
Device/LibreVNA/librevnadriversettingswidget.ui \
|
||||||
Device/LibreVNA/manualcontroldialog.ui \
|
Device/LibreVNA/manualcontroldialogV1.ui \
|
||||||
|
Device/LibreVNA/manualcontroldialogvff.ui \
|
||||||
Device/devicelog.ui \
|
Device/devicelog.ui \
|
||||||
Device/devicetcpdriversettings.ui \
|
Device/devicetcpdriversettings.ui \
|
||||||
Generator/signalgenwidget.ui \
|
Generator/signalgenwidget.ui \
|
||||||
|
@ -351,6 +351,7 @@ void SpectrumAnalyzer::initializeDevice()
|
|||||||
connect(window->getDevice(), &DeviceDriver::SAmeasurementReceived, this, &SpectrumAnalyzer::NewDatapoint, Qt::UniqueConnection);
|
connect(window->getDevice(), &DeviceDriver::SAmeasurementReceived, this, &SpectrumAnalyzer::NewDatapoint, Qt::UniqueConnection);
|
||||||
|
|
||||||
// Configure initial state of device
|
// Configure initial state of device
|
||||||
|
ConstrainAndUpdateFrequencies();
|
||||||
SettingsChanged();
|
SettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,6 +724,7 @@ void VNA::initializeDevice()
|
|||||||
removeDefaultCal->setEnabled(false);
|
removeDefaultCal->setEnabled(false);
|
||||||
}
|
}
|
||||||
// Configure initial state of device
|
// Configure initial state of device
|
||||||
|
ConstrainAndUpdateFrequencies();
|
||||||
SettingsChanged();
|
SettingsChanged();
|
||||||
emit deviceInitialized();
|
emit deviceInitialized();
|
||||||
if(window->getDevice() && !cal.validForDevice(window->getDevice()->getSerial())) {
|
if(window->getDevice() && !cal.validForDevice(window->getDevice()->getSerial())) {
|
||||||
|
@ -26,12 +26,15 @@ SOURCES += \
|
|||||||
../LibreVNA-GUI/CustomWidgets/touchstoneimport.cpp \
|
../LibreVNA-GUI/CustomWidgets/touchstoneimport.cpp \
|
||||||
../LibreVNA-GUI/CustomWidgets/tracesetselector.cpp \
|
../LibreVNA-GUI/CustomWidgets/tracesetselector.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvff.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnausbdriver.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/librevnausbdriver.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialog.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialogV1.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/receivercaldialog.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/receivercaldialog.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/sourcecaldialog.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/sourcecaldialog.cpp \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/Compound/compounddevice.cpp \
|
../LibreVNA-GUI/Device/LibreVNA/Compound/compounddevice.cpp \
|
||||||
@ -198,12 +201,15 @@ HEADERS += \
|
|||||||
../LibreVNA-GUI/CustomWidgets/touchstoneimport.h \
|
../LibreVNA-GUI/CustomWidgets/touchstoneimport.h \
|
||||||
../LibreVNA-GUI/CustomWidgets/tracesetselector.h \
|
../LibreVNA-GUI/CustomWidgets/tracesetselector.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.h \
|
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvff.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.h \
|
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.h \
|
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnadriver.h \
|
../LibreVNA-GUI/Device/LibreVNA/librevnadriver.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.h \
|
../LibreVNA-GUI/Device/LibreVNA/librevnatcpdriver.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnausbdriver.h \
|
../LibreVNA-GUI/Device/LibreVNA/librevnausbdriver.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialog.h \
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialogV1.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/receivercaldialog.h \
|
../LibreVNA-GUI/Device/LibreVNA/receivercaldialog.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/sourcecaldialog.h \
|
../LibreVNA-GUI/Device/LibreVNA/sourcecaldialog.h \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/Compound/compounddevice.h \
|
../LibreVNA-GUI/Device/LibreVNA/Compound/compounddevice.h \
|
||||||
@ -355,11 +361,14 @@ FORMS += \
|
|||||||
../LibreVNA-GUI/Device/LibreVNA/addamplitudepointsdialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/addamplitudepointsdialog.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/automaticamplitudedialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/automaticamplitudedialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvff.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/librevnadriversettingswidget.ui \
|
../LibreVNA-GUI/Device/LibreVNA/librevnadriversettingswidget.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialogV1.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/Compound/compounddeviceeditdialog.ui \
|
../LibreVNA-GUI/Device/LibreVNA/Compound/compounddeviceeditdialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialogvff.ui \
|
||||||
../LibreVNA-GUI/Device/devicelog.ui \
|
../LibreVNA-GUI/Device/devicelog.ui \
|
||||||
../LibreVNA-GUI/Device/LibreVNA/devicepacketlogview.ui \
|
../LibreVNA-GUI/Device/LibreVNA/devicepacketlogview.ui \
|
||||||
../LibreVNA-GUI/Device/devicetcpdriversettings.ui \
|
../LibreVNA-GUI/Device/devicetcpdriversettings.ui \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
2F62501ED4689FB349E356AB974DBE57=6F84FD31C089E822CF61FFCABCD0B7D1
|
2F62501ED4689FB349E356AB974DBE57=EF826FD321FB312AEADE4DB74B81458C
|
||||||
66BE74F758C12D739921AEA421D593D3=2
|
66BE74F758C12D739921AEA421D593D3=2
|
||||||
8DF89ED150041C4CBC7CB9A9CAA90856=6F84FD31C089E822CF61FFCABCD0B7D1
|
8DF89ED150041C4CBC7CB9A9CAA90856=EF826FD321FB312AEADE4DB74B81458C
|
||||||
DC22A860405A8BF2F2C095E5B6529F12=6E2D4146EA2709ED1E4A1764BC291F57
|
DC22A860405A8BF2F2C095E5B6529F12=A01929E06A3F8E0B7C263320E5AF494F
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
@ -129,7 +129,7 @@ inline void App_Process() {
|
|||||||
sweepActive = VNA::Setup(recv_packet.settings);
|
sweepActive = VNA::Setup(recv_packet.settings);
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::ManualControlV1:
|
case Protocol::PacketType::ManualControl:
|
||||||
sweepActive = false;
|
sweepActive = false;
|
||||||
last_measure_packet = recv_packet;
|
last_measure_packet = recv_packet;
|
||||||
Manual::Setup(recv_packet.manual);
|
Manual::Setup(recv_packet.manual);
|
||||||
@ -168,8 +168,8 @@ inline void App_Process() {
|
|||||||
case Protocol::PacketType::RequestDeviceStatus: {
|
case Protocol::PacketType::RequestDeviceStatus: {
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
Protocol::PacketInfo p;
|
Protocol::PacketInfo p;
|
||||||
p.type = Protocol::PacketType::DeviceStatusV1;
|
p.type = Protocol::PacketType::DeviceStatus;
|
||||||
HW::getDeviceStatus(&p.statusV1);
|
HW::getDeviceStatus(&p.status);
|
||||||
Communication::Send(p);
|
Communication::Send(p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -263,19 +263,19 @@ inline void App_Process() {
|
|||||||
Cal::setFrequencyCal(recv_packet.frequencyCorrection.ppm);
|
Cal::setFrequencyCal(recv_packet.frequencyCorrection.ppm);
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::RequestAcquisitionFrequencySettings:
|
case Protocol::PacketType::RequestDeviceConfiguration:
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
{
|
{
|
||||||
Protocol::PacketInfo send;
|
Protocol::PacketInfo send;
|
||||||
send.type = Protocol::PacketType::AcquisitionFrequencySettings;
|
send.type = Protocol::PacketType::DeviceConfiguration;
|
||||||
send.acquisitionFrequencySettings.IF1 = HW::getIF1();
|
send.deviceConfig.V1.IF1 = HW::getIF1();
|
||||||
send.acquisitionFrequencySettings.ADCprescaler = HW::getADCPrescaler();
|
send.deviceConfig.V1.ADCprescaler = HW::getADCPrescaler();
|
||||||
send.acquisitionFrequencySettings.DFTphaseInc = HW::getDFTPhaseInc();
|
send.deviceConfig.V1.DFTphaseInc = HW::getDFTPhaseInc();
|
||||||
Communication::Send(send);
|
Communication::Send(send);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::AcquisitionFrequencySettings:
|
case Protocol::PacketType::DeviceConfiguration:
|
||||||
HW::setAcquisitionFrequencies(recv_packet.acquisitionFrequencySettings);
|
HW::setAcquisitionFrequencies(recv_packet.deviceConfig);
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::SetTrigger:
|
case Protocol::PacketType::SetTrigger:
|
||||||
|
@ -99,9 +99,9 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
|||||||
case PacketType::SweepSettings: payload_size = sizeof(packet.settings); break;
|
case PacketType::SweepSettings: payload_size = sizeof(packet.settings); break;
|
||||||
case PacketType::Reference: payload_size = sizeof(packet.reference); break;
|
case PacketType::Reference: payload_size = sizeof(packet.reference); break;
|
||||||
case PacketType::DeviceInfo: payload_size = sizeof(packet.info); break;
|
case PacketType::DeviceInfo: payload_size = sizeof(packet.info); break;
|
||||||
case PacketType::DeviceStatusV1: payload_size = sizeof(packet.statusV1); break;
|
case PacketType::DeviceStatus: payload_size = sizeof(packet.status); break;
|
||||||
case PacketType::ManualStatusV1: payload_size = sizeof(packet.manualStatusV1); break;
|
case PacketType::ManualStatus: payload_size = sizeof(packet.manualStatus); break;
|
||||||
case PacketType::ManualControlV1: payload_size = sizeof(packet.manual); break;
|
case PacketType::ManualControl: payload_size = sizeof(packet.manual); break;
|
||||||
case PacketType::FirmwarePacket: payload_size = sizeof(packet.firmware); break;
|
case PacketType::FirmwarePacket: payload_size = sizeof(packet.firmware); break;
|
||||||
case PacketType::Generator: payload_size = sizeof(packet.generator); break;
|
case PacketType::Generator: payload_size = sizeof(packet.generator); break;
|
||||||
case PacketType::SpectrumAnalyzerSettings: payload_size = sizeof(packet.spectrumSettings); break;
|
case PacketType::SpectrumAnalyzerSettings: payload_size = sizeof(packet.spectrumSettings); break;
|
||||||
@ -109,7 +109,7 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
|||||||
case PacketType::SourceCalPoint:
|
case PacketType::SourceCalPoint:
|
||||||
case PacketType::ReceiverCalPoint: payload_size = sizeof(packet.amplitudePoint); break;
|
case PacketType::ReceiverCalPoint: payload_size = sizeof(packet.amplitudePoint); break;
|
||||||
case PacketType::FrequencyCorrection: payload_size = sizeof(packet.frequencyCorrection); break;
|
case PacketType::FrequencyCorrection: payload_size = sizeof(packet.frequencyCorrection); break;
|
||||||
case PacketType::AcquisitionFrequencySettings: payload_size = sizeof(packet.acquisitionFrequencySettings); break;
|
case PacketType::DeviceConfiguration: payload_size = sizeof(packet.deviceConfig); break;
|
||||||
case PacketType::Ack:
|
case PacketType::Ack:
|
||||||
case PacketType::PerformFirmwareUpdate:
|
case PacketType::PerformFirmwareUpdate:
|
||||||
case PacketType::ClearFlash:
|
case PacketType::ClearFlash:
|
||||||
@ -119,7 +119,7 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
|||||||
case PacketType::RequestReceiverCal:
|
case PacketType::RequestReceiverCal:
|
||||||
case PacketType::SetIdle:
|
case PacketType::SetIdle:
|
||||||
case PacketType::RequestFrequencyCorrection:
|
case PacketType::RequestFrequencyCorrection:
|
||||||
case PacketType::RequestAcquisitionFrequencySettings:
|
case PacketType::RequestDeviceConfiguration:
|
||||||
case PacketType::RequestDeviceStatus:
|
case PacketType::RequestDeviceStatus:
|
||||||
case PacketType::SetTrigger:
|
case PacketType::SetTrigger:
|
||||||
case PacketType::ClearTrigger:
|
case PacketType::ClearTrigger:
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -210,7 +209,9 @@ using DeviceInfo = struct _deviceInfo {
|
|||||||
uint64_t limits_maxFreqHarmonic;
|
uint64_t limits_maxFreqHarmonic;
|
||||||
};
|
};
|
||||||
|
|
||||||
using DeviceStatusV1 = struct _deviceStatusV1 {
|
using DeviceStatus = struct _deviceStatus {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
uint8_t extRefAvailable:1;
|
uint8_t extRefAvailable:1;
|
||||||
uint8_t extRefInUse:1;
|
uint8_t extRefInUse:1;
|
||||||
uint8_t FPGA_configured:1;
|
uint8_t FPGA_configured:1;
|
||||||
@ -221,10 +222,21 @@ using DeviceStatusV1 = struct _deviceStatusV1 {
|
|||||||
uint8_t temp_source;
|
uint8_t temp_source;
|
||||||
uint8_t temp_LO1;
|
uint8_t temp_LO1;
|
||||||
uint8_t temp_MCU;
|
uint8_t temp_MCU;
|
||||||
|
} V1;
|
||||||
|
struct {
|
||||||
|
uint8_t source_locked:1;
|
||||||
|
uint8_t LO_locked:1;
|
||||||
|
uint8_t ADC_overload:1;
|
||||||
|
uint8_t unlevel:1;
|
||||||
|
uint8_t temp_MCU;
|
||||||
|
} VFF;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
using ManualStatusV1 = struct _manualstatusV1 {
|
using ManualStatus = struct _manualstatus {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
int16_t port1min, port1max;
|
int16_t port1min, port1max;
|
||||||
int16_t port2min, port2max;
|
int16_t port2min, port2max;
|
||||||
int16_t refmin, refmax;
|
int16_t refmin, refmax;
|
||||||
@ -235,9 +247,21 @@ using ManualStatusV1 = struct _manualstatusV1 {
|
|||||||
uint8_t temp_LO;
|
uint8_t temp_LO;
|
||||||
uint8_t source_locked :1;
|
uint8_t source_locked :1;
|
||||||
uint8_t LO_locked :1;
|
uint8_t LO_locked :1;
|
||||||
|
} V1;
|
||||||
|
struct {
|
||||||
|
int16_t portmin, portmax;
|
||||||
|
int16_t refmin, refmax;
|
||||||
|
float portreal, portimag;
|
||||||
|
float refreal, refimag;
|
||||||
|
uint8_t source_locked :1;
|
||||||
|
uint8_t LO_locked :1;
|
||||||
|
} VFF;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using ManualControlV1 = struct _manualControlV1 {
|
using ManualControl = struct _manualControl {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
// Highband Source
|
// Highband Source
|
||||||
uint8_t SourceHighCE :1;
|
uint8_t SourceHighCE :1;
|
||||||
uint8_t SourceHighRFEN :1;
|
uint8_t SourceHighRFEN :1;
|
||||||
@ -266,6 +290,31 @@ using ManualControlV1 = struct _manualControlV1 {
|
|||||||
uint8_t RefEN :1;
|
uint8_t RefEN :1;
|
||||||
uint32_t Samples;
|
uint32_t Samples;
|
||||||
uint8_t WindowType :2;
|
uint8_t WindowType :2;
|
||||||
|
} V1;
|
||||||
|
struct {
|
||||||
|
// Source
|
||||||
|
uint8_t SourceCE :1;
|
||||||
|
uint8_t SourceRFEN :1;
|
||||||
|
uint8_t SourcePower :3;
|
||||||
|
uint64_t SourceFrequency;
|
||||||
|
// Source signal path
|
||||||
|
uint8_t attenuator :7;
|
||||||
|
uint8_t SourceAmplifierEN :1;
|
||||||
|
// LO
|
||||||
|
uint8_t LOCE :1;
|
||||||
|
uint8_t LORFEN :1;
|
||||||
|
uint8_t LOAmplifierEN :1;
|
||||||
|
uint8_t LOexternal :1;
|
||||||
|
uint64_t LOFrequency;
|
||||||
|
// Acquisition
|
||||||
|
uint8_t PortEN :1;
|
||||||
|
uint8_t RefEN :1;
|
||||||
|
uint8_t WindowType :2;
|
||||||
|
uint8_t PortGain :4;
|
||||||
|
uint8_t RefGain :4;
|
||||||
|
uint16_t Samples;
|
||||||
|
} VFF;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using SpectrumAnalyzerSettings = struct _spectrumAnalyzerSettings {
|
using SpectrumAnalyzerSettings = struct _spectrumAnalyzerSettings {
|
||||||
@ -327,18 +376,28 @@ using FrequencyCorrection = struct _frequencycorrection {
|
|||||||
float ppm;
|
float ppm;
|
||||||
};
|
};
|
||||||
|
|
||||||
using AcquisitionFrequencySettings = struct _acquisitionfrequencysettigns {
|
using DeviceConfig = struct _deviceconfig {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
uint32_t IF1;
|
uint32_t IF1;
|
||||||
uint8_t ADCprescaler;
|
uint8_t ADCprescaler;
|
||||||
uint16_t DFTphaseInc;
|
uint16_t DFTphaseInc;
|
||||||
|
} V1;
|
||||||
|
struct {
|
||||||
|
uint32_t ip;
|
||||||
|
uint32_t mask;
|
||||||
|
uint32_t gw;
|
||||||
|
uint8_t dhcp :1;
|
||||||
|
} VFF;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PacketType : uint8_t {
|
enum class PacketType : uint8_t {
|
||||||
None = 0,
|
None = 0,
|
||||||
//Datapoint = 1, // Deprecated, replaced by VNADatapoint
|
//Datapoint = 1, // Deprecated, replaced by VNADatapoint
|
||||||
SweepSettings = 2,
|
SweepSettings = 2,
|
||||||
ManualStatusV1 = 3,
|
ManualStatus = 3,
|
||||||
ManualControlV1 = 4,
|
ManualControl = 4,
|
||||||
DeviceInfo = 5,
|
DeviceInfo = 5,
|
||||||
FirmwarePacket = 6,
|
FirmwarePacket = 6,
|
||||||
Ack = 7,
|
Ack = 7,
|
||||||
@ -357,9 +416,9 @@ enum class PacketType : uint8_t {
|
|||||||
SetIdle = 20,
|
SetIdle = 20,
|
||||||
RequestFrequencyCorrection = 21,
|
RequestFrequencyCorrection = 21,
|
||||||
FrequencyCorrection = 22,
|
FrequencyCorrection = 22,
|
||||||
RequestAcquisitionFrequencySettings = 23,
|
RequestDeviceConfiguration = 23,
|
||||||
AcquisitionFrequencySettings = 24,
|
DeviceConfiguration = 24,
|
||||||
DeviceStatusV1 = 25,
|
DeviceStatus = 25,
|
||||||
RequestDeviceStatus = 26,
|
RequestDeviceStatus = 26,
|
||||||
VNADatapoint = 27,
|
VNADatapoint = 27,
|
||||||
SetTrigger = 28,
|
SetTrigger = 28,
|
||||||
@ -376,16 +435,16 @@ using PacketInfo = struct _packetinfo {
|
|||||||
SweepSettings settings;
|
SweepSettings settings;
|
||||||
ReferenceSettings reference;
|
ReferenceSettings reference;
|
||||||
GeneratorSettings generator;
|
GeneratorSettings generator;
|
||||||
DeviceStatusV1 statusV1;
|
DeviceStatus status;
|
||||||
DeviceInfo info;
|
DeviceInfo info;
|
||||||
ManualControlV1 manual;
|
ManualControl manual;
|
||||||
FirmwarePacket firmware;
|
FirmwarePacket firmware;
|
||||||
ManualStatusV1 manualStatusV1;
|
ManualStatus manualStatus;
|
||||||
SpectrumAnalyzerSettings spectrumSettings;
|
SpectrumAnalyzerSettings spectrumSettings;
|
||||||
SpectrumAnalyzerResult spectrumResult;
|
SpectrumAnalyzerResult spectrumResult;
|
||||||
AmplitudeCorrectionPoint amplitudePoint;
|
AmplitudeCorrectionPoint amplitudePoint;
|
||||||
FrequencyCorrection frequencyCorrection;
|
FrequencyCorrection frequencyCorrection;
|
||||||
AcquisitionFrequencySettings acquisitionFrequencySettings;
|
DeviceConfig deviceConfig;
|
||||||
/*
|
/*
|
||||||
* When encoding: Pointer may go invalid after call to EncodePacket
|
* When encoding: Pointer may go invalid after call to EncodePacket
|
||||||
* When decoding: VNADatapoint is created on heap by DecodeBuffer, freeing is up to the caller
|
* When decoding: VNADatapoint is created on heap by DecodeBuffer, freeing is up to the caller
|
||||||
|
@ -322,7 +322,7 @@ void HW::SetOutputUnlevel(bool unlev) {
|
|||||||
unlevel = unlev;
|
unlevel = unlev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HW::getDeviceStatus(Protocol::DeviceStatusV1 *status, bool updateEvenWhenBusy) {
|
void HW::getDeviceStatus(Protocol::DeviceStatus *status, bool updateEvenWhenBusy) {
|
||||||
if(activeMode == Mode::Idle || updateEvenWhenBusy) {
|
if(activeMode == Mode::Idle || updateEvenWhenBusy) {
|
||||||
// updating values from FPGA allowed
|
// updating values from FPGA allowed
|
||||||
|
|
||||||
@ -339,21 +339,21 @@ void HW::getDeviceStatus(Protocol::DeviceStatusV1 *status, bool updateEvenWhenBu
|
|||||||
if(limits.P1min < -ADC_LIMIT || limits.P1max > ADC_LIMIT
|
if(limits.P1min < -ADC_LIMIT || limits.P1max > ADC_LIMIT
|
||||||
|| limits.P2min < -ADC_LIMIT || limits.P2max > ADC_LIMIT
|
|| limits.P2min < -ADC_LIMIT || limits.P2max > ADC_LIMIT
|
||||||
|| limits.Rmin < -ADC_LIMIT || limits.Rmax > ADC_LIMIT) {
|
|| limits.Rmin < -ADC_LIMIT || limits.Rmax > ADC_LIMIT) {
|
||||||
status->ADC_overload = true;
|
status->V1.ADC_overload = true;
|
||||||
} else {
|
} else {
|
||||||
status->ADC_overload = false;
|
status->V1.ADC_overload = false;
|
||||||
}
|
}
|
||||||
auto FPGA_status = FPGA::GetStatus();
|
auto FPGA_status = FPGA::GetStatus();
|
||||||
status->LO1_locked = (FPGA_status & (int) FPGA::Interrupt::LO1Unlock) ? 0 : 1;
|
status->V1.LO1_locked = (FPGA_status & (int) FPGA::Interrupt::LO1Unlock) ? 0 : 1;
|
||||||
status->source_locked = (FPGA_status & (int) FPGA::Interrupt::SourceUnlock) ? 0 : 1;
|
status->V1.source_locked = (FPGA_status & (int) FPGA::Interrupt::SourceUnlock) ? 0 : 1;
|
||||||
status->extRefAvailable = Ref::available();
|
status->V1.extRefAvailable = Ref::available();
|
||||||
status->extRefInUse = extRefInUse;
|
status->V1.extRefInUse = extRefInUse;
|
||||||
status->unlevel = unlevel;
|
status->V1.unlevel = unlevel;
|
||||||
status->temp_LO1 = tempLO;
|
status->V1.temp_LO1 = tempLO;
|
||||||
status->temp_source = tempSource;
|
status->V1.temp_source = tempSource;
|
||||||
FPGA::ResetADCLimits();
|
FPGA::ResetADCLimits();
|
||||||
}
|
}
|
||||||
status->temp_MCU = STM::getTemperature();
|
status->V1.temp_MCU = STM::getTemperature();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HW::Ref::available() {
|
bool HW::Ref::available() {
|
||||||
@ -413,10 +413,10 @@ void HW::Ref::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HW::setAcquisitionFrequencies(Protocol::AcquisitionFrequencySettings s) {
|
void HW::setAcquisitionFrequencies(Protocol::DeviceConfig s) {
|
||||||
IF1 = s.IF1;
|
IF1 = s.V1.IF1;
|
||||||
ADCprescaler = s.ADCprescaler;
|
ADCprescaler = s.V1.ADCprescaler;
|
||||||
DFTphaseInc = s.DFTphaseInc;
|
DFTphaseInc = s.V1.DFTphaseInc;
|
||||||
float ADCrate = (float) FPGA::Clockrate / ADCprescaler;
|
float ADCrate = (float) FPGA::Clockrate / ADCprescaler;
|
||||||
IF2 = ADCrate * DFTphaseInc / 4096;
|
IF2 = ADCrate * DFTphaseInc / 4096;
|
||||||
ADCsamplerate = ADCrate;
|
ADCsamplerate = ADCrate;
|
||||||
@ -457,13 +457,13 @@ void HW::updateDeviceStatus() {
|
|||||||
last_update = HAL_GetTick();
|
last_update = HAL_GetTick();
|
||||||
HW::Ref::update();
|
HW::Ref::update();
|
||||||
Protocol::PacketInfo packet;
|
Protocol::PacketInfo packet;
|
||||||
packet.type = Protocol::PacketType::DeviceStatusV1;
|
packet.type = Protocol::PacketType::DeviceStatus;
|
||||||
// Enable PLL chips for temperature reading
|
// Enable PLL chips for temperature reading
|
||||||
bool srcEn = FPGA::IsEnabled(FPGA::Periphery::SourceChip);
|
bool srcEn = FPGA::IsEnabled(FPGA::Periphery::SourceChip);
|
||||||
bool LOEn = FPGA::IsEnabled(FPGA::Periphery::LO1Chip);
|
bool LOEn = FPGA::IsEnabled(FPGA::Periphery::LO1Chip);
|
||||||
FPGA::Enable(FPGA::Periphery::SourceChip);
|
FPGA::Enable(FPGA::Periphery::SourceChip);
|
||||||
FPGA::Enable(FPGA::Periphery::LO1Chip);
|
FPGA::Enable(FPGA::Periphery::LO1Chip);
|
||||||
HW::getDeviceStatus(&packet.statusV1, true);
|
HW::getDeviceStatus(&packet.status, true);
|
||||||
// restore PLL state
|
// restore PLL state
|
||||||
FPGA::Enable(FPGA::Periphery::SourceChip, srcEn);
|
FPGA::Enable(FPGA::Periphery::SourceChip, srcEn);
|
||||||
FPGA::Enable(FPGA::Periphery::LO1Chip, LOEn);
|
FPGA::Enable(FPGA::Periphery::LO1Chip, LOEn);
|
||||||
|
@ -119,7 +119,7 @@ using AmplitudeSettings = struct _amplitudeSettings {
|
|||||||
AmplitudeSettings GetAmplitudeSettings(int16_t cdbm, uint64_t freq = 0, bool applyCorrections = false, bool port2 = false);
|
AmplitudeSettings GetAmplitudeSettings(int16_t cdbm, uint64_t freq = 0, bool applyCorrections = false, bool port2 = false);
|
||||||
|
|
||||||
bool GetTemps(uint8_t *source, uint8_t *lo);
|
bool GetTemps(uint8_t *source, uint8_t *lo);
|
||||||
void getDeviceStatus(Protocol::DeviceStatusV1 *status, bool updateEvenWhenBusy = false);
|
void getDeviceStatus(Protocol::DeviceStatus *status, bool updateEvenWhenBusy = false);
|
||||||
namespace Ref {
|
namespace Ref {
|
||||||
bool available();
|
bool available();
|
||||||
bool usingExternal();
|
bool usingExternal();
|
||||||
@ -129,7 +129,7 @@ namespace Ref {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Acquisition frequency settings
|
// Acquisition frequency settings
|
||||||
void setAcquisitionFrequencies(Protocol::AcquisitionFrequencySettings s);
|
void setAcquisitionFrequencies(Protocol::DeviceConfig s);
|
||||||
uint32_t getIF1();
|
uint32_t getIF1();
|
||||||
uint32_t getIF2();
|
uint32_t getIF2();
|
||||||
uint32_t getADCRate();
|
uint32_t getADCRate();
|
||||||
|
@ -6,37 +6,37 @@
|
|||||||
|
|
||||||
static bool active = false;
|
static bool active = false;
|
||||||
static uint32_t samples;
|
static uint32_t samples;
|
||||||
static Protocol::ManualStatusV1 status;
|
static Protocol::ManualStatus status;
|
||||||
|
|
||||||
using namespace HWHAL;
|
using namespace HWHAL;
|
||||||
|
|
||||||
void Manual::Setup(Protocol::ManualControlV1 m) {
|
void Manual::Setup(Protocol::ManualControl m) {
|
||||||
HW::SetMode(HW::Mode::Manual);
|
HW::SetMode(HW::Mode::Manual);
|
||||||
samples = m.Samples;
|
samples = m.V1.Samples;
|
||||||
FPGA::AbortSweep();
|
FPGA::AbortSweep();
|
||||||
// Configure lowband source
|
// Configure lowband source
|
||||||
if (m.SourceLowEN) {
|
if (m.V1.SourceLowEN) {
|
||||||
Si5351.SetCLK(SiChannel::LowbandSource, m.SourceLowFrequency, Si5351C::PLL::B,
|
Si5351.SetCLK(SiChannel::LowbandSource, m.V1.SourceLowFrequency, Si5351C::PLL::B,
|
||||||
(Si5351C::DriveStrength) m.SourceLowPower);
|
(Si5351C::DriveStrength) m.V1.SourceLowPower);
|
||||||
Si5351.Enable(SiChannel::LowbandSource);
|
Si5351.Enable(SiChannel::LowbandSource);
|
||||||
} else {
|
} else {
|
||||||
Si5351.Disable(SiChannel::LowbandSource);
|
Si5351.Disable(SiChannel::LowbandSource);
|
||||||
}
|
}
|
||||||
// Configure highband source
|
// Configure highband source
|
||||||
Source.SetFrequency(m.SourceHighFrequency);
|
Source.SetFrequency(m.V1.SourceHighFrequency);
|
||||||
Source.SetPowerOutA((MAX2871::Power) m.SourceHighPower);
|
Source.SetPowerOutA((MAX2871::Power) m.V1.SourceHighPower);
|
||||||
|
|
||||||
// Configure LO1
|
// Configure LO1
|
||||||
LO1.SetFrequency(m.LO1Frequency);
|
LO1.SetFrequency(m.V1.LO1Frequency);
|
||||||
|
|
||||||
// Configure LO2
|
// Configure LO2
|
||||||
if(m.LO2EN) {
|
if(m.V1.LO2EN) {
|
||||||
// Generate second LO with Si5351
|
// Generate second LO with Si5351
|
||||||
Si5351.SetCLK(SiChannel::Port1LO2, m.LO2Frequency, Si5351C::PLL::B, Si5351C::DriveStrength::mA2);
|
Si5351.SetCLK(SiChannel::Port1LO2, m.V1.LO2Frequency, Si5351C::PLL::B, Si5351C::DriveStrength::mA2);
|
||||||
Si5351.Enable(SiChannel::Port1LO2);
|
Si5351.Enable(SiChannel::Port1LO2);
|
||||||
Si5351.SetCLK(SiChannel::Port2LO2, m.LO2Frequency, Si5351C::PLL::B, Si5351C::DriveStrength::mA2);
|
Si5351.SetCLK(SiChannel::Port2LO2, m.V1.LO2Frequency, Si5351C::PLL::B, Si5351C::DriveStrength::mA2);
|
||||||
Si5351.Enable(SiChannel::Port2LO2);
|
Si5351.Enable(SiChannel::Port2LO2);
|
||||||
Si5351.SetCLK(SiChannel::RefLO2, m.LO2Frequency, Si5351C::PLL::B, Si5351C::DriveStrength::mA2);
|
Si5351.SetCLK(SiChannel::RefLO2, m.V1.LO2Frequency, Si5351C::PLL::B, Si5351C::DriveStrength::mA2);
|
||||||
Si5351.Enable(SiChannel::RefLO2);
|
Si5351.Enable(SiChannel::RefLO2);
|
||||||
|
|
||||||
// PLL reset appears to realign phases of clock signals
|
// PLL reset appears to realign phases of clock signals
|
||||||
@ -50,26 +50,26 @@ void Manual::Setup(Protocol::ManualControlV1 m) {
|
|||||||
FPGA::WriteMAX2871Default(Source.GetRegisters());
|
FPGA::WriteMAX2871Default(Source.GetRegisters());
|
||||||
|
|
||||||
FPGA::SetNumberOfPoints(1);
|
FPGA::SetNumberOfPoints(1);
|
||||||
FPGA::SetSamplesPerPoint(m.Samples);
|
FPGA::SetSamplesPerPoint(m.V1.Samples);
|
||||||
|
|
||||||
// Configure single sweep point
|
// Configure single sweep point
|
||||||
FPGA::WriteSweepConfig(0, !m.SourceHighband, Source.GetRegisters(),
|
FPGA::WriteSweepConfig(0, !m.V1.SourceHighband, Source.GetRegisters(),
|
||||||
LO1.GetRegisters(), m.attenuator, 0, FPGA::SettlingTime::us60,
|
LO1.GetRegisters(), m.V1.attenuator, 0, FPGA::SettlingTime::us60,
|
||||||
FPGA::Samples::SPPRegister, 0,
|
FPGA::Samples::SPPRegister, 0,
|
||||||
(FPGA::LowpassFilter) m.SourceHighLowpass);
|
(FPGA::LowpassFilter) m.V1.SourceHighLowpass);
|
||||||
|
|
||||||
FPGA::SetWindow((FPGA::Window) m.WindowType);
|
FPGA::SetWindow((FPGA::Window) m.V1.WindowType);
|
||||||
|
|
||||||
// Enable/Disable periphery
|
// Enable/Disable periphery
|
||||||
FPGA::Enable(FPGA::Periphery::SourceChip, m.SourceHighCE);
|
FPGA::Enable(FPGA::Periphery::SourceChip, m.V1.SourceHighCE);
|
||||||
FPGA::Enable(FPGA::Periphery::SourceRF, m.SourceHighRFEN);
|
FPGA::Enable(FPGA::Periphery::SourceRF, m.V1.SourceHighRFEN);
|
||||||
FPGA::Enable(FPGA::Periphery::LO1Chip, m.LO1CE);
|
FPGA::Enable(FPGA::Periphery::LO1Chip, m.V1.LO1CE);
|
||||||
FPGA::Enable(FPGA::Periphery::LO1RF, m.LO1RFEN);
|
FPGA::Enable(FPGA::Periphery::LO1RF, m.V1.LO1RFEN);
|
||||||
FPGA::Enable(FPGA::Periphery::Amplifier, m.AmplifierEN);
|
FPGA::Enable(FPGA::Periphery::Amplifier, m.V1.AmplifierEN);
|
||||||
FPGA::Enable(FPGA::Periphery::Port1Mixer, m.Port1EN);
|
FPGA::Enable(FPGA::Periphery::Port1Mixer, m.V1.Port1EN);
|
||||||
FPGA::Enable(FPGA::Periphery::Port2Mixer, m.Port2EN);
|
FPGA::Enable(FPGA::Periphery::Port2Mixer, m.V1.Port2EN);
|
||||||
FPGA::Enable(FPGA::Periphery::RefMixer, m.RefEN);
|
FPGA::Enable(FPGA::Periphery::RefMixer, m.V1.RefEN);
|
||||||
FPGA::SetupSweep(0, m.PortSwitch == 1, m.PortSwitch == 0);
|
FPGA::SetupSweep(0, m.V1.PortSwitch == 1, m.V1.PortSwitch == 0);
|
||||||
FPGA::Enable(FPGA::Periphery::PortSwitch);
|
FPGA::Enable(FPGA::Periphery::PortSwitch);
|
||||||
|
|
||||||
// Enable new data and sweep halt interrupt
|
// Enable new data and sweep halt interrupt
|
||||||
@ -84,12 +84,12 @@ bool Manual::MeasurementDone(const FPGA::SamplingResult &result) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// save measurement
|
// save measurement
|
||||||
status.port1real = (float) result.P1I / samples;
|
status.V1.port1real = (float) result.P1I / samples;
|
||||||
status.port1imag = (float) result.P1Q / samples;
|
status.V1.port1imag = (float) result.P1Q / samples;
|
||||||
status.port2real = (float) result.P2I / samples;
|
status.V1.port2real = (float) result.P2I / samples;
|
||||||
status.port2imag = (float) result.P2Q / samples;
|
status.V1.port2imag = (float) result.P2Q / samples;
|
||||||
status.refreal = (float) result.RefI / samples;
|
status.V1.refreal = (float) result.RefI / samples;
|
||||||
status.refimag = (float) result.RefQ / samples;
|
status.V1.refimag = (float) result.RefQ / samples;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,39 +99,39 @@ void Manual::Work() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Protocol::PacketInfo p;
|
Protocol::PacketInfo p;
|
||||||
p.type = Protocol::PacketType::ManualStatusV1;
|
p.type = Protocol::PacketType::ManualStatus;
|
||||||
p.manualStatusV1 = status;
|
p.manualStatus = status;
|
||||||
uint16_t isr_flags = FPGA::GetStatus();
|
uint16_t isr_flags = FPGA::GetStatus();
|
||||||
if (!(isr_flags & 0x0002)) {
|
if (!(isr_flags & 0x0002)) {
|
||||||
p.manualStatusV1.source_locked = 1;
|
p.manualStatus.V1.source_locked = 1;
|
||||||
} else {
|
} else {
|
||||||
p.manualStatusV1.source_locked = 0;
|
p.manualStatus.V1.source_locked = 0;
|
||||||
}
|
}
|
||||||
if (!(isr_flags & 0x0001)) {
|
if (!(isr_flags & 0x0001)) {
|
||||||
p.manualStatusV1.LO_locked = 1;
|
p.manualStatus.V1.LO_locked = 1;
|
||||||
} else {
|
} else {
|
||||||
p.manualStatusV1.LO_locked = 0;
|
p.manualStatus.V1.LO_locked = 0;
|
||||||
}
|
}
|
||||||
auto limits = FPGA::GetADCLimits();
|
auto limits = FPGA::GetADCLimits();
|
||||||
FPGA::ResetADCLimits();
|
FPGA::ResetADCLimits();
|
||||||
p.manualStatusV1.port1min = limits.P1min;
|
p.manualStatus.V1.port1min = limits.P1min;
|
||||||
p.manualStatusV1.port1max = limits.P1max;
|
p.manualStatus.V1.port1max = limits.P1max;
|
||||||
p.manualStatusV1.port2min = limits.P2min;
|
p.manualStatus.V1.port2min = limits.P2min;
|
||||||
p.manualStatusV1.port2max = limits.P2max;
|
p.manualStatus.V1.port2max = limits.P2max;
|
||||||
p.manualStatusV1.refmin = limits.Rmin;
|
p.manualStatus.V1.refmin = limits.Rmin;
|
||||||
p.manualStatusV1.refmax = limits.Rmax;
|
p.manualStatus.V1.refmax = limits.Rmax;
|
||||||
HW::GetTemps(&p.manualStatusV1.temp_source, &p.manualStatusV1.temp_LO);
|
HW::GetTemps(&p.manualStatus.V1.temp_source, &p.manualStatus.V1.temp_LO);
|
||||||
Communication::Send(p);
|
Communication::Send(p);
|
||||||
HW::Ref::update();
|
HW::Ref::update();
|
||||||
if(HW::getStatusUpdateFlag()) {
|
if(HW::getStatusUpdateFlag()) {
|
||||||
Protocol::PacketInfo packet;
|
Protocol::PacketInfo packet;
|
||||||
packet.type = Protocol::PacketType::DeviceStatusV1;
|
packet.type = Protocol::PacketType::DeviceStatus;
|
||||||
// Enable PLL chips for temperature reading
|
// Enable PLL chips for temperature reading
|
||||||
bool srcEn = FPGA::IsEnabled(FPGA::Periphery::SourceChip);
|
bool srcEn = FPGA::IsEnabled(FPGA::Periphery::SourceChip);
|
||||||
bool LOEn = FPGA::IsEnabled(FPGA::Periphery::LO1Chip);
|
bool LOEn = FPGA::IsEnabled(FPGA::Periphery::LO1Chip);
|
||||||
FPGA::Enable(FPGA::Periphery::SourceChip);
|
FPGA::Enable(FPGA::Periphery::SourceChip);
|
||||||
FPGA::Enable(FPGA::Periphery::LO1Chip);
|
FPGA::Enable(FPGA::Periphery::LO1Chip);
|
||||||
HW::getDeviceStatus(&packet.statusV1, true);
|
HW::getDeviceStatus(&packet.status, true);
|
||||||
// restore PLL state
|
// restore PLL state
|
||||||
FPGA::Enable(FPGA::Periphery::SourceChip, srcEn);
|
FPGA::Enable(FPGA::Periphery::SourceChip, srcEn);
|
||||||
FPGA::Enable(FPGA::Periphery::LO1Chip, LOEn);
|
FPGA::Enable(FPGA::Periphery::LO1Chip, LOEn);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace Manual {
|
namespace Manual {
|
||||||
|
|
||||||
void Setup(Protocol::ManualControlV1 m);
|
void Setup(Protocol::ManualControl m);
|
||||||
bool MeasurementDone(const FPGA::SamplingResult &result);
|
bool MeasurementDone(const FPGA::SamplingResult &result);
|
||||||
void Work();
|
void Work();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
@ -432,8 +432,8 @@ void SA::Work() {
|
|||||||
// send device info every nth point
|
// send device info every nth point
|
||||||
FPGA::Enable(FPGA::Periphery::SourceChip); // needs to enable the chip to get a valid temperature reading
|
FPGA::Enable(FPGA::Periphery::SourceChip); // needs to enable the chip to get a valid temperature reading
|
||||||
Protocol::PacketInfo packet;
|
Protocol::PacketInfo packet;
|
||||||
packet.type = Protocol::PacketType::DeviceStatusV1;
|
packet.type = Protocol::PacketType::DeviceStatus;
|
||||||
HW::getDeviceStatus(&packet.statusV1, true);
|
HW::getDeviceStatus(&packet.status, true);
|
||||||
FPGA::Disable(FPGA::Periphery::SourceChip);
|
FPGA::Disable(FPGA::Periphery::SourceChip);
|
||||||
Communication::Send(packet);
|
Communication::Send(packet);
|
||||||
}
|
}
|
||||||
|
@ -351,9 +351,9 @@ void VNA::Work() {
|
|||||||
}
|
}
|
||||||
// Compile info packet
|
// Compile info packet
|
||||||
Protocol::PacketInfo packet;
|
Protocol::PacketInfo packet;
|
||||||
packet.type = Protocol::PacketType::DeviceStatusV1;
|
packet.type = Protocol::PacketType::DeviceStatus;
|
||||||
if(HW::getStatusUpdateFlag()) {
|
if(HW::getStatusUpdateFlag()) {
|
||||||
HW::getDeviceStatus(&packet.statusV1, true);
|
HW::getDeviceStatus(&packet.status, true);
|
||||||
Communication::Send(packet);
|
Communication::Send(packet);
|
||||||
}
|
}
|
||||||
// do not reset unlevel flag here, as it is calculated only once at the setup of the sweep
|
// do not reset unlevel flag here, as it is calculated only once at the setup of the sweep
|
||||||
|
Loading…
Reference in New Issue
Block a user