-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added dialogs for hardware version 0xFE
- Loading branch information
Showing
12 changed files
with
1,694 additions
and
8 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvfe.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "deviceconfigurationdialogvfe.h" | ||
#include "ui_deviceconfigurationdialogvfe.h" | ||
|
||
#include <QtEndian> | ||
|
||
DeviceConfigurationDialogVFE::DeviceConfigurationDialogVFE(LibreVNADriver &dev, QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::DeviceConfigurationDialogVFE), | ||
dev(dev) | ||
{ | ||
ui->setupUi(this); | ||
setAttribute(Qt::WA_DeleteOnClose); | ||
|
||
emit dev.acquireControl(); | ||
|
||
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p) { | ||
if(p.type == Protocol::PacketType::DeviceConfiguration) { | ||
updateGUI(p.deviceConfig); | ||
} | ||
}); | ||
|
||
connect(ui->autogain, &QCheckBox::toggled, this, [=](){ | ||
ui->portgain->setEnabled(!ui->autogain->isChecked()); | ||
ui->refgain->setEnabled(!ui->autogain->isChecked()); | ||
}); | ||
|
||
dev.sendWithoutPayload(Protocol::PacketType::RequestDeviceConfiguration); | ||
|
||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=](){ | ||
updateDevice(); | ||
accept(); | ||
}); | ||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){ | ||
reject(); | ||
}); | ||
} | ||
|
||
DeviceConfigurationDialogVFE::~DeviceConfigurationDialogVFE() | ||
{ | ||
dev.releaseControl(); | ||
delete ui; | ||
} | ||
|
||
void DeviceConfigurationDialogVFE::updateGUI(const Protocol::DeviceConfig &c) | ||
{ | ||
ui->autogain->setChecked(c.VFE.autogain); | ||
ui->portgain->setCurrentIndex(c.VFE.portGain); | ||
ui->refgain->setCurrentIndex(c.VFE.refGain); | ||
} | ||
|
||
void DeviceConfigurationDialogVFE::updateDevice() | ||
{ | ||
Protocol::PacketInfo p; | ||
p.type = Protocol::PacketType::DeviceConfiguration; | ||
|
||
p.deviceConfig.VFE.autogain = ui->autogain->isChecked() ? 1 : 0; | ||
p.deviceConfig.VFE.portGain = ui->portgain->currentIndex(); | ||
p.deviceConfig.VFE.refGain = ui->refgain->currentIndex(); | ||
dev.SendPacket(p); | ||
} |
31 changes: 31 additions & 0 deletions
31
Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvfe.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef DEVICECONFIGURATIONDIALOGVFE_H | ||
#define DEVICECONFIGURATIONDIALOGVFE_H | ||
|
||
#include "librevnadriver.h" | ||
|
||
#include <QDialog> | ||
#include <QHostAddress> | ||
|
||
namespace Ui { | ||
class DeviceConfigurationDialogVFE; | ||
} | ||
|
||
class DeviceConfigurationDialogVFE : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit DeviceConfigurationDialogVFE(LibreVNADriver &dev, QWidget *parent = nullptr); | ||
~DeviceConfigurationDialogVFE(); | ||
|
||
private: | ||
void updateGUI(const Protocol::DeviceConfig &c); | ||
void updateDevice(); | ||
|
||
Ui::DeviceConfigurationDialogVFE *ui; | ||
LibreVNADriver &dev; | ||
|
||
QHostAddress ip, mask, gateway; | ||
}; | ||
|
||
#endif // DEVICECONFIGURATIONDIALOGVFE_H |
170 changes: 170 additions & 0 deletions
170
Software/PC_Application/LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvfe.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>DeviceConfigurationDialogVFE</class> | ||
<widget class="QWidget" name="DeviceConfigurationDialogVFE"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>307</width> | ||
<height>180</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_2"> | ||
<item> | ||
<widget class="QGroupBox" name="groupBox_3"> | ||
<property name="title"> | ||
<string>PGA configuration (reset after reboot)</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_3"> | ||
<item> | ||
<widget class="QCheckBox" name="autogain"> | ||
<property name="text"> | ||
<string>Autogain</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<layout class="QFormLayout" name="formLayout_2"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label_4"> | ||
<property name="text"> | ||
<string>Port gain:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<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="0"> | ||
<widget class="QLabel" name="label_5"> | ||
<property name="text"> | ||
<string>Reference gain:</string> | ||
</property> | ||
</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> | ||
</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> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.