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 "ui_deviceconfigurationdialogv1.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "CustomWidgets/informationbox.h"
|
||||
|
||||
DeviceConfigurationDialogV1::DeviceConfigurationDialogV1(LibreVNADriver &dev, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DeviceConfigurationDialogV1),
|
||||
|
|
@ -56,6 +59,10 @@ DeviceConfigurationDialogV1::DeviceConfigurationDialogV1(LibreVNADriver &dev, QW
|
|||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){
|
||||
reject();
|
||||
});
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, [=](){
|
||||
resetDevice();
|
||||
this->dev.sendWithoutPayload(Protocol::PacketType::RequestDeviceConfiguration);
|
||||
});
|
||||
}
|
||||
|
||||
DeviceConfigurationDialogV1::~DeviceConfigurationDialogV1()
|
||||
|
|
@ -84,3 +91,12 @@ void DeviceConfigurationDialogV1::updateDevice()
|
|||
p.deviceConfig.V1.PLLSettlingDelay = ui->PLLSettlingDelay->value();
|
||||
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:
|
||||
void updateGUI(const Protocol::DeviceConfig &c);
|
||||
void updateDevice();
|
||||
void resetDevice();
|
||||
|
||||
Ui::DeviceConfigurationDialogV1 *ui;
|
||||
LibreVNADriver &dev;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@
|
|||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::RestoreDefaults</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -276,6 +276,10 @@ inline void App_Process() {
|
|||
HW::setDeviceConfig(recv_packet.deviceConfig);
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
case Protocol::PacketType::ResetDeviceConfiguration:
|
||||
HW::SetDefaultDeviceConfig();
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
case Protocol::PacketType::SetTrigger:
|
||||
if(Trigger::GetMode() == Trigger::Mode::USB_GUI) {
|
||||
Trigger::SetInput(true);
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
|||
case PacketType::StopStatusUpdates:
|
||||
case PacketType::StartStatusUpdates:
|
||||
case PacketType::InitiateSweep:
|
||||
case PacketType::ResetDeviceConfiguration:
|
||||
// no payload
|
||||
break;
|
||||
case PacketType::VNADatapoint: payload_size = packet.VNAdatapoint->requiredBufferSize(); break;
|
||||
|
|
|
|||
|
|
@ -605,6 +605,7 @@ enum class PacketType : uint8_t {
|
|||
StartStatusUpdates = 31,
|
||||
InitiateSweep = 32,
|
||||
PerformAction = 33,
|
||||
ResetDeviceConfiguration = 34,
|
||||
};
|
||||
|
||||
using PacketInfo = struct _packetinfo {
|
||||
|
|
|
|||
Loading…
Reference in a new issue