LibreVNADriver specific actions
This commit is contained in:
parent
cde564299c
commit
80c5fc0ff6
@ -1730,7 +1730,6 @@ void Calibration::addMeasurements(std::set<CalibrationMeasurement::Base *> m, co
|
|||||||
meas->addPoint(data);
|
meas->addPoint(data);
|
||||||
}
|
}
|
||||||
unsavedChanges = true;
|
unsavedChanges = true;
|
||||||
// TODO
|
|
||||||
if(DeviceDriver::getActiveDriver()) {
|
if(DeviceDriver::getActiveDriver()) {
|
||||||
validDevice = DeviceDriver::getActiveDriver()->getSerial();
|
validDevice = DeviceDriver::getActiveDriver()->getSerial();
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,16 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
|
|
||||||
AmplitudeCalDialog::AmplitudeCalDialog(Device *dev, ModeHandler *handler, QWidget *parent) :
|
AmplitudeCalDialog::AmplitudeCalDialog(LibreVNADriver *dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AmplitudeCalDialog),
|
ui(new Ui::AmplitudeCalDialog),
|
||||||
dev(dev),
|
dev(dev),
|
||||||
modeHandler(handler),
|
|
||||||
model(this),
|
model(this),
|
||||||
edited(false),
|
edited(false),
|
||||||
mode(CalibrationMode::BothPorts)
|
mode(CalibrationMode::BothPorts)
|
||||||
{
|
{
|
||||||
activeMode = modeHandler->getActiveMode();
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
modeHandler->deactivate(activeMode);
|
emit dev->acquireControl();
|
||||||
dev->SetIdle();
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->view->setModel(&model);
|
ui->view->setModel(&model);
|
||||||
ui->view->setColumnWidth(AmplitudeModel::ColIndexFreq, 100);
|
ui->view->setColumnWidth(AmplitudeModel::ColIndexFreq, 100);
|
||||||
@ -134,13 +132,21 @@ AmplitudeCalDialog::AmplitudeCalDialog(Device *dev, ModeHandler *handler, QWidge
|
|||||||
});
|
});
|
||||||
connect(ui->automatic, &QPushButton::clicked, this, &AmplitudeCalDialog::AutomaticMeasurementDialog);
|
connect(ui->automatic, &QPushButton::clicked, this, &AmplitudeCalDialog::AutomaticMeasurementDialog);
|
||||||
|
|
||||||
connect(dev, &Device::SpectrumResultReceived, this, &AmplitudeCalDialog::ReceivedMeasurement, Qt::QueuedConnection);
|
connect(this, &AmplitudeCalDialog::SpectrumResultReceived, this, &AmplitudeCalDialog::ReceivedMeasurement);
|
||||||
|
|
||||||
|
connect(dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p){
|
||||||
|
if(p.type == Protocol::PacketType::SpectrumAnalyzerResult) {
|
||||||
|
emit SpectrumResultReceived(p.spectrumResult);
|
||||||
|
} else if(p.type == Protocol::PacketType::SourceCalPoint || p.type == Protocol::PacketType::ReceiverCalPoint) {
|
||||||
|
emit AmplitudeCorrectionPointReceived(p.amplitudePoint);
|
||||||
|
}
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
AmplitudeCalDialog::~AmplitudeCalDialog()
|
AmplitudeCalDialog::~AmplitudeCalDialog()
|
||||||
{
|
{
|
||||||
|
emit dev->releaseControl();
|
||||||
delete ui;
|
delete ui;
|
||||||
modeHandler->activate(activeMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmplitudeCalDialog::reject()
|
void AmplitudeCalDialog::reject()
|
||||||
@ -200,7 +206,7 @@ void AmplitudeCalDialog::ReceivedPoint(Protocol::AmplitudeCorrectionPoint p)
|
|||||||
emit pointsUpdated();
|
emit pointsUpdated();
|
||||||
if(p.pointNum == p.totalPoints - 1) {
|
if(p.pointNum == p.totalPoints - 1) {
|
||||||
// this was the last point
|
// this was the last point
|
||||||
disconnect(dev, &Device::AmplitudeCorrectionPointReceived, this, nullptr);
|
disconnect(this, &AmplitudeCalDialog::AmplitudeCorrectionPointReceived, this, nullptr);
|
||||||
ui->load->setEnabled(true);
|
ui->load->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,18 +214,18 @@ void AmplitudeCalDialog::ReceivedPoint(Protocol::AmplitudeCorrectionPoint p)
|
|||||||
void AmplitudeCalDialog::LoadFromDevice()
|
void AmplitudeCalDialog::LoadFromDevice()
|
||||||
{
|
{
|
||||||
ui->load->setEnabled(false);
|
ui->load->setEnabled(false);
|
||||||
dev->SetIdle();
|
dev->setIdle();
|
||||||
RemoveAllPoints();
|
RemoveAllPoints();
|
||||||
// qDebug() << "Asking for amplitude calibration";
|
// qDebug() << "Asking for amplitude calibration";
|
||||||
connect(dev, &Device::AmplitudeCorrectionPointReceived, this, &AmplitudeCalDialog::ReceivedPoint, Qt::QueuedConnection);
|
connect(this, &AmplitudeCalDialog::AmplitudeCorrectionPointReceived, this, &AmplitudeCalDialog::ReceivedPoint, Qt::QueuedConnection);
|
||||||
dev->SendCommandWithoutPayload(requestCommand());
|
dev->sendWithoutPayload(requestCommand());
|
||||||
edited = false;
|
edited = false;
|
||||||
UpdateSaveButton();
|
UpdateSaveButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmplitudeCalDialog::SaveToDevice()
|
void AmplitudeCalDialog::SaveToDevice()
|
||||||
{
|
{
|
||||||
dev->SetIdle();
|
dev->setIdle();
|
||||||
for(unsigned int i=0;i<points.size();i++) {
|
for(unsigned int i=0;i<points.size();i++) {
|
||||||
auto p = points[i];
|
auto p = points[i];
|
||||||
Protocol::PacketInfo info;
|
Protocol::PacketInfo info;
|
||||||
@ -256,7 +262,7 @@ void AmplitudeCalDialog::RemoveAllPoints()
|
|||||||
|
|
||||||
bool AmplitudeCalDialog::AddPoint(AmplitudeCalDialog::CorrectionPoint &p)
|
bool AmplitudeCalDialog::AddPoint(AmplitudeCalDialog::CorrectionPoint &p)
|
||||||
{
|
{
|
||||||
if (points.size() >= Device::Info(dev).limits_maxAmplitudePoints) {
|
if (points.size() >= dev->getMaxAmplitudePoints()) {
|
||||||
// already at limit
|
// already at limit
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -302,8 +308,8 @@ void AmplitudeCalDialog::AddPointDialog()
|
|||||||
ui->stopFreq->setUnit("Hz");
|
ui->stopFreq->setUnit("Hz");
|
||||||
ui->stopFreq->setPrefixes(" kMG");
|
ui->stopFreq->setPrefixes(" kMG");
|
||||||
ui->frequency->setValue(1000000000.0);
|
ui->frequency->setValue(1000000000.0);
|
||||||
ui->startFreq->setValue(Device::Info(dev).limits_minFreq);
|
ui->startFreq->setValue(dev->getInfo().Limits.SA.minFreq);
|
||||||
ui->stopFreq->setValue(Device::Info(dev).limits_maxFreq);
|
ui->stopFreq->setValue(dev->getInfo().Limits.SA.maxFreq);
|
||||||
connect(ui->singlePoint, &QRadioButton::toggled, [=](bool single) {
|
connect(ui->singlePoint, &QRadioButton::toggled, [=](bool single) {
|
||||||
ui->stopFreq->setEnabled(!single);
|
ui->stopFreq->setEnabled(!single);
|
||||||
ui->startFreq->setEnabled(!single);
|
ui->startFreq->setEnabled(!single);
|
||||||
@ -342,7 +348,7 @@ void AmplitudeCalDialog::AddPointDialog()
|
|||||||
delete d;
|
delete d;
|
||||||
});
|
});
|
||||||
|
|
||||||
dev->SendCommandWithoutPayload(requestCommand());
|
dev->sendWithoutPayload(requestCommand());
|
||||||
|
|
||||||
if(AppWindow::showGUI()) {
|
if(AppWindow::showGUI()) {
|
||||||
d->show();
|
d->show();
|
||||||
@ -377,14 +383,14 @@ void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
|||||||
connect(automatic.dialog, &QDialog::rejected, ui->abort, &QPushButton::click);
|
connect(automatic.dialog, &QDialog::rejected, ui->abort, &QPushButton::click);
|
||||||
connect(ui->abort, &QPushButton::clicked, [=](){
|
connect(ui->abort, &QPushButton::clicked, [=](){
|
||||||
// aborted, clean up
|
// aborted, clean up
|
||||||
disconnect(dev, &Device::SpectrumResultReceived, this, &AmplitudeCalDialog::ReceivedAutomaticMeasurementResult);
|
disconnect(this, &AmplitudeCalDialog::SpectrumResultReceived, this, &AmplitudeCalDialog::ReceivedAutomaticMeasurementResult);
|
||||||
dev->SetIdle();
|
dev->setIdle();
|
||||||
delete ui;
|
delete ui;
|
||||||
delete automatic.dialog;
|
delete automatic.dialog;
|
||||||
});
|
});
|
||||||
|
|
||||||
dev->SetIdle();
|
dev->setIdle();
|
||||||
connect(dev, &Device::AmplitudeCorrectionPointReceived, this, [this, ui, otherCal](Protocol::AmplitudeCorrectionPoint p) {
|
connect(this, &AmplitudeCalDialog::AmplitudeCorrectionPointReceived, this, [this, ui, otherCal](Protocol::AmplitudeCorrectionPoint p) {
|
||||||
CorrectionPoint c;
|
CorrectionPoint c;
|
||||||
c.frequency = p.freq * 10.0;
|
c.frequency = p.freq * 10.0;
|
||||||
c.correctionPort1 = p.port1;
|
c.correctionPort1 = p.port1;
|
||||||
@ -398,14 +404,14 @@ void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
|||||||
ui->progress->setValue(0);
|
ui->progress->setValue(0);
|
||||||
ui->status->setText(otherCal + " Calibration contains " +QString::number(p.totalPoints)+" points, ready to start measurement");
|
ui->status->setText(otherCal + " Calibration contains " +QString::number(p.totalPoints)+" points, ready to start measurement");
|
||||||
ui->start->setEnabled(true);
|
ui->start->setEnabled(true);
|
||||||
disconnect(dev, &Device::AmplitudeCorrectionPointReceived, this, nullptr);
|
disconnect(this, &AmplitudeCalDialog::AmplitudeCorrectionPointReceived, this, nullptr);
|
||||||
qDebug() << "Received" << p.totalPoints << "points for automatic calibration";
|
qDebug() << "Received" << p.totalPoints << "points for automatic calibration";
|
||||||
}
|
}
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
// request points of otherCal
|
// request points of otherCal
|
||||||
// switch between source/receiver calibration
|
// switch between source/receiver calibration
|
||||||
auto request = automatic.isSourceCal ? Protocol::PacketType::RequestReceiverCal : Protocol::PacketType::RequestSourceCal;
|
auto request = automatic.isSourceCal ? Protocol::PacketType::RequestReceiverCal : Protocol::PacketType::RequestSourceCal;
|
||||||
dev->SendCommandWithoutPayload(request);
|
dev->sendWithoutPayload(request);
|
||||||
|
|
||||||
connect(ui->start, &QPushButton::clicked, [=](){
|
connect(ui->start, &QPushButton::clicked, [=](){
|
||||||
// remove any exising points in own calibration and copy points from other calibration
|
// remove any exising points in own calibration and copy points from other calibration
|
||||||
@ -414,7 +420,7 @@ void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
|||||||
AddPoint(p.frequency);
|
AddPoint(p.frequency);
|
||||||
}
|
}
|
||||||
// intialize measurement state machine
|
// intialize measurement state machine
|
||||||
connect(dev, &Device::SpectrumResultReceived, this, &AmplitudeCalDialog::ReceivedAutomaticMeasurementResult, Qt::QueuedConnection);
|
connect(this, &AmplitudeCalDialog::SpectrumResultReceived, this, &AmplitudeCalDialog::ReceivedAutomaticMeasurementResult, Qt::QueuedConnection);
|
||||||
automatic.measuringPort2 = false;
|
automatic.measuringPort2 = false;
|
||||||
automatic.measuringCount = 0;
|
automatic.measuringCount = 0;
|
||||||
ui->status->setText("Taking measurements...");
|
ui->status->setText("Taking measurements...");
|
||||||
@ -426,9 +432,8 @@ void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmplitudeCalDialog::ReceivedMeasurement(Device *dev, Protocol::SpectrumAnalyzerResult res)
|
void AmplitudeCalDialog::ReceivedMeasurement(Protocol::SpectrumAnalyzerResult res)
|
||||||
{
|
{
|
||||||
Q_UNUSED(dev)
|
|
||||||
MeasurementResult m = {.port1 = Util::SparamTodB(res.port1), .port2 = Util::SparamTodB(res.port2)};
|
MeasurementResult m = {.port1 = Util::SparamTodB(res.port1), .port2 = Util::SparamTodB(res.port2)};
|
||||||
sweepMeasurements.push_back(m);
|
sweepMeasurements.push_back(m);
|
||||||
if(res.pointNum == automaticSweepPoints - 1) {
|
if(res.pointNum == automaticSweepPoints - 1) {
|
||||||
@ -533,9 +538,8 @@ void AmplitudeCalDialog::SetupNextAutomaticPoint(bool isSourceCal)
|
|||||||
sweepMeasurements.reserve(automaticSweepPoints);
|
sweepMeasurements.reserve(automaticSweepPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmplitudeCalDialog::ReceivedAutomaticMeasurementResult(Device *dev, Protocol::SpectrumAnalyzerResult res)
|
void AmplitudeCalDialog::ReceivedAutomaticMeasurementResult(Protocol::SpectrumAnalyzerResult res)
|
||||||
{
|
{
|
||||||
Q_UNUSED(dev)
|
|
||||||
if(res.pointNum != automaticSweepPoints - 1) {
|
if(res.pointNum != automaticSweepPoints - 1) {
|
||||||
// ignore everything except end of sweep
|
// ignore everything except end of sweep
|
||||||
return;
|
return;
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef AMPLITUDECALDIALOG_H
|
#ifndef AMPLITUDECALDIALOG_H
|
||||||
#define AMPLITUDECALDIALOG_H
|
#define AMPLITUDECALDIALOG_H
|
||||||
|
|
||||||
#include "mode.h"
|
#include "librevnadriver.h"
|
||||||
#include "modehandler.h"
|
|
||||||
#include "Device/device.h"
|
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
#include <QProgressBar>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AmplitudeCalDialog;
|
class AmplitudeCalDialog;
|
||||||
@ -15,7 +16,7 @@ class AmplitudeCalDialog;
|
|||||||
|
|
||||||
class AmplitudeModel : public QAbstractTableModel
|
class AmplitudeModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
friend AmplitudeCalDialog;
|
friend class AmplitudeCalDialog;
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AmplitudeModel(AmplitudeCalDialog *c);
|
AmplitudeModel(AmplitudeCalDialog *c);
|
||||||
@ -43,7 +44,7 @@ class AmplitudeCalDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AmplitudeCalDialog(Device *dev, ModeHandler *handler, QWidget *parent = nullptr);
|
explicit AmplitudeCalDialog(LibreVNADriver *dev, QWidget *parent = nullptr);
|
||||||
~AmplitudeCalDialog();
|
~AmplitudeCalDialog();
|
||||||
void reject() override;
|
void reject() override;
|
||||||
|
|
||||||
@ -78,16 +79,18 @@ protected slots:
|
|||||||
bool AddPoint(double frequency);
|
bool AddPoint(double frequency);
|
||||||
void AddPointDialog();
|
void AddPointDialog();
|
||||||
void AutomaticMeasurementDialog();
|
void AutomaticMeasurementDialog();
|
||||||
void ReceivedMeasurement(Device *dev, Protocol::SpectrumAnalyzerResult res);
|
|
||||||
signals:
|
signals:
|
||||||
void pointsUpdated();
|
void pointsUpdated();
|
||||||
void newPointCreated(CorrectionPoint& p);
|
void newPointCreated(CorrectionPoint& p);
|
||||||
|
void AmplitudeCorrectionPointReceived(Protocol::AmplitudeCorrectionPoint p);
|
||||||
|
void SpectrumResultReceived(Protocol::SpectrumAnalyzerResult res);
|
||||||
protected:
|
protected:
|
||||||
static constexpr double excitationAmplitude = -20.0;
|
static constexpr double excitationAmplitude = -20.0;
|
||||||
static constexpr int automaticSweepPoints = 31;
|
static constexpr int automaticSweepPoints = 31;
|
||||||
static constexpr int averages = 3;
|
static constexpr int averages = 3;
|
||||||
static constexpr int automaticSettling = 1;
|
static constexpr int automaticSettling = 1;
|
||||||
|
|
||||||
|
void ReceivedMeasurement(Protocol::SpectrumAnalyzerResult res);
|
||||||
bool ConfirmActionIfEdited();
|
bool ConfirmActionIfEdited();
|
||||||
void UpdateSaveButton();
|
void UpdateSaveButton();
|
||||||
virtual Protocol::PacketType requestCommand() = 0;
|
virtual Protocol::PacketType requestCommand() = 0;
|
||||||
@ -100,15 +103,13 @@ protected:
|
|||||||
virtual void UpdateAmplitude(CorrectionPoint& point) = 0;
|
virtual void UpdateAmplitude(CorrectionPoint& point) = 0;
|
||||||
std::vector<CorrectionPoint> points;
|
std::vector<CorrectionPoint> points;
|
||||||
Ui::AmplitudeCalDialog *ui;
|
Ui::AmplitudeCalDialog *ui;
|
||||||
Device *dev;
|
LibreVNADriver *dev;
|
||||||
Mode *activeMode;
|
|
||||||
ModeHandler *modeHandler;
|
|
||||||
AmplitudeModel model;
|
AmplitudeModel model;
|
||||||
bool edited;
|
bool edited;
|
||||||
CalibrationMode mode;
|
CalibrationMode mode;
|
||||||
|
|
||||||
void SetupNextAutomaticPoint(bool isSourceCal);
|
void SetupNextAutomaticPoint(bool isSourceCal);
|
||||||
void ReceivedAutomaticMeasurementResult(Device *dev, Protocol::SpectrumAnalyzerResult res);
|
void ReceivedAutomaticMeasurementResult(Protocol::SpectrumAnalyzerResult res);
|
||||||
struct {
|
struct {
|
||||||
QDialog *dialog;
|
QDialog *dialog;
|
||||||
std::vector<CorrectionPoint> points;
|
std::vector<CorrectionPoint> points;
|
@ -6,7 +6,7 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
||||||
FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
FirmwareUpdateDialog::FirmwareUpdateDialog(LibreVNADriver *dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FirmwareUpdateDialog),
|
ui(new Ui::FirmwareUpdateDialog),
|
||||||
dev(dev),
|
dev(dev),
|
||||||
@ -15,6 +15,8 @@ FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
|||||||
state(State::Idle),
|
state(State::Idle),
|
||||||
transferredBytes(0)
|
transferredBytes(0)
|
||||||
{
|
{
|
||||||
|
dev->acquireControl();
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->bFile->setIcon(this->style()->standardPixmap(QStyle::SP_FileDialogStart));
|
ui->bFile->setIcon(this->style()->standardPixmap(QStyle::SP_FileDialogStart));
|
||||||
ui->bStart->setIcon(this->style()->standardPixmap(QStyle::SP_MediaPlay));
|
ui->bStart->setIcon(this->style()->standardPixmap(QStyle::SP_MediaPlay));
|
||||||
@ -23,6 +25,7 @@ FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
|||||||
|
|
||||||
FirmwareUpdateDialog::~FirmwareUpdateDialog()
|
FirmwareUpdateDialog::~FirmwareUpdateDialog()
|
||||||
{
|
{
|
||||||
|
dev->releaseControl();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,10 +65,15 @@ void FirmwareUpdateDialog::on_bStart_clicked()
|
|||||||
}
|
}
|
||||||
file->seek(0);
|
file->seek(0);
|
||||||
state = State::ErasingFLASH;
|
state = State::ErasingFLASH;
|
||||||
connect(dev, &Device::AckReceived, this, &FirmwareUpdateDialog::receivedAck, Qt::QueuedConnection);
|
connect(dev, &LibreVNADriver::receivedAnswer, this, [=](const LibreVNADriver::TransmissionResult &res) {
|
||||||
connect(dev, &Device::NackReceived, this, &FirmwareUpdateDialog::receivedNack, Qt::QueuedConnection);
|
if(res == LibreVNADriver::TransmissionResult::Ack) {
|
||||||
|
receivedAck();
|
||||||
|
} else if(res == LibreVNADriver::TransmissionResult::Nack) {
|
||||||
|
receivedNack();
|
||||||
|
}
|
||||||
|
}, static_cast<Qt::ConnectionType>(Qt::QueuedConnection | Qt::UniqueConnection));
|
||||||
addStatus("Erasing device memory...");
|
addStatus("Erasing device memory...");
|
||||||
dev->SendCommandWithoutPayload(Protocol::PacketType::ClearFlash);
|
dev->sendWithoutPayload(Protocol::PacketType::ClearFlash);
|
||||||
timer.setSingleShot(true);
|
timer.setSingleShot(true);
|
||||||
timer.start(20000);
|
timer.start(20000);
|
||||||
}
|
}
|
||||||
@ -78,8 +86,6 @@ void FirmwareUpdateDialog::addStatus(QString line)
|
|||||||
void FirmwareUpdateDialog::abortWithError(QString error)
|
void FirmwareUpdateDialog::abortWithError(QString error)
|
||||||
{
|
{
|
||||||
timer.stop();
|
timer.stop();
|
||||||
disconnect(dev, &Device::AckReceived, this, &FirmwareUpdateDialog::receivedAck);
|
|
||||||
disconnect(dev, &Device::NackReceived, this, &FirmwareUpdateDialog::receivedNack);
|
|
||||||
|
|
||||||
QTextCharFormat tf;
|
QTextCharFormat tf;
|
||||||
tf = ui->status->currentCharFormat();
|
tf = ui->status->currentCharFormat();
|
||||||
@ -97,7 +103,7 @@ void FirmwareUpdateDialog::timerCallback()
|
|||||||
switch(state) {
|
switch(state) {
|
||||||
case State::WaitingForReboot: {
|
case State::WaitingForReboot: {
|
||||||
// Currently waiting for the reboot, check device list
|
// Currently waiting for the reboot, check device list
|
||||||
auto devices = Device::GetDevices();
|
auto devices = dev->GetAvailableDevices();
|
||||||
if(devices.find(serialnumber) != devices.end()) {
|
if(devices.find(serialnumber) != devices.end()) {
|
||||||
// the device rebooted and is available again
|
// the device rebooted and is available again
|
||||||
addStatus("...device enumerated, update complete");
|
addStatus("...device enumerated, update complete");
|
||||||
@ -109,7 +115,7 @@ void FirmwareUpdateDialog::timerCallback()
|
|||||||
case State::WaitBeforeInitializing:
|
case State::WaitBeforeInitializing:
|
||||||
// Device had enough time to initialize, indicate that rebooted device is ready
|
// Device had enough time to initialize, indicate that rebooted device is ready
|
||||||
timer.stop();
|
timer.stop();
|
||||||
emit DeviceRebooted(serialnumber);
|
dev->connectDevice(serialnumber);
|
||||||
delete this;
|
delete this;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -139,7 +145,7 @@ void FirmwareUpdateDialog::receivedAck()
|
|||||||
// complete file transferred
|
// complete file transferred
|
||||||
addStatus("Triggering device update...");
|
addStatus("Triggering device update...");
|
||||||
state = State::TriggeringUpdate;
|
state = State::TriggeringUpdate;
|
||||||
dev->SendCommandWithoutPayload(Protocol::PacketType::PerformFirmwareUpdate);
|
dev->sendWithoutPayload(Protocol::PacketType::PerformFirmwareUpdate);
|
||||||
timer.start(5000);
|
timer.start(5000);
|
||||||
} else {
|
} else {
|
||||||
sendNextFirmwareChunk();
|
sendNextFirmwareChunk();
|
||||||
@ -148,8 +154,8 @@ void FirmwareUpdateDialog::receivedAck()
|
|||||||
break;
|
break;
|
||||||
case State::TriggeringUpdate:
|
case State::TriggeringUpdate:
|
||||||
addStatus("Rebooting device...");
|
addStatus("Rebooting device...");
|
||||||
serialnumber = dev->serial();
|
serialnumber = dev->getSerial();
|
||||||
emit DeviceRebooting();
|
dev->disconnectDevice();
|
||||||
state = State::WaitingForReboot;
|
state = State::WaitingForReboot;
|
||||||
timer.setSingleShot(false);
|
timer.setSingleShot(false);
|
||||||
timer.start(2000);
|
timer.start(2000);
|
||||||
@ -174,8 +180,9 @@ void FirmwareUpdateDialog::receivedNack()
|
|||||||
|
|
||||||
void FirmwareUpdateDialog::sendNextFirmwareChunk()
|
void FirmwareUpdateDialog::sendNextFirmwareChunk()
|
||||||
{
|
{
|
||||||
Protocol::FirmwarePacket fw;
|
Protocol::PacketInfo p;
|
||||||
fw.address = transferredBytes;
|
p.type = Protocol::PacketType::FirmwarePacket;
|
||||||
file->read((char*) &fw.data, PacketConstants::FW_CHUNK_SIZE);
|
p.firmware.address = transferredBytes;
|
||||||
dev->SendFirmwareChunk(fw);
|
file->read((char*) &p.firmware.data, PacketConstants::FW_CHUNK_SIZE);
|
||||||
|
dev->SendPacket(p);
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FIRMWAREUPDATEDIALOG_H
|
#ifndef FIRMWAREUPDATEDIALOG_H
|
||||||
#define FIRMWAREUPDATEDIALOG_H
|
#define FIRMWAREUPDATEDIALOG_H
|
||||||
|
|
||||||
#include "device.h"
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -23,7 +23,7 @@ public:
|
|||||||
* - If the update fails during device reboot, the device pointer is set to zero and the device deleted
|
* - If the update fails during device reboot, the device pointer is set to zero and the device deleted
|
||||||
* - If the update succeeds, the device pointer will be set to the new device instance
|
* - If the update succeeds, the device pointer will be set to the new device instance
|
||||||
*/
|
*/
|
||||||
explicit FirmwareUpdateDialog(Device *dev, QWidget *parent = nullptr);
|
explicit FirmwareUpdateDialog(LibreVNADriver *dev, QWidget *parent = nullptr);
|
||||||
~FirmwareUpdateDialog();
|
~FirmwareUpdateDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -42,7 +42,7 @@ private:
|
|||||||
void abortWithError(QString error);
|
void abortWithError(QString error);
|
||||||
void sendNextFirmwareChunk();
|
void sendNextFirmwareChunk();
|
||||||
Ui::FirmwareUpdateDialog *ui;
|
Ui::FirmwareUpdateDialog *ui;
|
||||||
Device *dev;
|
LibreVNADriver *dev;
|
||||||
QFile *file;
|
QFile *file;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
|
|
@ -2,18 +2,24 @@
|
|||||||
|
|
||||||
#include "ui_frequencycaldialog.h"
|
#include "ui_frequencycaldialog.h"
|
||||||
|
|
||||||
FrequencyCalDialog::FrequencyCalDialog(Device *dev, ModeHandler *handler, QWidget *parent) :
|
FrequencyCalDialog::FrequencyCalDialog(LibreVNADriver *dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FrequencyCalDialog),
|
ui(new Ui::FrequencyCalDialog),
|
||||||
dev(dev)
|
dev(dev)
|
||||||
{
|
{
|
||||||
|
emit dev->acquireControl();
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->ppm->setUnit("ppm");
|
ui->ppm->setUnit("ppm");
|
||||||
ui->ppm->setPrefixes(" ");
|
ui->ppm->setPrefixes(" ");
|
||||||
ui->ppm->setPrecision(4);
|
ui->ppm->setPrecision(4);
|
||||||
ui->ppm->setValue(0.0);
|
ui->ppm->setValue(0.0);
|
||||||
|
|
||||||
connect(dev, &Device::FrequencyCorrectionReceived, ui->ppm, &SIUnitEdit::setValueQuiet, Qt::QueuedConnection);
|
connect(dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p){
|
||||||
|
if(p.type == Protocol::PacketType::FrequencyCorrection) {
|
||||||
|
ui->ppm->setValueQuiet(p.frequencyCorrection.ppm);
|
||||||
|
}
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, [=](){
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, [=](){
|
||||||
// get value and transfer to device
|
// get value and transfer to device
|
||||||
@ -21,20 +27,16 @@ FrequencyCalDialog::FrequencyCalDialog(Device *dev, ModeHandler *handler, QWidg
|
|||||||
p.type = Protocol::PacketType::FrequencyCorrection;
|
p.type = Protocol::PacketType::FrequencyCorrection;
|
||||||
p.frequencyCorrection.ppm = ui->ppm->value();
|
p.frequencyCorrection.ppm = ui->ppm->value();
|
||||||
dev->SendPacket(p);
|
dev->SendPacket(p);
|
||||||
// force restart of current mode for setting to take effect
|
|
||||||
auto activeMode = handler->getActiveMode();
|
|
||||||
handler->deactivate(activeMode);
|
|
||||||
handler->activate(activeMode);
|
|
||||||
accept();
|
accept();
|
||||||
delete this;
|
delete this;
|
||||||
});
|
});
|
||||||
|
|
||||||
// request setting from device
|
// request setting from device
|
||||||
dev->SendCommandWithoutPayload(Protocol::PacketType::RequestFrequencyCorrection);
|
dev->sendWithoutPayload(Protocol::PacketType::RequestFrequencyCorrection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FrequencyCalDialog::~FrequencyCalDialog()
|
FrequencyCalDialog::~FrequencyCalDialog()
|
||||||
{
|
{
|
||||||
|
emit dev->releaseControl();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
@ -1,9 +1,7 @@
|
|||||||
#ifndef FREQUENCYCALDIALOG_H
|
#ifndef FREQUENCYCALDIALOG_H
|
||||||
#define FREQUENCYCALDIALOG_H
|
#define FREQUENCYCALDIALOG_H
|
||||||
|
|
||||||
#include "Device/device.h"
|
#include "librevnadriver.h"
|
||||||
#include "modehandler.h"
|
|
||||||
#include "mode.h"
|
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
@ -16,12 +14,12 @@ class FrequencyCalDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FrequencyCalDialog(Device *dev, ModeHandler *handler, QWidget *parent = nullptr);
|
explicit FrequencyCalDialog(LibreVNADriver *dev, QWidget *parent = nullptr);
|
||||||
~FrequencyCalDialog();
|
~FrequencyCalDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FrequencyCalDialog *ui;
|
Ui::FrequencyCalDialog *ui;
|
||||||
Device *dev;
|
LibreVNADriver *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FREQUENCYCALDIALOG_H
|
#endif // FREQUENCYCALDIALOG_H
|
@ -1,5 +1,14 @@
|
|||||||
#include "librevnadriver.h"
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
|
#include "manualcontroldialog.h"
|
||||||
|
#include "firmwareupdatedialog.h"
|
||||||
|
#include "frequencycaldialog.h"
|
||||||
|
#include "sourcecaldialog.h"
|
||||||
|
#include "receivercaldialog.h"
|
||||||
|
|
||||||
|
#include "unit.h"
|
||||||
|
#include "CustomWidgets/informationbox.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class Reference
|
class Reference
|
||||||
@ -97,6 +106,53 @@ LibreVNADriver::LibreVNADriver()
|
|||||||
connected = false;
|
connected = false;
|
||||||
skipOwnPacketHandling = false;
|
skipOwnPacketHandling = false;
|
||||||
SApoints = 0;
|
SApoints = 0;
|
||||||
|
|
||||||
|
auto manual = new QAction("Manual Control");
|
||||||
|
connect(manual, &QAction::triggered, this, [=](){
|
||||||
|
auto d = new ManualControlDialog(*this);
|
||||||
|
d->show();
|
||||||
|
});
|
||||||
|
specificActions.push_back(manual);
|
||||||
|
|
||||||
|
auto update = new QAction("Firmware Update");
|
||||||
|
connect(update, &QAction::triggered, this, [=](){
|
||||||
|
auto d = new FirmwareUpdateDialog(this);
|
||||||
|
d->show();
|
||||||
|
});
|
||||||
|
specificActions.push_back(update);
|
||||||
|
|
||||||
|
auto sep = new QAction();
|
||||||
|
sep->setSeparator(true);
|
||||||
|
specificActions.push_back(sep);
|
||||||
|
|
||||||
|
auto srccal = new QAction("Source Calibration");
|
||||||
|
connect(srccal, &QAction::triggered, this, [=](){
|
||||||
|
auto d = new SourceCalDialog(this);
|
||||||
|
d->show();
|
||||||
|
});
|
||||||
|
specificActions.push_back(srccal);
|
||||||
|
|
||||||
|
auto recvcal = new QAction("Receiver Calibration");
|
||||||
|
connect(recvcal, &QAction::triggered, this, [=](){
|
||||||
|
auto d = new ReceiverCalDialog(this);
|
||||||
|
d->show();
|
||||||
|
});
|
||||||
|
specificActions.push_back(recvcal);
|
||||||
|
|
||||||
|
auto freqcal = new QAction("Frequency Calibration");
|
||||||
|
connect(freqcal, &QAction::triggered, this, [=](){
|
||||||
|
auto d = new FrequencyCalDialog(this);
|
||||||
|
d->show();
|
||||||
|
});
|
||||||
|
specificActions.push_back(freqcal);
|
||||||
|
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&captureRawReceiverValues, "captureRawReceiverValues", false));
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&harmonicMixing, "harmonicMixing", false));
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&SASignalID, "signalID", true));
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&VNASuppressInvalidPeaks, "suppressInvalidPeaks", true));
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&VNAAdjustPowerLevel, "adjustPowerLevel", false));
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&SAUseDFT, "useDFT", true));
|
||||||
|
specificSettings.push_back(Savable::SettingDescription(&SARBWLimitForDFT, "RBWlimitDFT", 3000));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<DeviceDriver::Flag> LibreVNADriver::getFlags()
|
std::set<DeviceDriver::Flag> LibreVNADriver::getFlags()
|
||||||
@ -136,24 +192,6 @@ QString LibreVNADriver::getStatus()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Savable::SettingDescription> LibreVNADriver::driverSpecificSettings()
|
|
||||||
{
|
|
||||||
std::vector<Savable::SettingDescription> ret;
|
|
||||||
ret.push_back(Savable::SettingDescription(&captureRawReceiverValues, "captureRawReceiverValues", false));
|
|
||||||
ret.push_back(Savable::SettingDescription(&SASignalID, "signalID", true));
|
|
||||||
ret.push_back(Savable::SettingDescription(&VNASuppressInvalidPeaks, "suppressInvalidPeaks", true));
|
|
||||||
ret.push_back(Savable::SettingDescription(&VNAAdjustPowerLevel, "adjustPowerLevel", false));
|
|
||||||
ret.push_back(Savable::SettingDescription(&SAUseDFT, "useDFT", true));
|
|
||||||
ret.push_back(Savable::SettingDescription(&SARBWLimitForDFT, "RBWlimitDFT", 3000));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<QAction *> LibreVNADriver::driverSpecificActions()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return std::vector<QAction*>();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList LibreVNADriver::availableVNAMeasurements()
|
QStringList LibreVNADriver::availableVNAMeasurements()
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
@ -229,6 +267,7 @@ bool LibreVNADriver::setSA(const DeviceDriver::SASettings &s, std::function<void
|
|||||||
if(!supports(Feature::SA)) {
|
if(!supports(Feature::SA)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
zerospan = s.freqStart == s.freqStop;
|
zerospan = s.freqStart == s.freqStop;
|
||||||
|
|
||||||
Protocol::PacketInfo p = {};
|
Protocol::PacketInfo p = {};
|
||||||
@ -260,6 +299,33 @@ bool LibreVNADriver::setSA(const DeviceDriver::SASettings &s, std::function<void
|
|||||||
p.spectrumSettings.trackingGeneratorPort = s.trackingPort;
|
p.spectrumSettings.trackingGeneratorPort = s.trackingPort;
|
||||||
p.spectrumSettings.syncMode = 0;
|
p.spectrumSettings.syncMode = 0;
|
||||||
p.spectrumSettings.syncMaster = 0;
|
p.spectrumSettings.syncMaster = 0;
|
||||||
|
|
||||||
|
if(p.spectrumSettings.trackingGenerator && p.spectrumSettings.f_stop >= 25000000) {
|
||||||
|
// Check point spacing.
|
||||||
|
// The highband PLL used as the tracking generator is not able to reach every frequency exactly. This
|
||||||
|
// could lead to sharp drops in the spectrum at certain frequencies. If the span is wide enough with
|
||||||
|
// respect to the point number, it is ensured that every displayed point has at least one sample with
|
||||||
|
// a reachable PLL frequency in it. Display a warning message if this is not the case with the current
|
||||||
|
// settings.
|
||||||
|
auto pointSpacing = (p.spectrumSettings.f_stop - p.spectrumSettings.f_start) / (p.spectrumSettings.pointNum - 1);
|
||||||
|
// The frequency resolution of the PLL is frequency dependent (due to PLL divider).
|
||||||
|
// This code assumes some knowledge of the actual hardware and probably should be moved
|
||||||
|
// onto the device at some point
|
||||||
|
double minSpacing = 25000;
|
||||||
|
auto stop = p.spectrumSettings.f_stop;
|
||||||
|
while(stop <= 3000000000) {
|
||||||
|
minSpacing /= 2;
|
||||||
|
stop *= 2;
|
||||||
|
}
|
||||||
|
if(pointSpacing < minSpacing) {
|
||||||
|
auto requiredMinSpan = minSpacing * (p.spectrumSettings.pointNum - 1);
|
||||||
|
auto message = QString() + "Due to PLL limitations, the tracking generator can not reach every frequency exactly. "
|
||||||
|
"With your current span, this could result in the signal not being detected at some bands. A minimum"
|
||||||
|
" span of " + Unit::ToString(requiredMinSpan, "Hz", " kMG") + " is recommended at this stop frequency.";
|
||||||
|
InformationBox::ShowMessage("Warning", message, "TrackingGeneratorSpanTooSmallWarning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SendPacket(p, [=](TransmissionResult r){
|
return SendPacket(p, [=](TransmissionResult r){
|
||||||
if(cb) {
|
if(cb) {
|
||||||
cb(r == TransmissionResult::Ack);
|
cb(r == TransmissionResult::Ack);
|
||||||
@ -364,7 +430,18 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
|
|||||||
|
|
||||||
switch(packet.type) {
|
switch(packet.type) {
|
||||||
case Protocol::PacketType::DeviceInfo:
|
case Protocol::PacketType::DeviceInfo:
|
||||||
// TODO check protocol version
|
// Check protocol version
|
||||||
|
if(packet.info.ProtocolVersion != Protocol::Version) {
|
||||||
|
auto ret = InformationBox::AskQuestion("Warning",
|
||||||
|
"The device reports a different protocol"
|
||||||
|
"version (" + QString::number(packet.info.ProtocolVersion) + ") than expected (" + QString::number(Protocol::Version) + ").\n"
|
||||||
|
"A firmware update is strongly recommended. Do you want to update now?", false);
|
||||||
|
if (ret) {
|
||||||
|
auto d = new FirmwareUpdateDialog(this);
|
||||||
|
d->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
info.firmware_version = QString::number(packet.info.FW_major)+"."+QString::number(packet.info.FW_minor)+"."+QString::number(packet.info.FW_patch);
|
info.firmware_version = QString::number(packet.info.FW_major)+"."+QString::number(packet.info.FW_minor)+"."+QString::number(packet.info.FW_patch);
|
||||||
info.hardware_version = QString::number(packet.info.hardware_version)+QString(packet.info.HW_Revision);
|
info.hardware_version = QString::number(packet.info.hardware_version)+QString(packet.info.HW_Revision);
|
||||||
info.supportedFeatures = {
|
info.supportedFeatures = {
|
||||||
@ -375,7 +452,7 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
|
|||||||
};
|
};
|
||||||
info.Limits.VNA.ports = 2;
|
info.Limits.VNA.ports = 2;
|
||||||
info.Limits.VNA.minFreq = packet.info.limits_minFreq;
|
info.Limits.VNA.minFreq = packet.info.limits_minFreq;
|
||||||
info.Limits.VNA.maxFreq = packet.info.limits_maxFreq; // TODO check if harmonic mixing is enabled
|
info.Limits.VNA.maxFreq = harmonicMixing ? packet.info.limits_maxFreqHarmonic : packet.info.limits_maxFreq;
|
||||||
info.Limits.VNA.maxPoints = packet.info.limits_maxPoints;
|
info.Limits.VNA.maxPoints = packet.info.limits_maxPoints;
|
||||||
info.Limits.VNA.minIFBW = packet.info.limits_minIFBW;
|
info.Limits.VNA.minIFBW = packet.info.limits_minIFBW;
|
||||||
info.Limits.VNA.maxIFBW = packet.info.limits_maxIFBW;
|
info.Limits.VNA.maxIFBW = packet.info.limits_maxIFBW;
|
||||||
@ -395,6 +472,8 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
|
|||||||
info.Limits.SA.maxRBW = packet.info.limits_maxRBW;
|
info.Limits.SA.maxRBW = packet.info.limits_maxRBW;
|
||||||
info.Limits.SA.mindBm = (double) packet.info.limits_cdbm_min / 100;
|
info.Limits.SA.mindBm = (double) packet.info.limits_cdbm_min / 100;
|
||||||
info.Limits.SA.maxdBm = (double) packet.info.limits_cdbm_max / 100;
|
info.Limits.SA.maxdBm = (double) packet.info.limits_cdbm_max / 100;
|
||||||
|
|
||||||
|
limits_maxAmplitudePoints = packet.info.limits_maxAmplitudePoints;
|
||||||
emit InfoUpdated();
|
emit InfoUpdated();
|
||||||
break;
|
break;
|
||||||
case Protocol::PacketType::DeviceStatusV1:
|
case Protocol::PacketType::DeviceStatusV1:
|
||||||
@ -449,9 +528,16 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
|
|||||||
emit SAmeasurementReceived(m);
|
emit SAmeasurementReceived(m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LibreVNADriver::getMaxAmplitudePoints() const
|
||||||
|
{
|
||||||
|
return limits_maxAmplitudePoints;
|
||||||
|
}
|
||||||
|
|
||||||
bool LibreVNADriver::sendWithoutPayload(Protocol::PacketType type, std::function<void(TransmissionResult)> cb)
|
bool LibreVNADriver::sendWithoutPayload(Protocol::PacketType type, std::function<void(TransmissionResult)> cb)
|
||||||
{
|
{
|
||||||
Protocol::PacketInfo p;
|
Protocol::PacketInfo p;
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef LIBREVNADRIVER_H
|
#ifndef LIBREVNADRIVER_H
|
||||||
#define LIBREVNADRIVER_H
|
#define LIBREVNADRIVER_H
|
||||||
|
|
||||||
#include "devicedriver.h"
|
#include "../devicedriver.h"
|
||||||
|
|
||||||
#include "../../VNA_embedded/Application/Communication/Protocol.hpp"
|
#include "../../VNA_embedded/Application/Communication/Protocol.hpp"
|
||||||
|
|
||||||
@ -55,32 +55,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual QString getStatus() override;
|
virtual QString getStatus() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the driver specific settings
|
|
||||||
*
|
|
||||||
* The settings are returned as a map.
|
|
||||||
* Key: user-readable setting name
|
|
||||||
* Value: SettingDescription, consisting of:
|
|
||||||
* - var: Pointer to the setting variable (should be a private member of the derived class)
|
|
||||||
* - name: Arbitrary string used to persistently store this setting (never visible to the user)
|
|
||||||
* - def: Default value of the setting
|
|
||||||
*
|
|
||||||
* These settings will be persistent across reboots. For each device driver, a section within the preferences
|
|
||||||
* will be created where these settings can be changed.
|
|
||||||
*
|
|
||||||
* @return Map of driver specific settings
|
|
||||||
*/
|
|
||||||
virtual std::vector<Savable::SettingDescription> driverSpecificSettings() override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return driver specific actions.
|
|
||||||
*
|
|
||||||
* The returned actions will be appended to the device menu.
|
|
||||||
*
|
|
||||||
* @return List of actions
|
|
||||||
*/
|
|
||||||
virtual std::vector<QAction*> driverSpecificActions() override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Names of available measurements.
|
* @brief Names of available measurements.
|
||||||
*
|
*
|
||||||
@ -173,20 +147,22 @@ signals:
|
|||||||
void passOnReceivedPacket(const Protocol::PacketInfo& packet);
|
void passOnReceivedPacket(const Protocol::PacketInfo& packet);
|
||||||
public:
|
public:
|
||||||
virtual bool SendPacket(const Protocol::PacketInfo& packet, std::function<void(TransmissionResult)> cb = nullptr, unsigned int timeout = 500) = 0;
|
virtual bool SendPacket(const Protocol::PacketInfo& packet, std::function<void(TransmissionResult)> cb = nullptr, unsigned int timeout = 500) = 0;
|
||||||
|
bool sendWithoutPayload(Protocol::PacketType type, std::function<void(TransmissionResult)> cb = nullptr);
|
||||||
|
|
||||||
|
int getMaxAmplitudePoints() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
signals:
|
signals:
|
||||||
void receivedAnswer(TransmissionResult result);
|
void receivedAnswer(const LibreVNADriver::TransmissionResult &result);
|
||||||
void receivedPacket(const Protocol::PacketInfo& packet);
|
void receivedPacket(const Protocol::PacketInfo& packet);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void handleReceivedPacket(const Protocol::PacketInfo& packet);
|
void handleReceivedPacket(const Protocol::PacketInfo& packet);
|
||||||
protected:
|
protected:
|
||||||
bool sendWithoutPayload(Protocol::PacketType type, std::function<void(TransmissionResult)> cb = nullptr);
|
|
||||||
|
|
||||||
bool connected;
|
bool connected;
|
||||||
QString serial;
|
QString serial;
|
||||||
Info info;
|
Info info;
|
||||||
|
int limits_maxAmplitudePoints;
|
||||||
|
|
||||||
Protocol::DeviceStatusV1 lastStatus;
|
Protocol::DeviceStatusV1 lastStatus;
|
||||||
|
|
||||||
@ -198,6 +174,7 @@ protected:
|
|||||||
|
|
||||||
// Driver specific settings
|
// Driver specific settings
|
||||||
bool captureRawReceiverValues;
|
bool captureRawReceiverValues;
|
||||||
|
bool harmonicMixing;
|
||||||
bool SASignalID;
|
bool SASignalID;
|
||||||
bool SAUseDFT;
|
bool SAUseDFT;
|
||||||
double SARBWLimitForDFT;
|
double SARBWLimitForDFT;
|
@ -1,7 +1,7 @@
|
|||||||
#include "librevnausbdriver.h"
|
#include "librevnausbdriver.h"
|
||||||
|
|
||||||
#include "CustomWidgets/informationbox.h"
|
#include "CustomWidgets/informationbox.h"
|
||||||
#include "deviceusblog.h"
|
#include "../deviceusblog.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@ -211,9 +211,9 @@ bool LibreVNAUSBDriver::connectTo(QString serial)
|
|||||||
connect(dataBuffer, &USBInBuffer::DataReceived, this, &LibreVNAUSBDriver::ReceivedData, Qt::DirectConnection);
|
connect(dataBuffer, &USBInBuffer::DataReceived, this, &LibreVNAUSBDriver::ReceivedData, Qt::DirectConnection);
|
||||||
connect(dataBuffer, &USBInBuffer::TransferError, this, &LibreVNAUSBDriver::ConnectionLost);
|
connect(dataBuffer, &USBInBuffer::TransferError, this, &LibreVNAUSBDriver::ConnectionLost);
|
||||||
connect(logBuffer, &USBInBuffer::DataReceived, this, &LibreVNAUSBDriver::ReceivedLog, Qt::DirectConnection);
|
connect(logBuffer, &USBInBuffer::DataReceived, this, &LibreVNAUSBDriver::ReceivedLog, Qt::DirectConnection);
|
||||||
connect(&transmissionTimer, &QTimer::timeout, this, &LibreVNAUSBDriver::transmissionTimeout);
|
connect(&transmissionTimer, &QTimer::timeout, this, &LibreVNAUSBDriver::transmissionTimeout, Qt::UniqueConnection);
|
||||||
connect(this, &LibreVNAUSBDriver::receivedAnswer, this, &LibreVNAUSBDriver::transmissionFinished, Qt::QueuedConnection);
|
connect(this, &LibreVNAUSBDriver::receivedAnswer, this, &LibreVNAUSBDriver::transmissionFinished, static_cast<Qt::ConnectionType>(Qt::QueuedConnection | Qt::UniqueConnection));
|
||||||
connect(this, &LibreVNAUSBDriver::receivedPacket, this, &LibreVNAUSBDriver::handleReceivedPacket, Qt::QueuedConnection);
|
connect(this, &LibreVNAUSBDriver::receivedPacket, this, &LibreVNAUSBDriver::handleReceivedPacket, static_cast<Qt::ConnectionType>(Qt::QueuedConnection | Qt::UniqueConnection));
|
||||||
transmissionTimer.setSingleShot(true);
|
transmissionTimer.setSingleShot(true);
|
||||||
transmissionActive = false;
|
transmissionActive = false;
|
||||||
|
|
||||||
@ -251,8 +251,8 @@ void LibreVNAUSBDriver::disconnect()
|
|||||||
|
|
||||||
void LibreVNAUSBDriver::registerTypes()
|
void LibreVNAUSBDriver::registerTypes()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<Protocol::PacketInfo>("LibreVNAUSBPacket");
|
qDebug() << "Registering meta type: " << qRegisterMetaType<Protocol::PacketInfo>();
|
||||||
qRegisterMetaType<TransmissionResult>("LibreVNAUSBResult");
|
qDebug() << "Registering meta type: " << qRegisterMetaType<TransmissionResult>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibreVNAUSBDriver::ReceivedData()
|
void LibreVNAUSBDriver::ReceivedData()
|
@ -11,12 +11,15 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ManualControlDialog::ManualControlDialog(Device &dev, QWidget *parent) :
|
ManualControlDialog::ManualControlDialog(LibreVNADriver &dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::ManualControlDialog),
|
ui(new Ui::ManualControlDialog),
|
||||||
dev(dev)
|
dev(dev)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
emit dev.acquireControl();
|
||||||
|
|
||||||
ui->SourceLowFrequency->setUnit("Hz");
|
ui->SourceLowFrequency->setUnit("Hz");
|
||||||
ui->SourceLowFrequency->setPrefixes(" kM");
|
ui->SourceLowFrequency->setPrefixes(" kM");
|
||||||
@ -148,7 +151,11 @@ ManualControlDialog::ManualControlDialog(Device &dev, QWidget *parent) :
|
|||||||
MakeReadOnly(ui->refmag);
|
MakeReadOnly(ui->refmag);
|
||||||
MakeReadOnly(ui->refphase);
|
MakeReadOnly(ui->refphase);
|
||||||
|
|
||||||
connect(&dev, &Device::ManualStatusReceived, this, &ManualControlDialog::NewStatus, Qt::QueuedConnection);
|
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p){
|
||||||
|
if(p.type == Protocol::PacketType::ManualStatusV1) {
|
||||||
|
NewStatus(p.manualStatusV1);
|
||||||
|
}
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(ui->SourceCE, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
connect(ui->SourceCE, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
connect(ui->SourceRFEN, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
connect(ui->SourceRFEN, &QCheckBox::toggled, [=](bool) { UpdateDevice(); });
|
||||||
@ -184,6 +191,7 @@ ManualControlDialog::ManualControlDialog(Device &dev, QWidget *parent) :
|
|||||||
|
|
||||||
ManualControlDialog::~ManualControlDialog()
|
ManualControlDialog::~ManualControlDialog()
|
||||||
{
|
{
|
||||||
|
emit dev.releaseControl();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,7 +624,9 @@ void ManualControlDialog::NewStatus(Protocol::ManualStatusV1 status)
|
|||||||
|
|
||||||
void ManualControlDialog::UpdateDevice()
|
void ManualControlDialog::UpdateDevice()
|
||||||
{
|
{
|
||||||
Protocol::ManualControlV1 m;
|
Protocol::PacketInfo p;
|
||||||
|
p.type = Protocol::PacketType::ManualControlV1;
|
||||||
|
Protocol::ManualControlV1 &m = p.manual;
|
||||||
// Source highband
|
// Source highband
|
||||||
m.SourceHighCE = ui->SourceCE->isChecked();
|
m.SourceHighCE = ui->SourceCE->isChecked();
|
||||||
m.SourceHighRFEN = ui->SourceRFEN->isChecked();
|
m.SourceHighRFEN = ui->SourceRFEN->isChecked();
|
||||||
@ -648,5 +658,5 @@ void ManualControlDialog::UpdateDevice()
|
|||||||
|
|
||||||
qDebug() << "Updating manual control state";
|
qDebug() << "Updating manual control state";
|
||||||
|
|
||||||
dev.SetManual(m);
|
dev.SendPacket(p);
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef MANUALCONTROLDIALOG_H
|
#ifndef MANUALCONTROLDIALOG_H
|
||||||
#define MANUALCONTROLDIALOG_H
|
#define MANUALCONTROLDIALOG_H
|
||||||
|
|
||||||
#include "device.h"
|
#include "librevnadriver.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <complex>
|
#include <complex>
|
||||||
@ -15,7 +15,7 @@ class ManualControlDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ManualControlDialog(Device &dev, QWidget *parent = nullptr);
|
explicit ManualControlDialog(LibreVNADriver &dev, QWidget *parent = nullptr);
|
||||||
~ManualControlDialog();
|
~ManualControlDialog();
|
||||||
|
|
||||||
void setHighSourceChipEnable(bool enable);
|
void setHighSourceChipEnable(bool enable);
|
||||||
@ -108,7 +108,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
void UpdateDevice();
|
void UpdateDevice();
|
||||||
Ui::ManualControlDialog *ui;
|
Ui::ManualControlDialog *ui;
|
||||||
Device &dev;
|
LibreVNADriver &dev;
|
||||||
std::complex<double> port1referenced;
|
std::complex<double> port1referenced;
|
||||||
std::complex<double> port2referenced;
|
std::complex<double> port2referenced;
|
||||||
};
|
};
|
@ -1,7 +1,7 @@
|
|||||||
#include "receivercaldialog.h"
|
#include "receivercaldialog.h"
|
||||||
|
|
||||||
ReceiverCalDialog::ReceiverCalDialog(Device *dev, ModeHandler *handler)
|
ReceiverCalDialog::ReceiverCalDialog(LibreVNADriver *dev)
|
||||||
: AmplitudeCalDialog(dev, handler)
|
: AmplitudeCalDialog(dev)
|
||||||
{
|
{
|
||||||
setWindowTitle("Receiver Calibration Dialog");
|
setWindowTitle("Receiver Calibration Dialog");
|
||||||
LoadFromDevice();
|
LoadFromDevice();
|
||||||
@ -17,7 +17,7 @@ void ReceiverCalDialog::SelectedPoint(double frequency, bool)
|
|||||||
// setup 3 points centered around the measurement frequency (zero span not supported yet)
|
// setup 3 points centered around the measurement frequency (zero span not supported yet)
|
||||||
p.spectrumSettings.f_stop = frequency + 1.0;
|
p.spectrumSettings.f_stop = frequency + 1.0;
|
||||||
p.spectrumSettings.f_start = frequency - 1.0;
|
p.spectrumSettings.f_start = frequency - 1.0;
|
||||||
p.spectrumSettings.pointNum = 3;
|
p.spectrumSettings.pointNum = automaticSweepPoints;
|
||||||
p.spectrumSettings.Detector = 0;
|
p.spectrumSettings.Detector = 0;
|
||||||
p.spectrumSettings.SignalID = 1;
|
p.spectrumSettings.SignalID = 1;
|
||||||
p.spectrumSettings.WindowType = 3;
|
p.spectrumSettings.WindowType = 3;
|
||||||
@ -25,7 +25,7 @@ void ReceiverCalDialog::SelectedPoint(double frequency, bool)
|
|||||||
dev->SendPacket(p);
|
dev->SendPacket(p);
|
||||||
} else {
|
} else {
|
||||||
// invalid frequency, disable
|
// invalid frequency, disable
|
||||||
dev->SetIdle();
|
dev->setIdle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,13 +2,12 @@
|
|||||||
#define RECEIVERCALDIALOG_H
|
#define RECEIVERCALDIALOG_H
|
||||||
|
|
||||||
#include "amplitudecaldialog.h"
|
#include "amplitudecaldialog.h"
|
||||||
#include "modehandler.h"
|
|
||||||
|
|
||||||
class ReceiverCalDialog : public AmplitudeCalDialog
|
class ReceiverCalDialog : public AmplitudeCalDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ReceiverCalDialog(Device *dev, ModeHandler *handler);
|
ReceiverCalDialog(LibreVNADriver *dev);
|
||||||
protected:
|
protected:
|
||||||
Protocol::PacketType requestCommand() override { return Protocol::PacketType::RequestReceiverCal; }
|
Protocol::PacketType requestCommand() override { return Protocol::PacketType::RequestReceiverCal; }
|
||||||
Protocol::PacketType pointType() override { return Protocol::PacketType::ReceiverCalPoint; }
|
Protocol::PacketType pointType() override { return Protocol::PacketType::ReceiverCalPoint; }
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
SourceCalDialog::SourceCalDialog(Device *dev, ModeHandler *handler)
|
SourceCalDialog::SourceCalDialog(LibreVNADriver *dev)
|
||||||
: AmplitudeCalDialog(dev, handler)
|
: AmplitudeCalDialog(dev)
|
||||||
{
|
{
|
||||||
setWindowTitle("Source Calibration Dialog");
|
setWindowTitle("Source Calibration Dialog");
|
||||||
LoadFromDevice();
|
LoadFromDevice();
|
@ -2,7 +2,6 @@
|
|||||||
#define SOURCECALDIALOG_H
|
#define SOURCECALDIALOG_H
|
||||||
|
|
||||||
#include "amplitudecaldialog.h"
|
#include "amplitudecaldialog.h"
|
||||||
#include "modehandler.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ class SourceCalDialog : public AmplitudeCalDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SourceCalDialog(Device *dev, ModeHandler *handler);
|
SourceCalDialog(LibreVNADriver *dev);
|
||||||
protected:
|
protected:
|
||||||
Protocol::PacketType requestCommand() override { return Protocol::PacketType::RequestSourceCal; }
|
Protocol::PacketType requestCommand() override { return Protocol::PacketType::RequestSourceCal; }
|
||||||
Protocol::PacketType pointType() override { return Protocol::PacketType::SourceCalPoint; }
|
Protocol::PacketType pointType() override { return Protocol::PacketType::SourceCalPoint; }
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "../../VNA_embedded/Application/Communication/Protocol.hpp"
|
#include "../../VNA_embedded/Application/Communication/Protocol.hpp"
|
||||||
|
|
||||||
#include "librevnausbdriver.h"
|
#include "LibreVNA/librevnausbdriver.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <libusb-1.0/libusb.h>
|
#include <libusb-1.0/libusb.h>
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
DeviceDriver *DeviceDriver::activeDriver = nullptr;
|
DeviceDriver *DeviceDriver::activeDriver = nullptr;
|
||||||
|
|
||||||
|
DeviceDriver::~DeviceDriver()
|
||||||
|
{
|
||||||
|
for(auto a : specificActions) {
|
||||||
|
delete a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DeviceDriver::connectDevice(QString serial)
|
bool DeviceDriver::connectDevice(QString serial)
|
||||||
{
|
{
|
||||||
if(activeDriver && activeDriver != this) {
|
if(activeDriver && activeDriver != this) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* - Derive from this class
|
* - Derive from this class
|
||||||
* - Implement all pure virtual functions
|
* - Implement all pure virtual functions
|
||||||
* - Implement the virtual functions if the device supports the specific function
|
* - Implement the virtual functions if the device supports the specific function
|
||||||
* - TODO register the driver during application start
|
* - register the driver during application start
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Tools/parameters.h"
|
#include "Tools/parameters.h"
|
||||||
@ -25,7 +25,7 @@ class DeviceDriver : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DeviceDriver() {}
|
DeviceDriver() {}
|
||||||
virtual ~DeviceDriver() {}
|
virtual ~DeviceDriver();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the driver name. It must be unique across all implemented drivers and is used to identify the driver
|
* @brief Returns the driver name. It must be unique across all implemented drivers and is used to identify the driver
|
||||||
@ -201,7 +201,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return Map of driver specific settings
|
* @return Map of driver specific settings
|
||||||
*/
|
*/
|
||||||
virtual std::vector<Savable::SettingDescription> driverSpecificSettings() {return std::vector<Savable::SettingDescription>();}
|
std::vector<Savable::SettingDescription> driverSpecificSettings() {return specificSettings;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return driver specific actions.
|
* @brief Return driver specific actions.
|
||||||
@ -210,7 +210,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return List of actions
|
* @return List of actions
|
||||||
*/
|
*/
|
||||||
virtual std::vector<QAction*> driverSpecificActions() {return std::vector<QAction*>();}
|
std::vector<QAction*> driverSpecificActions() {return specificActions;}
|
||||||
|
|
||||||
class VNASettings {
|
class VNASettings {
|
||||||
public:
|
public:
|
||||||
@ -456,12 +456,27 @@ signals:
|
|||||||
*/
|
*/
|
||||||
void LogLineReceived(QString line);
|
void LogLineReceived(QString line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Emit this signal whenever the device driver wants complete control over the device. Once emitted, no other part of the application
|
||||||
|
* will try to communicate until releaseControl() is emitted
|
||||||
|
*/
|
||||||
|
void acquireControl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Emit this signal whenever the device driver wants to return control to the application.
|
||||||
|
*/
|
||||||
|
void releaseControl();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool connectDevice(QString serial);
|
bool connectDevice(QString serial);
|
||||||
void disconnectDevice();
|
void disconnectDevice();
|
||||||
static DeviceDriver* getActiveDriver() {return activeDriver;}
|
static DeviceDriver* getActiveDriver() {return activeDriver;}
|
||||||
static unsigned int SApoints();
|
static unsigned int SApoints();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<QAction*> specificActions;
|
||||||
|
std::vector<Savable::SettingDescription> specificSettings;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static DeviceDriver *activeDriver;
|
static DeviceDriver *activeDriver;
|
||||||
};
|
};
|
||||||
|
@ -4,16 +4,12 @@ HEADERS += \
|
|||||||
Calibration/LibreCAL/caldevice.h \
|
Calibration/LibreCAL/caldevice.h \
|
||||||
Calibration/LibreCAL/librecaldialog.h \
|
Calibration/LibreCAL/librecaldialog.h \
|
||||||
Calibration/LibreCAL/usbdevice.h \
|
Calibration/LibreCAL/usbdevice.h \
|
||||||
Calibration/amplitudecaldialog.h \
|
|
||||||
Calibration/calibration.h \
|
Calibration/calibration.h \
|
||||||
Calibration/calibrationmeasurement.h \
|
Calibration/calibrationmeasurement.h \
|
||||||
Calibration/calkit.h \
|
Calibration/calkit.h \
|
||||||
Calibration/calkitdialog.h \
|
Calibration/calkitdialog.h \
|
||||||
Calibration/calstandard.h \
|
Calibration/calstandard.h \
|
||||||
Calibration/frequencycaldialog.h \
|
|
||||||
Calibration/manualcalibrationdialog.h \
|
Calibration/manualcalibrationdialog.h \
|
||||||
Calibration/receivercaldialog.h \
|
|
||||||
Calibration/sourcecaldialog.h \
|
|
||||||
CustomWidgets/colorpickerbutton.h \
|
CustomWidgets/colorpickerbutton.h \
|
||||||
CustomWidgets/csvimport.h \
|
CustomWidgets/csvimport.h \
|
||||||
CustomWidgets/informationbox.h \
|
CustomWidgets/informationbox.h \
|
||||||
@ -23,6 +19,14 @@ HEADERS += \
|
|||||||
CustomWidgets/toggleswitch.h \
|
CustomWidgets/toggleswitch.h \
|
||||||
CustomWidgets/touchstoneimport.h \
|
CustomWidgets/touchstoneimport.h \
|
||||||
CustomWidgets/tracesetselector.h \
|
CustomWidgets/tracesetselector.h \
|
||||||
|
Device/LibreVNA/amplitudecaldialog.h \
|
||||||
|
Device/LibreVNA/firmwareupdatedialog.h \
|
||||||
|
Device/LibreVNA/frequencycaldialog.h \
|
||||||
|
Device/LibreVNA/librevnadriver.h \
|
||||||
|
Device/LibreVNA/librevnausbdriver.h \
|
||||||
|
Device/LibreVNA/manualcontroldialog.h \
|
||||||
|
Device/LibreVNA/receivercaldialog.h \
|
||||||
|
Device/LibreVNA/sourcecaldialog.h \
|
||||||
Device/compounddevice.h \
|
Device/compounddevice.h \
|
||||||
Device/compounddeviceeditdialog.h \
|
Device/compounddeviceeditdialog.h \
|
||||||
Device/device.h \
|
Device/device.h \
|
||||||
@ -30,10 +34,6 @@ HEADERS += \
|
|||||||
Device/devicelog.h \
|
Device/devicelog.h \
|
||||||
Device/deviceusblog.h \
|
Device/deviceusblog.h \
|
||||||
Device/deviceusblogview.h \
|
Device/deviceusblogview.h \
|
||||||
Device/firmwareupdatedialog.h \
|
|
||||||
Device/librevnadriver.h \
|
|
||||||
Device/librevnausbdriver.h \
|
|
||||||
Device/manualcontroldialog.h \
|
|
||||||
Device/virtualdevice.h \
|
Device/virtualdevice.h \
|
||||||
Generator/generator.h \
|
Generator/generator.h \
|
||||||
Generator/signalgenwidget.h \
|
Generator/signalgenwidget.h \
|
||||||
@ -155,16 +155,12 @@ SOURCES += \
|
|||||||
Calibration/LibreCAL/caldevice.cpp \
|
Calibration/LibreCAL/caldevice.cpp \
|
||||||
Calibration/LibreCAL/librecaldialog.cpp \
|
Calibration/LibreCAL/librecaldialog.cpp \
|
||||||
Calibration/LibreCAL/usbdevice.cpp \
|
Calibration/LibreCAL/usbdevice.cpp \
|
||||||
Calibration/amplitudecaldialog.cpp \
|
|
||||||
Calibration/calibration.cpp \
|
Calibration/calibration.cpp \
|
||||||
Calibration/calibrationmeasurement.cpp \
|
Calibration/calibrationmeasurement.cpp \
|
||||||
Calibration/calkit.cpp \
|
Calibration/calkit.cpp \
|
||||||
Calibration/calkitdialog.cpp \
|
Calibration/calkitdialog.cpp \
|
||||||
Calibration/calstandard.cpp \
|
Calibration/calstandard.cpp \
|
||||||
Calibration/frequencycaldialog.cpp \
|
|
||||||
Calibration/manualcalibrationdialog.cpp \
|
Calibration/manualcalibrationdialog.cpp \
|
||||||
Calibration/receivercaldialog.cpp \
|
|
||||||
Calibration/sourcecaldialog.cpp \
|
|
||||||
CustomWidgets/colorpickerbutton.cpp \
|
CustomWidgets/colorpickerbutton.cpp \
|
||||||
CustomWidgets/csvimport.cpp \
|
CustomWidgets/csvimport.cpp \
|
||||||
CustomWidgets/informationbox.cpp \
|
CustomWidgets/informationbox.cpp \
|
||||||
@ -174,6 +170,14 @@ SOURCES += \
|
|||||||
CustomWidgets/toggleswitch.cpp \
|
CustomWidgets/toggleswitch.cpp \
|
||||||
CustomWidgets/touchstoneimport.cpp \
|
CustomWidgets/touchstoneimport.cpp \
|
||||||
CustomWidgets/tracesetselector.cpp \
|
CustomWidgets/tracesetselector.cpp \
|
||||||
|
Device/LibreVNA/amplitudecaldialog.cpp \
|
||||||
|
Device/LibreVNA/firmwareupdatedialog.cpp \
|
||||||
|
Device/LibreVNA/frequencycaldialog.cpp \
|
||||||
|
Device/LibreVNA/librevnadriver.cpp \
|
||||||
|
Device/LibreVNA/librevnausbdriver.cpp \
|
||||||
|
Device/LibreVNA/manualcontroldialog.cpp \
|
||||||
|
Device/LibreVNA/receivercaldialog.cpp \
|
||||||
|
Device/LibreVNA/sourcecaldialog.cpp \
|
||||||
Device/compounddevice.cpp \
|
Device/compounddevice.cpp \
|
||||||
Device/compounddeviceeditdialog.cpp \
|
Device/compounddeviceeditdialog.cpp \
|
||||||
Device/device.cpp \
|
Device/device.cpp \
|
||||||
@ -181,10 +185,6 @@ SOURCES += \
|
|||||||
Device/devicelog.cpp \
|
Device/devicelog.cpp \
|
||||||
Device/deviceusblog.cpp \
|
Device/deviceusblog.cpp \
|
||||||
Device/deviceusblogview.cpp \
|
Device/deviceusblogview.cpp \
|
||||||
Device/firmwareupdatedialog.cpp \
|
|
||||||
Device/librevnadriver.cpp \
|
|
||||||
Device/librevnausbdriver.cpp \
|
|
||||||
Device/manualcontroldialog.cpp \
|
|
||||||
Device/virtualdevice.cpp \
|
Device/virtualdevice.cpp \
|
||||||
Generator/generator.cpp \
|
Generator/generator.cpp \
|
||||||
Generator/signalgenwidget.cpp \
|
Generator/signalgenwidget.cpp \
|
||||||
@ -304,22 +304,22 @@ FORMS += \
|
|||||||
Calibration/CalStandardShortEditDialog.ui \
|
Calibration/CalStandardShortEditDialog.ui \
|
||||||
Calibration/CalStandardThroughEditDialog.ui \
|
Calibration/CalStandardThroughEditDialog.ui \
|
||||||
Calibration/LibreCAL/librecaldialog.ui \
|
Calibration/LibreCAL/librecaldialog.ui \
|
||||||
Calibration/addamplitudepointsdialog.ui \
|
|
||||||
Calibration/amplitudecaldialog.ui \
|
|
||||||
Calibration/automaticamplitudedialog.ui \
|
|
||||||
Calibration/calibrationdialogui.ui \
|
Calibration/calibrationdialogui.ui \
|
||||||
Calibration/calkitdialog.ui \
|
Calibration/calkitdialog.ui \
|
||||||
Calibration/frequencycaldialog.ui \
|
|
||||||
Calibration/manualcalibrationdialog.ui \
|
Calibration/manualcalibrationdialog.ui \
|
||||||
CustomWidgets/csvimport.ui \
|
CustomWidgets/csvimport.ui \
|
||||||
CustomWidgets/jsonpickerdialog.ui \
|
CustomWidgets/jsonpickerdialog.ui \
|
||||||
CustomWidgets/tilewidget.ui \
|
CustomWidgets/tilewidget.ui \
|
||||||
CustomWidgets/touchstoneimport.ui \
|
CustomWidgets/touchstoneimport.ui \
|
||||||
|
Device/LibreVNA/addamplitudepointsdialog.ui \
|
||||||
|
Device/LibreVNA/amplitudecaldialog.ui \
|
||||||
|
Device/LibreVNA/automaticamplitudedialog.ui \
|
||||||
|
Device/LibreVNA/firmwareupdatedialog.ui \
|
||||||
|
Device/LibreVNA/frequencycaldialog.ui \
|
||||||
|
Device/LibreVNA/manualcontroldialog.ui \
|
||||||
Device/compounddeviceeditdialog.ui \
|
Device/compounddeviceeditdialog.ui \
|
||||||
Device/devicelog.ui \
|
Device/devicelog.ui \
|
||||||
Device/deviceusblogview.ui \
|
Device/deviceusblogview.ui \
|
||||||
Device/firmwareupdatedialog.ui \
|
|
||||||
Device/manualcontroldialog.ui \
|
|
||||||
Generator/signalgenwidget.ui \
|
Generator/signalgenwidget.ui \
|
||||||
Tools/impedancematchdialog.ui \
|
Tools/impedancematchdialog.ui \
|
||||||
Tools/mixedmodeconversion.ui \
|
Tools/mixedmodeconversion.ui \
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "CustomWidgets/toggleswitch.h"
|
#include "CustomWidgets/toggleswitch.h"
|
||||||
#include "Device/manualcontroldialog.h"
|
|
||||||
#include "Traces/tracemodel.h"
|
#include "Traces/tracemodel.h"
|
||||||
#include "tracewidgetsa.h"
|
#include "tracewidgetsa.h"
|
||||||
#include "Traces/tracesmithchart.h"
|
#include "Traces/tracesmithchart.h"
|
||||||
@ -823,33 +822,6 @@ void SpectrumAnalyzer::ConfigureDevice()
|
|||||||
if(running) {
|
if(running) {
|
||||||
changingSettings = true;
|
changingSettings = true;
|
||||||
|
|
||||||
// TODO move into libreVNA driver
|
|
||||||
// if(settings.trackingGenerator && settings.freqStop >= 25000000) {
|
|
||||||
// // Check point spacing.
|
|
||||||
// // The highband PLL used as the tracking generator is not able to reach every frequency exactly. This
|
|
||||||
// // could lead to sharp drops in the spectrum at certain frequencies. If the span is wide enough with
|
|
||||||
// // respect to the point number, it is ensured that every displayed point has at least one sample with
|
|
||||||
// // a reachable PLL frequency in it. Display a warning message if this is not the case with the current
|
|
||||||
// // settings.
|
|
||||||
// auto pointSpacing = (settings.freqStop - settings.freqStart) / (settings.points - 1);
|
|
||||||
// // The frequency resolution of the PLL is frequency dependent (due to PLL divider).
|
|
||||||
// // This code assumes some knowledge of the actual hardware and probably should be moved
|
|
||||||
// // onto the device at some point
|
|
||||||
// double minSpacing = 25000;
|
|
||||||
// auto stop = settings.freqStop;
|
|
||||||
// while(stop <= 3000000000) {
|
|
||||||
// minSpacing /= 2;
|
|
||||||
// stop *= 2;
|
|
||||||
// }
|
|
||||||
// if(pointSpacing < minSpacing) {
|
|
||||||
// auto requiredMinSpan = minSpacing * (settings.points - 1);
|
|
||||||
// auto message = QString() + "Due to PLL limitations, the tracking generator can not reach every frequency exactly. "
|
|
||||||
// "With your current span, this could result in the signal not being detected at some bands. A minimum"
|
|
||||||
// " span of " + Unit::ToString(requiredMinSpan, "Hz", " kMG") + " is recommended at this stop frequency.";
|
|
||||||
// InformationBox::ShowMessage("Warning", message, "TrackingGeneratorSpanTooSmallWarning");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(window->getDevice() && isActive) {
|
if(window->getDevice() && isActive) {
|
||||||
window->getDevice()->setSA(settings, [=](bool){
|
window->getDevice()->setSA(settings, [=](bool){
|
||||||
// device received command
|
// device received command
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "CustomWidgets/toggleswitch.h"
|
#include "CustomWidgets/toggleswitch.h"
|
||||||
#include "Device/manualcontroldialog.h"
|
|
||||||
#include "Traces/tracemodel.h"
|
#include "Traces/tracemodel.h"
|
||||||
#include "tracewidgetvna.h"
|
#include "tracewidgetvna.h"
|
||||||
#include "Traces/tracesmithchart.h"
|
#include "Traces/tracesmithchart.h"
|
||||||
@ -14,7 +13,6 @@
|
|||||||
#include "Tools/impedancematchdialog.h"
|
#include "Tools/impedancematchdialog.h"
|
||||||
#include "Tools/mixedmodeconversion.h"
|
#include "Tools/mixedmodeconversion.h"
|
||||||
#include "ui_main.h"
|
#include "ui_main.h"
|
||||||
#include "Device/firmwareupdatedialog.h"
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "Generator/signalgenwidget.h"
|
#include "Generator/signalgenwidget.h"
|
||||||
#include "CustomWidgets/informationbox.h"
|
#include "CustomWidgets/informationbox.h"
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "CustomWidgets/toggleswitch.h"
|
#include "CustomWidgets/toggleswitch.h"
|
||||||
#include "Device/manualcontroldialog.h"
|
|
||||||
#include "Device/deviceusblogview.h"
|
#include "Device/deviceusblogview.h"
|
||||||
#include "Traces/tracemodel.h"
|
#include "Traces/tracemodel.h"
|
||||||
#include "Traces/tracewidget.h"
|
#include "Traces/tracewidget.h"
|
||||||
@ -14,15 +13,11 @@
|
|||||||
#include "Traces/Marker/markerwidget.h"
|
#include "Traces/Marker/markerwidget.h"
|
||||||
#include "Tools/impedancematchdialog.h"
|
#include "Tools/impedancematchdialog.h"
|
||||||
#include "ui_main.h"
|
#include "ui_main.h"
|
||||||
#include "Device/firmwareupdatedialog.h"
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "Generator/signalgenwidget.h"
|
#include "Generator/signalgenwidget.h"
|
||||||
#include "VNA/vna.h"
|
#include "VNA/vna.h"
|
||||||
#include "Generator/generator.h"
|
#include "Generator/generator.h"
|
||||||
#include "SpectrumAnalyzer/spectrumanalyzer.h"
|
#include "SpectrumAnalyzer/spectrumanalyzer.h"
|
||||||
#include "Calibration/sourcecaldialog.h"
|
|
||||||
#include "Calibration/receivercaldialog.h"
|
|
||||||
#include "Calibration/frequencycaldialog.h"
|
|
||||||
#include "CustomWidgets/jsonpickerdialog.h"
|
#include "CustomWidgets/jsonpickerdialog.h"
|
||||||
#include "CustomWidgets/informationbox.h"
|
#include "CustomWidgets/informationbox.h"
|
||||||
#include "Util/app_common.h"
|
#include "Util/app_common.h"
|
||||||
@ -30,7 +25,7 @@
|
|||||||
#include "mode.h"
|
#include "mode.h"
|
||||||
#include "modehandler.h"
|
#include "modehandler.h"
|
||||||
#include "modewindow.h"
|
#include "modewindow.h"
|
||||||
#include "Device/librevnausbdriver.h"
|
#include "Device/LibreVNA/librevnausbdriver.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
@ -75,7 +70,6 @@ static bool noGUIset = false;
|
|||||||
AppWindow::AppWindow(QWidget *parent)
|
AppWindow::AppWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, deviceActionGroup(new QActionGroup(this))
|
, deviceActionGroup(new QActionGroup(this))
|
||||||
, manual(nullptr)
|
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, server(nullptr)
|
, server(nullptr)
|
||||||
, appVersion(APP_VERSION)
|
, appVersion(APP_VERSION)
|
||||||
@ -326,15 +320,15 @@ void AppWindow::closeEvent(QCloseEvent *event)
|
|||||||
device->disconnectDevice();
|
device->disconnectDevice();
|
||||||
device = nullptr;
|
device = nullptr;
|
||||||
}
|
}
|
||||||
for(auto driver : deviceDrivers) {
|
|
||||||
delete driver;
|
|
||||||
}
|
|
||||||
delete modeHandler;
|
delete modeHandler;
|
||||||
modeHandler = nullptr;
|
modeHandler = nullptr;
|
||||||
pref.store();
|
pref.store();
|
||||||
for(auto driver : deviceDrivers) {
|
for(auto driver : deviceDrivers) {
|
||||||
Preferences::getInstance().store(driver->driverSpecificSettings());
|
Preferences::getInstance().store(driver->driverSpecificSettings());
|
||||||
}
|
}
|
||||||
|
for(auto driver : deviceDrivers) {
|
||||||
|
delete driver;
|
||||||
|
}
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,8 +369,31 @@ bool AppWindow::ConnectToDevice(QString serial, DeviceDriver *driver)
|
|||||||
connect(device, &DeviceDriver::LogLineReceived, &deviceLog, &DeviceLog::addLine);
|
connect(device, &DeviceDriver::LogLineReceived, &deviceLog, &DeviceLog::addLine);
|
||||||
connect(device, &DeviceDriver::ConnectionLost, this, &AppWindow::DeviceConnectionLost);
|
connect(device, &DeviceDriver::ConnectionLost, this, &AppWindow::DeviceConnectionLost);
|
||||||
connect(device, &DeviceDriver::StatusUpdated, this, &AppWindow::DeviceStatusUpdated);
|
connect(device, &DeviceDriver::StatusUpdated, this, &AppWindow::DeviceStatusUpdated);
|
||||||
|
connect(device, &DeviceDriver::releaseControl, [=](){
|
||||||
|
if(lastActiveMode) {
|
||||||
|
modeHandler->activate(lastActiveMode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(device, &DeviceDriver::acquireControl, [=](){
|
||||||
|
lastActiveMode = modeHandler->getActiveMode();
|
||||||
|
modeHandler->deactivate(lastActiveMode);
|
||||||
|
});
|
||||||
// connect(vdevice, &VirtualDevice::NeedsFirmwareUpdate, this, &AppWindow::DeviceNeedsUpdate);
|
// connect(vdevice, &VirtualDevice::NeedsFirmwareUpdate, this, &AppWindow::DeviceNeedsUpdate);
|
||||||
ui->actionDisconnect->setEnabled(true);
|
ui->actionDisconnect->setEnabled(true);
|
||||||
|
// find correct position to add device specific actions at
|
||||||
|
QAction *before = nullptr;
|
||||||
|
for(int i=0;i<ui->menuDevice->actions().size();i++) {
|
||||||
|
auto comp = ui->menuDevice->actions()[i];
|
||||||
|
if(comp == ui->actionDisconnect) {
|
||||||
|
if(i + 2 < ui->menuDevice->actions().size()) {
|
||||||
|
before = ui->menuDevice->actions()[i+2];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(auto a : device->driverSpecificActions()) {
|
||||||
|
ui->menuDevice->insertAction(before, a);
|
||||||
|
}
|
||||||
// if(!vdevice->isCompoundDevice()) {
|
// if(!vdevice->isCompoundDevice()) {
|
||||||
// ui->actionManual_Control->setEnabled(true);
|
// ui->actionManual_Control->setEnabled(true);
|
||||||
// ui->actionFirmware_Update->setEnabled(true);
|
// ui->actionFirmware_Update->setEnabled(true);
|
||||||
@ -419,6 +436,9 @@ bool AppWindow::ConnectToDevice(QString serial, DeviceDriver *driver)
|
|||||||
void AppWindow::DisconnectDevice()
|
void AppWindow::DisconnectDevice()
|
||||||
{
|
{
|
||||||
if(device) {
|
if(device) {
|
||||||
|
for(auto a : device->driverSpecificActions()) {
|
||||||
|
ui->menuDevice->removeAction(a);
|
||||||
|
}
|
||||||
device->disconnectDevice();
|
device->disconnectDevice();
|
||||||
device = nullptr;
|
device = nullptr;
|
||||||
}
|
}
|
||||||
@ -701,232 +721,233 @@ void AppWindow::SetupSCPI()
|
|||||||
return QString::number(DeviceDriver::getInfo(getDevice()).Limits.VNA.maxFreq);
|
return QString::number(DeviceDriver::getInfo(getDevice()).Limits.VNA.maxFreq);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
auto scpi_manual = new SCPINode("MANual");
|
// TODO
|
||||||
scpi_manual->add(new SCPICommand("STArt",[=](QStringList) -> QString {
|
// auto scpi_manual = new SCPINode("MANual");
|
||||||
// StartManualControl();
|
// scpi_manual->add(new SCPICommand("STArt",[=](QStringList) -> QString {
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
//// StartManualControl();
|
||||||
}, nullptr));
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
scpi_manual->add(new SCPICommand("STOp",[=](QStringList) -> QString {
|
// }, nullptr));
|
||||||
manual->close();
|
// scpi_manual->add(new SCPICommand("STOp",[=](QStringList) -> QString {
|
||||||
delete manual;
|
// manual->close();
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
// delete manual;
|
||||||
}, nullptr));
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
|
// }, nullptr));
|
||||||
|
//
|
||||||
|
// auto addBooleanManualSetting = [=](QString cmd, void(ManualControlDialog::*set)(bool), bool(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
||||||
|
// bool enable;
|
||||||
|
// if(!manual || !SCPI::paramToBool(params, 0, enable)) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
||||||
|
// set_fn(enable);
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
|
// }, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// return get_fn() ? SCPI::getResultName(SCPI::Result::True) : SCPI::getResultName(SCPI::Result::False);
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
|
||||||
auto addBooleanManualSetting = [=](QString cmd, void(ManualControlDialog::*set)(bool), bool(ManualControlDialog::*get)(void)) {
|
// auto addDoubleManualSetting = [=](QString cmd, void(ManualControlDialog::*set)(double), double(ManualControlDialog::*get)(void)) {
|
||||||
scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
// scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
||||||
bool enable;
|
// double value;
|
||||||
if(!manual || !SCPI::paramToBool(params, 0, enable)) {
|
// if(!manual || !SCPI::paramToDouble(params, 0, value)) {
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
}
|
// }
|
||||||
auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
// auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
||||||
set_fn(enable);
|
// set_fn(value);
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
}, [=](QStringList) -> QString {
|
// }, [=](QStringList) -> QString {
|
||||||
if(!manual) {
|
// if(!manual) {
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
}
|
// }
|
||||||
auto get_fn = std::bind(get, manual);
|
// auto get_fn = std::bind(get, manual);
|
||||||
return get_fn() ? SCPI::getResultName(SCPI::Result::True) : SCPI::getResultName(SCPI::Result::False);
|
// return QString::number(get_fn());
|
||||||
}));
|
// }));
|
||||||
};
|
// };
|
||||||
|
// auto addIntegerManualSetting = [=](QString cmd, void(ManualControlDialog::*set)(int), int(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
||||||
|
// double value;
|
||||||
|
// if(!manual || !SCPI::paramToDouble(params, 0, value)) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
||||||
|
// set_fn(value);
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
|
// }, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// return QString::number(get_fn());
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
// auto addIntegerManualSettingWithReturnValue = [=](QString cmd, bool(ManualControlDialog::*set)(int), int(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
||||||
|
// double value;
|
||||||
|
// if(!manual || !SCPI::paramToDouble(params, 0, value)) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
||||||
|
// if(set_fn(value)) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
|
// } else {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// }, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// return QString::number(get_fn());
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
// auto addIntegerManualQuery = [=](QString cmd, int(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// return QString::number(get_fn());
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
// auto addDoubleManualQuery = [=](QString cmd, double(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// return QString::number(get_fn());
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
// auto addBooleanManualQuery = [=](QString cmd, bool(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// return get_fn() ? SCPI::getResultName(SCPI::Result::True) : SCPI::getResultName(SCPI::Result::False);
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
// auto addComplexManualQuery = [=](QString cmd, std::complex<double>(ManualControlDialog::*get)(void)) {
|
||||||
|
// scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
||||||
|
// if(!manual) {
|
||||||
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
|
// }
|
||||||
|
// auto get_fn = std::bind(get, manual);
|
||||||
|
// auto res = get_fn();
|
||||||
|
// return QString::number(res.real())+","+QString::number(res.imag());
|
||||||
|
// }));
|
||||||
|
// };
|
||||||
|
|
||||||
auto addDoubleManualSetting = [=](QString cmd, void(ManualControlDialog::*set)(double), double(ManualControlDialog::*get)(void)) {
|
// addBooleanManualSetting("HSRC_CE", &ManualControlDialog::setHighSourceChipEnable, &ManualControlDialog::getHighSourceChipEnable);
|
||||||
scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
// addBooleanManualSetting("HSRC_RFEN", &ManualControlDialog::setHighSourceRFEnable, &ManualControlDialog::getHighSourceRFEnable);
|
||||||
double value;
|
// addBooleanManualQuery("HSRC_LOCKed", &ManualControlDialog::getHighSourceLocked);
|
||||||
if(!manual || !SCPI::paramToDouble(params, 0, value)) {
|
// addIntegerManualSettingWithReturnValue("HSRC_PWR", &ManualControlDialog::setHighSourcePower, &ManualControlDialog::getHighSourcePower);
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// addDoubleManualSetting("HSRC_FREQ", &ManualControlDialog::setHighSourceFrequency, &ManualControlDialog::getHighSourceFrequency);
|
||||||
}
|
// scpi_manual->add(new SCPICommand("HSRC_LPF", [=](QStringList params) -> QString {
|
||||||
auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
// long value;
|
||||||
set_fn(value);
|
// if(!manual || !SCPI::paramToLong(params, 0, value)) {
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
}, [=](QStringList) -> QString {
|
// }
|
||||||
if(!manual) {
|
// switch(value) {
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// case 947:
|
||||||
}
|
// manual->setHighSourceLPF(ManualControlDialog::LPF::M947);
|
||||||
auto get_fn = std::bind(get, manual);
|
// break;
|
||||||
return QString::number(get_fn());
|
// case 1880:
|
||||||
}));
|
// manual->setHighSourceLPF(ManualControlDialog::LPF::M1880);
|
||||||
};
|
// break;
|
||||||
auto addIntegerManualSetting = [=](QString cmd, void(ManualControlDialog::*set)(int), int(ManualControlDialog::*get)(void)) {
|
// case 3500:
|
||||||
scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
// manual->setHighSourceLPF(ManualControlDialog::LPF::M3500);
|
||||||
double value;
|
// break;
|
||||||
if(!manual || !SCPI::paramToDouble(params, 0, value)) {
|
// case 0:
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// manual->setHighSourceLPF(ManualControlDialog::LPF::None);
|
||||||
}
|
// break;
|
||||||
auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
// default:
|
||||||
set_fn(value);
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
// }
|
||||||
}, [=](QStringList) -> QString {
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
if(!manual) {
|
// }, [=](QStringList) -> QString {
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// if(!manual) {
|
||||||
}
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
auto get_fn = std::bind(get, manual);
|
// }
|
||||||
return QString::number(get_fn());
|
// auto lpf = manual->getHighSourceLPF();
|
||||||
}));
|
// switch(lpf) {
|
||||||
};
|
// case ManualControlDialog::LPF::M947: return "947";
|
||||||
auto addIntegerManualSettingWithReturnValue = [=](QString cmd, bool(ManualControlDialog::*set)(int), int(ManualControlDialog::*get)(void)) {
|
// case ManualControlDialog::LPF::M1880: return "1880";
|
||||||
scpi_manual->add(new SCPICommand(cmd, [=](QStringList params) -> QString {
|
// case ManualControlDialog::LPF::M3500: return "3500";
|
||||||
double value;
|
// case ManualControlDialog::LPF::None: return "0";
|
||||||
if(!manual || !SCPI::paramToDouble(params, 0, value)) {
|
// default: return SCPI::getResultName(SCPI::Result::Error);
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// }
|
||||||
}
|
// }));
|
||||||
auto set_fn = std::bind(set, manual, std::placeholders::_1);
|
// addBooleanManualSetting("LSRC_EN", &ManualControlDialog::setLowSourceEnable, &ManualControlDialog::getLowSourceEnable);
|
||||||
if(set_fn(value)) {
|
// addIntegerManualSettingWithReturnValue("LSRC_PWR", &ManualControlDialog::setLowSourcePower, &ManualControlDialog::getLowSourcePower);
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
// addDoubleManualSetting("LSRC_FREQ", &ManualControlDialog::setLowSourceFrequency, &ManualControlDialog::getLowSourceFrequency);
|
||||||
} else {
|
// addBooleanManualSetting("BAND_SW", &ManualControlDialog::setHighband, &ManualControlDialog::getHighband);
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// addDoubleManualSetting("ATTenuator", &ManualControlDialog::setAttenuator, &ManualControlDialog::getAttenuator);
|
||||||
}
|
// addBooleanManualSetting("AMP_EN", &ManualControlDialog::setAmplifierEnable, &ManualControlDialog::getAmplifierEnable);
|
||||||
}, [=](QStringList) -> QString {
|
// addIntegerManualSettingWithReturnValue("PORT_SW", &ManualControlDialog::setPortSwitch, &ManualControlDialog::getPortSwitch);
|
||||||
if(!manual) {
|
// addBooleanManualSetting("LO1_CE", &ManualControlDialog::setLO1ChipEnable, &ManualControlDialog::getLO1ChipEnable);
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// addBooleanManualSetting("LO1_RFEN", &ManualControlDialog::setLO1RFEnable, &ManualControlDialog::getLO1RFEnable);
|
||||||
}
|
// addBooleanManualQuery("LO1_LOCKed", &ManualControlDialog::getLO1Locked);
|
||||||
auto get_fn = std::bind(get, manual);
|
// addDoubleManualSetting("LO1_FREQ", &ManualControlDialog::setLO1Frequency, &ManualControlDialog::getLO1Frequency);
|
||||||
return QString::number(get_fn());
|
// addDoubleManualSetting("IF1_FREQ", &ManualControlDialog::setIF1Frequency, &ManualControlDialog::getIF1Frequency);
|
||||||
}));
|
// addBooleanManualSetting("LO2_EN", &ManualControlDialog::setLO2Enable, &ManualControlDialog::getLO2Enable);
|
||||||
};
|
// addDoubleManualSetting("LO2_FREQ", &ManualControlDialog::setLO2Frequency, &ManualControlDialog::getLO2Frequency);
|
||||||
auto addIntegerManualQuery = [=](QString cmd, int(ManualControlDialog::*get)(void)) {
|
// addDoubleManualSetting("IF2_FREQ", &ManualControlDialog::setIF2Frequency, &ManualControlDialog::getIF2Frequency);
|
||||||
scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
// addBooleanManualSetting("PORT1_EN", &ManualControlDialog::setPort1Enable, &ManualControlDialog::getPort1Enable);
|
||||||
if(!manual) {
|
// addBooleanManualSetting("PORT2_EN", &ManualControlDialog::setPort2Enable, &ManualControlDialog::getPort2Enable);
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// addBooleanManualSetting("REF_EN", &ManualControlDialog::setRefEnable, &ManualControlDialog::getRefEnable);
|
||||||
}
|
// addIntegerManualSetting("SAMPLES", &ManualControlDialog::setNumSamples, &ManualControlDialog::getNumSamples);
|
||||||
auto get_fn = std::bind(get, manual);
|
// scpi_manual->add(new SCPICommand("WINdow", [=](QStringList params) -> QString {
|
||||||
return QString::number(get_fn());
|
// if(!manual || params.size() < 1) {
|
||||||
}));
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
};
|
// }
|
||||||
auto addDoubleManualQuery = [=](QString cmd, double(ManualControlDialog::*get)(void)) {
|
// if (params[0] == "NONE") {
|
||||||
scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
// manual->setWindow(ManualControlDialog::Window::None);
|
||||||
if(!manual) {
|
// } else if(params[0] == "KAISER") {
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// manual->setWindow(ManualControlDialog::Window::Kaiser);
|
||||||
}
|
// } else if(params[0] == "HANN") {
|
||||||
auto get_fn = std::bind(get, manual);
|
// manual->setWindow(ManualControlDialog::Window::Hann);
|
||||||
return QString::number(get_fn());
|
// } else if(params[0] == "FLATTOP") {
|
||||||
}));
|
// manual->setWindow(ManualControlDialog::Window::FlatTop);
|
||||||
};
|
// } else {
|
||||||
auto addBooleanManualQuery = [=](QString cmd, bool(ManualControlDialog::*get)(void)) {
|
// return "INVALID WINDOW";
|
||||||
scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
// }
|
||||||
if(!manual) {
|
// return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// }, [=](QStringList) -> QString {
|
||||||
}
|
// if(!manual) {
|
||||||
auto get_fn = std::bind(get, manual);
|
// return SCPI::getResultName(SCPI::Result::Error);
|
||||||
return get_fn() ? SCPI::getResultName(SCPI::Result::True) : SCPI::getResultName(SCPI::Result::False);
|
// }
|
||||||
}));
|
// switch((ManualControlDialog::Window) manual->getWindow()) {
|
||||||
};
|
// case ManualControlDialog::Window::None: return "NONE";
|
||||||
auto addComplexManualQuery = [=](QString cmd, std::complex<double>(ManualControlDialog::*get)(void)) {
|
// case ManualControlDialog::Window::Kaiser: return "KAISER";
|
||||||
scpi_manual->add(new SCPICommand(cmd, nullptr, [=](QStringList) -> QString {
|
// case ManualControlDialog::Window::Hann: return "HANN";
|
||||||
if(!manual) {
|
// case ManualControlDialog::Window::FlatTop: return "FLATTOP";
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
// default: return SCPI::getResultName(SCPI::Result::Error);
|
||||||
}
|
// }
|
||||||
auto get_fn = std::bind(get, manual);
|
// }));
|
||||||
auto res = get_fn();
|
// addIntegerManualQuery("PORT1_MIN", &ManualControlDialog::getPort1MinADC);
|
||||||
return QString::number(res.real())+","+QString::number(res.imag());
|
// addIntegerManualQuery("PORT1_MAX", &ManualControlDialog::getPort1MaxADC);
|
||||||
}));
|
// addDoubleManualQuery("PORT1_MAG", &ManualControlDialog::getPort1Magnitude);
|
||||||
};
|
// addDoubleManualQuery("PORT1_PHAse", &ManualControlDialog::getPort1Phase);
|
||||||
|
// addComplexManualQuery("PORT1_REFerenced", &ManualControlDialog::getPort1Referenced);
|
||||||
|
|
||||||
addBooleanManualSetting("HSRC_CE", &ManualControlDialog::setHighSourceChipEnable, &ManualControlDialog::getHighSourceChipEnable);
|
// addIntegerManualQuery("PORT2_MIN", &ManualControlDialog::getPort2MinADC);
|
||||||
addBooleanManualSetting("HSRC_RFEN", &ManualControlDialog::setHighSourceRFEnable, &ManualControlDialog::getHighSourceRFEnable);
|
// addIntegerManualQuery("PORT2_MAX", &ManualControlDialog::getPort2MaxADC);
|
||||||
addBooleanManualQuery("HSRC_LOCKed", &ManualControlDialog::getHighSourceLocked);
|
// addDoubleManualQuery("PORT2_MAG", &ManualControlDialog::getPort2Magnitude);
|
||||||
addIntegerManualSettingWithReturnValue("HSRC_PWR", &ManualControlDialog::setHighSourcePower, &ManualControlDialog::getHighSourcePower);
|
// addDoubleManualQuery("PORT2_PHAse", &ManualControlDialog::getPort2Phase);
|
||||||
addDoubleManualSetting("HSRC_FREQ", &ManualControlDialog::setHighSourceFrequency, &ManualControlDialog::getHighSourceFrequency);
|
// addComplexManualQuery("PORT2_REFerenced", &ManualControlDialog::getPort2Referenced);
|
||||||
scpi_manual->add(new SCPICommand("HSRC_LPF", [=](QStringList params) -> QString {
|
|
||||||
long value;
|
|
||||||
if(!manual || !SCPI::paramToLong(params, 0, value)) {
|
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
switch(value) {
|
|
||||||
case 947:
|
|
||||||
manual->setHighSourceLPF(ManualControlDialog::LPF::M947);
|
|
||||||
break;
|
|
||||||
case 1880:
|
|
||||||
manual->setHighSourceLPF(ManualControlDialog::LPF::M1880);
|
|
||||||
break;
|
|
||||||
case 3500:
|
|
||||||
manual->setHighSourceLPF(ManualControlDialog::LPF::M3500);
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
manual->setHighSourceLPF(ManualControlDialog::LPF::None);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
|
||||||
}, [=](QStringList) -> QString {
|
|
||||||
if(!manual) {
|
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
auto lpf = manual->getHighSourceLPF();
|
|
||||||
switch(lpf) {
|
|
||||||
case ManualControlDialog::LPF::M947: return "947";
|
|
||||||
case ManualControlDialog::LPF::M1880: return "1880";
|
|
||||||
case ManualControlDialog::LPF::M3500: return "3500";
|
|
||||||
case ManualControlDialog::LPF::None: return "0";
|
|
||||||
default: return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
addBooleanManualSetting("LSRC_EN", &ManualControlDialog::setLowSourceEnable, &ManualControlDialog::getLowSourceEnable);
|
|
||||||
addIntegerManualSettingWithReturnValue("LSRC_PWR", &ManualControlDialog::setLowSourcePower, &ManualControlDialog::getLowSourcePower);
|
|
||||||
addDoubleManualSetting("LSRC_FREQ", &ManualControlDialog::setLowSourceFrequency, &ManualControlDialog::getLowSourceFrequency);
|
|
||||||
addBooleanManualSetting("BAND_SW", &ManualControlDialog::setHighband, &ManualControlDialog::getHighband);
|
|
||||||
addDoubleManualSetting("ATTenuator", &ManualControlDialog::setAttenuator, &ManualControlDialog::getAttenuator);
|
|
||||||
addBooleanManualSetting("AMP_EN", &ManualControlDialog::setAmplifierEnable, &ManualControlDialog::getAmplifierEnable);
|
|
||||||
addIntegerManualSettingWithReturnValue("PORT_SW", &ManualControlDialog::setPortSwitch, &ManualControlDialog::getPortSwitch);
|
|
||||||
addBooleanManualSetting("LO1_CE", &ManualControlDialog::setLO1ChipEnable, &ManualControlDialog::getLO1ChipEnable);
|
|
||||||
addBooleanManualSetting("LO1_RFEN", &ManualControlDialog::setLO1RFEnable, &ManualControlDialog::getLO1RFEnable);
|
|
||||||
addBooleanManualQuery("LO1_LOCKed", &ManualControlDialog::getLO1Locked);
|
|
||||||
addDoubleManualSetting("LO1_FREQ", &ManualControlDialog::setLO1Frequency, &ManualControlDialog::getLO1Frequency);
|
|
||||||
addDoubleManualSetting("IF1_FREQ", &ManualControlDialog::setIF1Frequency, &ManualControlDialog::getIF1Frequency);
|
|
||||||
addBooleanManualSetting("LO2_EN", &ManualControlDialog::setLO2Enable, &ManualControlDialog::getLO2Enable);
|
|
||||||
addDoubleManualSetting("LO2_FREQ", &ManualControlDialog::setLO2Frequency, &ManualControlDialog::getLO2Frequency);
|
|
||||||
addDoubleManualSetting("IF2_FREQ", &ManualControlDialog::setIF2Frequency, &ManualControlDialog::getIF2Frequency);
|
|
||||||
addBooleanManualSetting("PORT1_EN", &ManualControlDialog::setPort1Enable, &ManualControlDialog::getPort1Enable);
|
|
||||||
addBooleanManualSetting("PORT2_EN", &ManualControlDialog::setPort2Enable, &ManualControlDialog::getPort2Enable);
|
|
||||||
addBooleanManualSetting("REF_EN", &ManualControlDialog::setRefEnable, &ManualControlDialog::getRefEnable);
|
|
||||||
addIntegerManualSetting("SAMPLES", &ManualControlDialog::setNumSamples, &ManualControlDialog::getNumSamples);
|
|
||||||
scpi_manual->add(new SCPICommand("WINdow", [=](QStringList params) -> QString {
|
|
||||||
if(!manual || params.size() < 1) {
|
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
if (params[0] == "NONE") {
|
|
||||||
manual->setWindow(ManualControlDialog::Window::None);
|
|
||||||
} else if(params[0] == "KAISER") {
|
|
||||||
manual->setWindow(ManualControlDialog::Window::Kaiser);
|
|
||||||
} else if(params[0] == "HANN") {
|
|
||||||
manual->setWindow(ManualControlDialog::Window::Hann);
|
|
||||||
} else if(params[0] == "FLATTOP") {
|
|
||||||
manual->setWindow(ManualControlDialog::Window::FlatTop);
|
|
||||||
} else {
|
|
||||||
return "INVALID WINDOW";
|
|
||||||
}
|
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
|
||||||
}, [=](QStringList) -> QString {
|
|
||||||
if(!manual) {
|
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
switch((ManualControlDialog::Window) manual->getWindow()) {
|
|
||||||
case ManualControlDialog::Window::None: return "NONE";
|
|
||||||
case ManualControlDialog::Window::Kaiser: return "KAISER";
|
|
||||||
case ManualControlDialog::Window::Hann: return "HANN";
|
|
||||||
case ManualControlDialog::Window::FlatTop: return "FLATTOP";
|
|
||||||
default: return SCPI::getResultName(SCPI::Result::Error);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
addIntegerManualQuery("PORT1_MIN", &ManualControlDialog::getPort1MinADC);
|
|
||||||
addIntegerManualQuery("PORT1_MAX", &ManualControlDialog::getPort1MaxADC);
|
|
||||||
addDoubleManualQuery("PORT1_MAG", &ManualControlDialog::getPort1Magnitude);
|
|
||||||
addDoubleManualQuery("PORT1_PHAse", &ManualControlDialog::getPort1Phase);
|
|
||||||
addComplexManualQuery("PORT1_REFerenced", &ManualControlDialog::getPort1Referenced);
|
|
||||||
|
|
||||||
addIntegerManualQuery("PORT2_MIN", &ManualControlDialog::getPort2MinADC);
|
// addIntegerManualQuery("REF_MIN", &ManualControlDialog::getRefMinADC);
|
||||||
addIntegerManualQuery("PORT2_MAX", &ManualControlDialog::getPort2MaxADC);
|
// addIntegerManualQuery("REF_MAX", &ManualControlDialog::getRefMaxADC);
|
||||||
addDoubleManualQuery("PORT2_MAG", &ManualControlDialog::getPort2Magnitude);
|
// addDoubleManualQuery("REF_MAG", &ManualControlDialog::getRefMagnitude);
|
||||||
addDoubleManualQuery("PORT2_PHAse", &ManualControlDialog::getPort2Phase);
|
// addDoubleManualQuery("REF_PHAse", &ManualControlDialog::getRefPhase);
|
||||||
addComplexManualQuery("PORT2_REFerenced", &ManualControlDialog::getPort2Referenced);
|
|
||||||
|
|
||||||
addIntegerManualQuery("REF_MIN", &ManualControlDialog::getRefMinADC);
|
// scpi.add(scpi_manual);
|
||||||
addIntegerManualQuery("REF_MAX", &ManualControlDialog::getRefMaxADC);
|
|
||||||
addDoubleManualQuery("REF_MAG", &ManualControlDialog::getRefMagnitude);
|
|
||||||
addDoubleManualQuery("REF_PHAse", &ManualControlDialog::getRefPhase);
|
|
||||||
|
|
||||||
scpi.add(scpi_manual);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppWindow::StartTCPServer(int port)
|
void AppWindow::StartTCPServer(int port)
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "scpi.h"
|
#include "scpi.h"
|
||||||
#include "tcpserver.h"
|
#include "tcpserver.h"
|
||||||
#include "Device/manualcontroldialog.h"
|
|
||||||
#include "Device/devicedriver.h"
|
#include "Device/devicedriver.h"
|
||||||
|
//#include "modehandler.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@ -32,6 +32,7 @@ class VNA;
|
|||||||
class Generator;
|
class Generator;
|
||||||
class SpectrumAnalyzer;
|
class SpectrumAnalyzer;
|
||||||
class ModeHandler;
|
class ModeHandler;
|
||||||
|
class Mode;
|
||||||
|
|
||||||
class AppWindow : public QMainWindow
|
class AppWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
@ -105,6 +106,7 @@ private:
|
|||||||
} toolbars;
|
} toolbars;
|
||||||
|
|
||||||
ModeHandler *modeHandler;
|
ModeHandler *modeHandler;
|
||||||
|
Mode *lastActiveMode;
|
||||||
|
|
||||||
// VirtualDevice *vdevice;
|
// VirtualDevice *vdevice;
|
||||||
std::vector<DeviceDriver*> deviceDrivers;
|
std::vector<DeviceDriver*> deviceDrivers;
|
||||||
@ -128,8 +130,6 @@ private:
|
|||||||
QString deviceSerial;
|
QString deviceSerial;
|
||||||
QActionGroup *deviceActionGroup;
|
QActionGroup *deviceActionGroup;
|
||||||
|
|
||||||
ManualControlDialog *manual;
|
|
||||||
|
|
||||||
// Status bar widgets
|
// Status bar widgets
|
||||||
QLabel lConnectionStatus;
|
QLabel lConnectionStatus;
|
||||||
QLabel lDeviceInfo;
|
QLabel lDeviceInfo;
|
||||||
|
@ -49,12 +49,6 @@
|
|||||||
<addaction name="menuConnect_to"/>
|
<addaction name="menuConnect_to"/>
|
||||||
<addaction name="actionDisconnect"/>
|
<addaction name="actionDisconnect"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionManual_Control"/>
|
|
||||||
<addaction name="actionFirmware_Update"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionSource_Calibration"/>
|
|
||||||
<addaction name="actionReceiver_Calibration"/>
|
|
||||||
<addaction name="actionFrequency_Calibration"/>
|
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionUSB_log"/>
|
<addaction name="actionUSB_log"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -184,6 +184,7 @@ private:
|
|||||||
TCPoverride(false) {}
|
TCPoverride(false) {}
|
||||||
static Preferences instance;
|
static Preferences instance;
|
||||||
|
|
||||||
|
// TODO remove settings that have been moved to LibreVNADriver
|
||||||
const std::vector<Savable::SettingDescription> descr = {{
|
const std::vector<Savable::SettingDescription> descr = {{
|
||||||
{&Startup.ConnectToFirstDevice, "Startup.ConnectToFirstDevice", true},
|
{&Startup.ConnectToFirstDevice, "Startup.ConnectToFirstDevice", true},
|
||||||
{&Startup.RememberSweepSettings, "Startup.RememberSweepSettings", false},
|
{&Startup.RememberSweepSettings, "Startup.RememberSweepSettings", false},
|
||||||
|
@ -10,16 +10,12 @@ SOURCES += \
|
|||||||
../LibreVNA-GUI/Calibration/LibreCAL/caldevice.cpp \
|
../LibreVNA-GUI/Calibration/LibreCAL/caldevice.cpp \
|
||||||
../LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.cpp \
|
../LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.cpp \
|
||||||
../LibreVNA-GUI/Calibration/LibreCAL/usbdevice.cpp \
|
../LibreVNA-GUI/Calibration/LibreCAL/usbdevice.cpp \
|
||||||
../LibreVNA-GUI/Calibration/amplitudecaldialog.cpp \
|
|
||||||
../LibreVNA-GUI/Calibration/calibration.cpp \
|
../LibreVNA-GUI/Calibration/calibration.cpp \
|
||||||
../LibreVNA-GUI/Calibration/calibrationmeasurement.cpp \
|
../LibreVNA-GUI/Calibration/calibrationmeasurement.cpp \
|
||||||
../LibreVNA-GUI/Calibration/calkit.cpp \
|
../LibreVNA-GUI/Calibration/calkit.cpp \
|
||||||
../LibreVNA-GUI/Calibration/calkitdialog.cpp \
|
../LibreVNA-GUI/Calibration/calkitdialog.cpp \
|
||||||
../LibreVNA-GUI/Calibration/calstandard.cpp \
|
../LibreVNA-GUI/Calibration/calstandard.cpp \
|
||||||
../LibreVNA-GUI/Calibration/frequencycaldialog.cpp \
|
|
||||||
../LibreVNA-GUI/Calibration/manualcalibrationdialog.cpp \
|
../LibreVNA-GUI/Calibration/manualcalibrationdialog.cpp \
|
||||||
../LibreVNA-GUI/Calibration/receivercaldialog.cpp \
|
|
||||||
../LibreVNA-GUI/Calibration/sourcecaldialog.cpp \
|
|
||||||
../LibreVNA-GUI/CustomWidgets/colorpickerbutton.cpp \
|
../LibreVNA-GUI/CustomWidgets/colorpickerbutton.cpp \
|
||||||
../LibreVNA-GUI/CustomWidgets/csvimport.cpp \
|
../LibreVNA-GUI/CustomWidgets/csvimport.cpp \
|
||||||
../LibreVNA-GUI/CustomWidgets/informationbox.cpp \
|
../LibreVNA-GUI/CustomWidgets/informationbox.cpp \
|
||||||
@ -29,6 +25,14 @@ SOURCES += \
|
|||||||
../LibreVNA-GUI/CustomWidgets/toggleswitch.cpp \
|
../LibreVNA-GUI/CustomWidgets/toggleswitch.cpp \
|
||||||
../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/firmwareupdatedialog.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/librevnadriver.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/librevnausbdriver.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialog.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/receivercaldialog.cpp \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/sourcecaldialog.cpp \
|
||||||
../LibreVNA-GUI/Device/compounddevice.cpp \
|
../LibreVNA-GUI/Device/compounddevice.cpp \
|
||||||
../LibreVNA-GUI/Device/compounddeviceeditdialog.cpp \
|
../LibreVNA-GUI/Device/compounddeviceeditdialog.cpp \
|
||||||
../LibreVNA-GUI/Device/device.cpp \
|
../LibreVNA-GUI/Device/device.cpp \
|
||||||
@ -36,10 +40,6 @@ SOURCES += \
|
|||||||
../LibreVNA-GUI/Device/devicelog.cpp \
|
../LibreVNA-GUI/Device/devicelog.cpp \
|
||||||
../LibreVNA-GUI/Device/deviceusblog.cpp \
|
../LibreVNA-GUI/Device/deviceusblog.cpp \
|
||||||
../LibreVNA-GUI/Device/deviceusblogview.cpp \
|
../LibreVNA-GUI/Device/deviceusblogview.cpp \
|
||||||
../LibreVNA-GUI/Device/firmwareupdatedialog.cpp \
|
|
||||||
../LibreVNA-GUI/Device/librevnadriver.cpp \
|
|
||||||
../LibreVNA-GUI/Device/librevnausbdriver.cpp \
|
|
||||||
../LibreVNA-GUI/Device/manualcontroldialog.cpp \
|
|
||||||
../LibreVNA-GUI/Device/virtualdevice.cpp \
|
../LibreVNA-GUI/Device/virtualdevice.cpp \
|
||||||
../LibreVNA-GUI/Generator/generator.cpp \
|
../LibreVNA-GUI/Generator/generator.cpp \
|
||||||
../LibreVNA-GUI/Generator/signalgenwidget.cpp \
|
../LibreVNA-GUI/Generator/signalgenwidget.cpp \
|
||||||
@ -180,16 +180,12 @@ HEADERS += \
|
|||||||
../LibreVNA-GUI/Calibration/LibreCAL/caldevice.h \
|
../LibreVNA-GUI/Calibration/LibreCAL/caldevice.h \
|
||||||
../LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.h \
|
../LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.h \
|
||||||
../LibreVNA-GUI/Calibration/LibreCAL/usbdevice.h \
|
../LibreVNA-GUI/Calibration/LibreCAL/usbdevice.h \
|
||||||
../LibreVNA-GUI/Calibration/amplitudecaldialog.h \
|
|
||||||
../LibreVNA-GUI/Calibration/calibration.h \
|
../LibreVNA-GUI/Calibration/calibration.h \
|
||||||
../LibreVNA-GUI/Calibration/calibrationmeasurement.h \
|
../LibreVNA-GUI/Calibration/calibrationmeasurement.h \
|
||||||
../LibreVNA-GUI/Calibration/calkit.h \
|
../LibreVNA-GUI/Calibration/calkit.h \
|
||||||
../LibreVNA-GUI/Calibration/calkitdialog.h \
|
../LibreVNA-GUI/Calibration/calkitdialog.h \
|
||||||
../LibreVNA-GUI/Calibration/calstandard.h \
|
../LibreVNA-GUI/Calibration/calstandard.h \
|
||||||
../LibreVNA-GUI/Calibration/frequencycaldialog.h \
|
|
||||||
../LibreVNA-GUI/Calibration/manualcalibrationdialog.h \
|
../LibreVNA-GUI/Calibration/manualcalibrationdialog.h \
|
||||||
../LibreVNA-GUI/Calibration/receivercaldialog.h \
|
|
||||||
../LibreVNA-GUI/Calibration/sourcecaldialog.h \
|
|
||||||
../LibreVNA-GUI/CustomWidgets/colorpickerbutton.h \
|
../LibreVNA-GUI/CustomWidgets/colorpickerbutton.h \
|
||||||
../LibreVNA-GUI/CustomWidgets/csvimport.h \
|
../LibreVNA-GUI/CustomWidgets/csvimport.h \
|
||||||
../LibreVNA-GUI/CustomWidgets/informationbox.h \
|
../LibreVNA-GUI/CustomWidgets/informationbox.h \
|
||||||
@ -199,6 +195,14 @@ HEADERS += \
|
|||||||
../LibreVNA-GUI/CustomWidgets/toggleswitch.h \
|
../LibreVNA-GUI/CustomWidgets/toggleswitch.h \
|
||||||
../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/firmwareupdatedialog.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/librevnadriver.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/librevnausbdriver.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialog.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/receivercaldialog.h \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/sourcecaldialog.h \
|
||||||
../LibreVNA-GUI/Device/compounddevice.h \
|
../LibreVNA-GUI/Device/compounddevice.h \
|
||||||
../LibreVNA-GUI/Device/compounddeviceeditdialog.h \
|
../LibreVNA-GUI/Device/compounddeviceeditdialog.h \
|
||||||
../LibreVNA-GUI/Device/device.h \
|
../LibreVNA-GUI/Device/device.h \
|
||||||
@ -206,10 +210,6 @@ HEADERS += \
|
|||||||
../LibreVNA-GUI/Device/devicelog.h \
|
../LibreVNA-GUI/Device/devicelog.h \
|
||||||
../LibreVNA-GUI/Device/deviceusblog.h \
|
../LibreVNA-GUI/Device/deviceusblog.h \
|
||||||
../LibreVNA-GUI/Device/deviceusblogview.h \
|
../LibreVNA-GUI/Device/deviceusblogview.h \
|
||||||
../LibreVNA-GUI/Device/firmwareupdatedialog.h \
|
|
||||||
../LibreVNA-GUI/Device/librevnadriver.h \
|
|
||||||
../LibreVNA-GUI/Device/librevnausbdriver.h \
|
|
||||||
../LibreVNA-GUI/Device/manualcontroldialog.h \
|
|
||||||
../LibreVNA-GUI/Device/virtualdevice.h \
|
../LibreVNA-GUI/Device/virtualdevice.h \
|
||||||
../LibreVNA-GUI/Generator/generator.h \
|
../LibreVNA-GUI/Generator/generator.h \
|
||||||
../LibreVNA-GUI/Generator/signalgenwidget.h \
|
../LibreVNA-GUI/Generator/signalgenwidget.h \
|
||||||
@ -340,22 +340,22 @@ FORMS += \
|
|||||||
../LibreVNA-GUI/Calibration/CalStandardShortEditDialog.ui \
|
../LibreVNA-GUI/Calibration/CalStandardShortEditDialog.ui \
|
||||||
../LibreVNA-GUI/Calibration/CalStandardThroughEditDialog.ui \
|
../LibreVNA-GUI/Calibration/CalStandardThroughEditDialog.ui \
|
||||||
../LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.ui \
|
../LibreVNA-GUI/Calibration/LibreCAL/librecaldialog.ui \
|
||||||
../LibreVNA-GUI/Calibration/addamplitudepointsdialog.ui \
|
|
||||||
../LibreVNA-GUI/Calibration/amplitudecaldialog.ui \
|
|
||||||
../LibreVNA-GUI/Calibration/automaticamplitudedialog.ui \
|
|
||||||
../LibreVNA-GUI/Calibration/calibrationdialogui.ui \
|
../LibreVNA-GUI/Calibration/calibrationdialogui.ui \
|
||||||
../LibreVNA-GUI/Calibration/calkitdialog.ui \
|
../LibreVNA-GUI/Calibration/calkitdialog.ui \
|
||||||
../LibreVNA-GUI/Calibration/frequencycaldialog.ui \
|
|
||||||
../LibreVNA-GUI/Calibration/manualcalibrationdialog.ui \
|
../LibreVNA-GUI/Calibration/manualcalibrationdialog.ui \
|
||||||
../LibreVNA-GUI/CustomWidgets/csvimport.ui \
|
../LibreVNA-GUI/CustomWidgets/csvimport.ui \
|
||||||
../LibreVNA-GUI/CustomWidgets/jsonpickerdialog.ui \
|
../LibreVNA-GUI/CustomWidgets/jsonpickerdialog.ui \
|
||||||
../LibreVNA-GUI/CustomWidgets/tilewidget.ui \
|
../LibreVNA-GUI/CustomWidgets/tilewidget.ui \
|
||||||
../LibreVNA-GUI/CustomWidgets/touchstoneimport.ui \
|
../LibreVNA-GUI/CustomWidgets/touchstoneimport.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/addamplitudepointsdialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/automaticamplitudedialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/frequencycaldialog.ui \
|
||||||
|
../LibreVNA-GUI/Device/LibreVNA/manualcontroldialog.ui \
|
||||||
../LibreVNA-GUI/Device/compounddeviceeditdialog.ui \
|
../LibreVNA-GUI/Device/compounddeviceeditdialog.ui \
|
||||||
../LibreVNA-GUI/Device/devicelog.ui \
|
../LibreVNA-GUI/Device/devicelog.ui \
|
||||||
../LibreVNA-GUI/Device/deviceusblogview.ui \
|
../LibreVNA-GUI/Device/deviceusblogview.ui \
|
||||||
../LibreVNA-GUI/Device/firmwareupdatedialog.ui \
|
|
||||||
../LibreVNA-GUI/Device/manualcontroldialog.ui \
|
|
||||||
../LibreVNA-GUI/Generator/signalgenwidget.ui \
|
../LibreVNA-GUI/Generator/signalgenwidget.ui \
|
||||||
../LibreVNA-GUI/Tools/impedancematchdialog.ui \
|
../LibreVNA-GUI/Tools/impedancematchdialog.ui \
|
||||||
../LibreVNA-GUI/Tools/mixedmodeconversion.ui \
|
../LibreVNA-GUI/Tools/mixedmodeconversion.ui \
|
||||||
|
Loading…
Reference in New Issue
Block a user