mirror of
https://github.com/jankae/LibreVNA.git
synced 2025-12-06 07:12:10 +01:00
option to restore default values of device configuration
Some checks failed
Build / PC_Application_Ubuntu (push) Has been cancelled
Build / PC_Application_RPi5 (push) Has been cancelled
Build / PC_Application_Windows (push) Has been cancelled
Build / PC_Application_OSX (push) Has been cancelled
Build / PC_Application_OSX_13 (push) Has been cancelled
Build / Embedded_Firmware (push) Has been cancelled
HIL_Tests / Get_Repository (push) Has been cancelled
Unit_Tests / Tests (push) Has been cancelled
HIL_Tests / PC_Application_RPi5 (push) Has been cancelled
HIL_Tests / Embedded_Firmware (push) Has been cancelled
HIL_Tests / HIL (push) Has been cancelled
Some checks failed
Build / PC_Application_Ubuntu (push) Has been cancelled
Build / PC_Application_RPi5 (push) Has been cancelled
Build / PC_Application_Windows (push) Has been cancelled
Build / PC_Application_OSX (push) Has been cancelled
Build / PC_Application_OSX_13 (push) Has been cancelled
Build / Embedded_Firmware (push) Has been cancelled
HIL_Tests / Get_Repository (push) Has been cancelled
Unit_Tests / Tests (push) Has been cancelled
HIL_Tests / PC_Application_RPi5 (push) Has been cancelled
HIL_Tests / Embedded_Firmware (push) Has been cancelled
HIL_Tests / HIL (push) Has been cancelled
This commit is contained in:
parent
b6718c57b2
commit
64791e6d4e
|
|
@ -1,6 +1,9 @@
|
||||||
#include "deviceconfigurationdialogv1.h"
|
#include "deviceconfigurationdialogv1.h"
|
||||||
#include "ui_deviceconfigurationdialogv1.h"
|
#include "ui_deviceconfigurationdialogv1.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include "CustomWidgets/informationbox.h"
|
||||||
|
|
||||||
DeviceConfigurationDialogV1::DeviceConfigurationDialogV1(LibreVNADriver &dev, QWidget *parent) :
|
DeviceConfigurationDialogV1::DeviceConfigurationDialogV1(LibreVNADriver &dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::DeviceConfigurationDialogV1),
|
ui(new Ui::DeviceConfigurationDialogV1),
|
||||||
|
|
@ -56,6 +59,10 @@ DeviceConfigurationDialogV1::DeviceConfigurationDialogV1(LibreVNADriver &dev, QW
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
|
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, [=](){
|
||||||
|
resetDevice();
|
||||||
|
this->dev.sendWithoutPayload(Protocol::PacketType::RequestDeviceConfiguration);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceConfigurationDialogV1::~DeviceConfigurationDialogV1()
|
DeviceConfigurationDialogV1::~DeviceConfigurationDialogV1()
|
||||||
|
|
@ -84,3 +91,12 @@ void DeviceConfigurationDialogV1::updateDevice()
|
||||||
p.deviceConfig.V1.PLLSettlingDelay = ui->PLLSettlingDelay->value();
|
p.deviceConfig.V1.PLLSettlingDelay = ui->PLLSettlingDelay->value();
|
||||||
dev.SendPacket(p);
|
dev.SendPacket(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceConfigurationDialogV1::resetDevice()
|
||||||
|
{
|
||||||
|
dev.sendWithoutPayload(Protocol::PacketType::ResetDeviceConfiguration, [=](LibreVNADriver::TransmissionResult res){
|
||||||
|
if(res != LibreVNADriver::TransmissionResult::Ack) {
|
||||||
|
InformationBox::ShowError("Error", "Failed to reset device configuration");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void updateGUI(const Protocol::DeviceConfig &c);
|
void updateGUI(const Protocol::DeviceConfig &c);
|
||||||
void updateDevice();
|
void updateDevice();
|
||||||
|
void resetDevice();
|
||||||
|
|
||||||
Ui::DeviceConfigurationDialogV1 *ui;
|
Ui::DeviceConfigurationDialogV1 *ui;
|
||||||
LibreVNADriver &dev;
|
LibreVNADriver &dev;
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::RestoreDefaults</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,10 @@ inline void App_Process() {
|
||||||
HW::setDeviceConfig(recv_packet.deviceConfig);
|
HW::setDeviceConfig(recv_packet.deviceConfig);
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
break;
|
break;
|
||||||
|
case Protocol::PacketType::ResetDeviceConfiguration:
|
||||||
|
HW::SetDefaultDeviceConfig();
|
||||||
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
|
break;
|
||||||
case Protocol::PacketType::SetTrigger:
|
case Protocol::PacketType::SetTrigger:
|
||||||
if(Trigger::GetMode() == Trigger::Mode::USB_GUI) {
|
if(Trigger::GetMode() == Trigger::Mode::USB_GUI) {
|
||||||
Trigger::SetInput(true);
|
Trigger::SetInput(true);
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
||||||
case PacketType::StopStatusUpdates:
|
case PacketType::StopStatusUpdates:
|
||||||
case PacketType::StartStatusUpdates:
|
case PacketType::StartStatusUpdates:
|
||||||
case PacketType::InitiateSweep:
|
case PacketType::InitiateSweep:
|
||||||
|
case PacketType::ResetDeviceConfiguration:
|
||||||
// no payload
|
// no payload
|
||||||
break;
|
break;
|
||||||
case PacketType::VNADatapoint: payload_size = packet.VNAdatapoint->requiredBufferSize(); break;
|
case PacketType::VNADatapoint: payload_size = packet.VNAdatapoint->requiredBufferSize(); break;
|
||||||
|
|
|
||||||
|
|
@ -605,6 +605,7 @@ enum class PacketType : uint8_t {
|
||||||
StartStatusUpdates = 31,
|
StartStatusUpdates = 31,
|
||||||
InitiateSweep = 32,
|
InitiateSweep = 32,
|
||||||
PerformAction = 33,
|
PerformAction = 33,
|
||||||
|
ResetDeviceConfiguration = 34,
|
||||||
};
|
};
|
||||||
|
|
||||||
using PacketInfo = struct _packetinfo {
|
using PacketInfo = struct _packetinfo {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue