Fixing variable initializations part 1
This commit is contained in:
parent
796a8cb3f9
commit
3a9d169d46
@ -24,6 +24,7 @@ AmplitudeCalDialog::AmplitudeCalDialog(Device *dev, ModeHandler *handler, QWidge
|
|||||||
dev(dev),
|
dev(dev),
|
||||||
modeHandler(handler),
|
modeHandler(handler),
|
||||||
model(this),
|
model(this),
|
||||||
|
edited(false),
|
||||||
mode(CalibrationMode::BothPorts)
|
mode(CalibrationMode::BothPorts)
|
||||||
{
|
{
|
||||||
activeMode = modeHandler->getActiveMode();
|
activeMode = modeHandler->getActiveMode();
|
||||||
@ -350,6 +351,7 @@ void AmplitudeCalDialog::AddPointDialog()
|
|||||||
|
|
||||||
void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
||||||
{
|
{
|
||||||
|
automatic = {};
|
||||||
automatic.isSourceCal = pointType() == Protocol::PacketType::SourceCalPoint;
|
automatic.isSourceCal = pointType() == Protocol::PacketType::SourceCalPoint;
|
||||||
const QString ownCal = automatic.isSourceCal ? "Source" : "Receiver";
|
const QString ownCal = automatic.isSourceCal ? "Source" : "Receiver";
|
||||||
const QString otherCal = automatic.isSourceCal ? "Receiver" : "Source";
|
const QString otherCal = automatic.isSourceCal ? "Receiver" : "Source";
|
||||||
|
@ -684,16 +684,16 @@ Calibration::Point Calibration::createInitializedPoint(double f) {
|
|||||||
Point point;
|
Point point;
|
||||||
point.frequency = f;
|
point.frequency = f;
|
||||||
// resize vectors
|
// resize vectors
|
||||||
point.D.resize(caltype.usedPorts.size());
|
point.D.resize(caltype.usedPorts.size(), 0.0);
|
||||||
point.R.resize(caltype.usedPorts.size());
|
point.R.resize(caltype.usedPorts.size(), 0.0);
|
||||||
point.S.resize(caltype.usedPorts.size());
|
point.S.resize(caltype.usedPorts.size(), 0.0);
|
||||||
|
|
||||||
point.L.resize(caltype.usedPorts.size());
|
point.L.resize(caltype.usedPorts.size());
|
||||||
point.T.resize(caltype.usedPorts.size());
|
point.T.resize(caltype.usedPorts.size());
|
||||||
point.I.resize(caltype.usedPorts.size());
|
point.I.resize(caltype.usedPorts.size());
|
||||||
fill(point.L.begin(), point.L.end(), vector<complex<double>>(caltype.usedPorts.size()));
|
fill(point.L.begin(), point.L.end(), vector<complex<double>>(caltype.usedPorts.size(), 0.0));
|
||||||
fill(point.T.begin(), point.T.end(), vector<complex<double>>(caltype.usedPorts.size()));
|
fill(point.T.begin(), point.T.end(), vector<complex<double>>(caltype.usedPorts.size(), 0.0));
|
||||||
fill(point.I.begin(), point.I.end(), vector<complex<double>>(caltype.usedPorts.size()));
|
fill(point.I.begin(), point.I.end(), vector<complex<double>>(caltype.usedPorts.size(), 0.0));
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,7 +802,7 @@ Calibration::Point Calibration::computeThroughNormalization(double f)
|
|||||||
// grab measurement and calkit through definitions
|
// grab measurement and calkit through definitions
|
||||||
auto throughForward = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p1, p2));
|
auto throughForward = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p1, p2));
|
||||||
auto throughReverse = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p2, p1));
|
auto throughReverse = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p2, p1));
|
||||||
complex<double> S21;
|
complex<double> S21 = 0.0;
|
||||||
Sparam Sideal;
|
Sparam Sideal;
|
||||||
if(throughForward) {
|
if(throughForward) {
|
||||||
S21 = throughForward->getMeasured(f).m21;
|
S21 = throughForward->getMeasured(f).m21;
|
||||||
@ -1761,35 +1761,35 @@ Calibration::Point Calibration::Point::interpolate(const Calibration::Point &to,
|
|||||||
{
|
{
|
||||||
Point ret;
|
Point ret;
|
||||||
ret.frequency = frequency * (1.0-alpha) + to.frequency * alpha;
|
ret.frequency = frequency * (1.0-alpha) + to.frequency * alpha;
|
||||||
ret.D.resize(D.size());
|
ret.D.resize(D.size(), 0.0);
|
||||||
for(unsigned int i=0;i<D.size();i++) {
|
for(unsigned int i=0;i<D.size();i++) {
|
||||||
ret.D[i] = D[i] * (1.0-alpha) + to.D[i] * alpha;
|
ret.D[i] = D[i] * (1.0-alpha) + to.D[i] * alpha;
|
||||||
}
|
}
|
||||||
ret.R.resize(R.size());
|
ret.R.resize(R.size(), 0.0);
|
||||||
for(unsigned int i=0;i<R.size();i++) {
|
for(unsigned int i=0;i<R.size();i++) {
|
||||||
ret.R[i] = R[i] * (1.0-alpha) + to.R[i] * alpha;
|
ret.R[i] = R[i] * (1.0-alpha) + to.R[i] * alpha;
|
||||||
}
|
}
|
||||||
ret.S.resize(S.size());
|
ret.S.resize(S.size(), 0.0);
|
||||||
for(unsigned int i=0;i<S.size();i++) {
|
for(unsigned int i=0;i<S.size();i++) {
|
||||||
ret.S[i] = S[i] * (1.0-alpha) + to.S[i] * alpha;
|
ret.S[i] = S[i] * (1.0-alpha) + to.S[i] * alpha;
|
||||||
}
|
}
|
||||||
ret.T.resize(T.size());
|
ret.T.resize(T.size());
|
||||||
for(unsigned int i=0;i<T.size();i++) {
|
for(unsigned int i=0;i<T.size();i++) {
|
||||||
ret.T[i].resize(T[i].size());
|
ret.T[i].resize(T[i].size(), 0.0);
|
||||||
for(unsigned int j=0;j<T[i].size();j++) {
|
for(unsigned int j=0;j<T[i].size();j++) {
|
||||||
ret.T[i][j] = T[i][j] * (1.0 - alpha) + to.T[i][j] * alpha;
|
ret.T[i][j] = T[i][j] * (1.0 - alpha) + to.T[i][j] * alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret.L.resize(L.size());
|
ret.L.resize(L.size());
|
||||||
for(unsigned int i=0;i<L.size();i++) {
|
for(unsigned int i=0;i<L.size();i++) {
|
||||||
ret.L[i].resize(L[i].size());
|
ret.L[i].resize(L[i].size(), 0.0);
|
||||||
for(unsigned int j=0;j<L[i].size();j++) {
|
for(unsigned int j=0;j<L[i].size();j++) {
|
||||||
ret.L[i][j] = L[i][j] * (1.0 - alpha) + to.L[i][j] * alpha;
|
ret.L[i][j] = L[i][j] * (1.0 - alpha) + to.L[i][j] * alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret.I.resize(I.size());
|
ret.I.resize(I.size());
|
||||||
for(unsigned int i=0;i<I.size();i++) {
|
for(unsigned int i=0;i<I.size();i++) {
|
||||||
ret.I[i].resize(I[i].size());
|
ret.I[i].resize(I[i].size(), 0.0);
|
||||||
for(unsigned int j=0;j<I[i].size();j++) {
|
for(unsigned int j=0;j<I[i].size();j++) {
|
||||||
ret.I[i][j] = I[i][j] * (1.0 - alpha) + to.I[i][j] * alpha;
|
ret.I[i][j] = I[i][j] * (1.0 - alpha) + to.I[i][j] * alpha;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void evaluateFile();
|
void evaluateFile();
|
||||||
Ui::csvimport *ui;
|
Ui::csvimport *ui;
|
||||||
int required_ports;
|
|
||||||
CSV csv;
|
CSV csv;
|
||||||
bool status;
|
bool status;
|
||||||
};
|
};
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
TileWidget::TileWidget(TraceModel &model, QWidget *parent) :
|
TileWidget::TileWidget(TraceModel &model, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
|
fullScreenPlot(nullptr),
|
||||||
ui(new Ui::TileWidget),
|
ui(new Ui::TileWidget),
|
||||||
splitter(0),
|
splitter(0),
|
||||||
isSplit(false),
|
isSplit(false),
|
||||||
|
@ -13,7 +13,10 @@ using namespace std;
|
|||||||
|
|
||||||
CompoundDeviceEditDialog::CompoundDeviceEditDialog(CompoundDevice *cdev, QWidget *parent) :
|
CompoundDeviceEditDialog::CompoundDeviceEditDialog(CompoundDevice *cdev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::CompoundDeviceEditDialog)
|
ui(new Ui::CompoundDeviceEditDialog),
|
||||||
|
dropPending(false),
|
||||||
|
dragFrame(nullptr),
|
||||||
|
dropFrame(nullptr)
|
||||||
{
|
{
|
||||||
ldev = *cdev;
|
ldev = *cdev;
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -28,7 +28,6 @@ private:
|
|||||||
static constexpr int frameSize = 350;
|
static constexpr int frameSize = 350;
|
||||||
QComboBox *serial;
|
QComboBox *serial;
|
||||||
QComboBox *port1, *port2;
|
QComboBox *port1, *port2;
|
||||||
QLabel *image;
|
|
||||||
|
|
||||||
unsigned int position;
|
unsigned int position;
|
||||||
CompoundDevice *dev;
|
CompoundDevice *dev;
|
||||||
|
@ -11,7 +11,8 @@ FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
|||||||
dev(dev),
|
dev(dev),
|
||||||
file(),
|
file(),
|
||||||
timer(),
|
timer(),
|
||||||
state(State::Idle)
|
state(State::Idle),
|
||||||
|
transferredBytes(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->bFile->setIcon(this->style()->standardPixmap(QStyle::SP_FileDialogStart));
|
ui->bFile->setIcon(this->style()->standardPixmap(QStyle::SP_FileDialogStart));
|
||||||
|
@ -105,7 +105,6 @@ VirtualDevice::VirtualDevice(QString serial)
|
|||||||
info{},
|
info{},
|
||||||
status{}
|
status{}
|
||||||
{
|
{
|
||||||
cdev = nullptr;
|
|
||||||
cdev = nullptr;
|
cdev = nullptr;
|
||||||
zerospan = false;
|
zerospan = false;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
SignalgeneratorWidget::SignalgeneratorWidget(AppWindow *window, QWidget *parent) :
|
SignalgeneratorWidget::SignalgeneratorWidget(AppWindow *window, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::SignalgeneratorWidget),
|
ui(new Ui::SignalgeneratorWidget),
|
||||||
|
m_timerId(0),
|
||||||
window(window)
|
window(window)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -46,8 +46,10 @@
|
|||||||
|
|
||||||
SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
|
SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
|
||||||
: Mode(window, name, "SA"),
|
: Mode(window, name, "SA"),
|
||||||
central(new TileWidget(traceModel, window))
|
central(new TileWidget(traceModel, window)),
|
||||||
|
firstPointTime(0)
|
||||||
{
|
{
|
||||||
|
changingSettings = false;
|
||||||
averages = 1;
|
averages = 1;
|
||||||
singleSweep = false;
|
singleSweep = false;
|
||||||
settings = {};
|
settings = {};
|
||||||
@ -55,6 +57,12 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
|
|||||||
normalize.measuring = false;
|
normalize.measuring = false;
|
||||||
normalize.points = 0;
|
normalize.points = 0;
|
||||||
normalize.dialog.reset();
|
normalize.dialog.reset();
|
||||||
|
normalize.f_start = 0;
|
||||||
|
normalize.f_stop = 0;
|
||||||
|
normalize.points = 0;
|
||||||
|
normalize.Level = nullptr;
|
||||||
|
normalize.measure = nullptr;
|
||||||
|
normalize.enable = nullptr;
|
||||||
|
|
||||||
traceModel.setSource(TraceModel::DataSource::SA);
|
traceModel.setSource(TraceModel::DataSource::SA);
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class Parameters : public Savable {
|
|||||||
public:
|
public:
|
||||||
Parameters(Type m11, Type m12, Type m21, Type m22)
|
Parameters(Type m11, Type m12, Type m21, Type m22)
|
||||||
: m11(m11), m12(m12), m21(m21), m22(m22){}
|
: m11(m11), m12(m12), m21(m21), m22(m22){}
|
||||||
Parameters(){}
|
Parameters() : m11(0.0),m12(0.0),m21(0.0),m22(0.0){}
|
||||||
|
|
||||||
Type m11, m12, m21, m22;
|
Type m11, m12, m21, m22;
|
||||||
|
|
||||||
@ -131,62 +131,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//template<typename T>
|
|
||||||
//class Tparam {
|
|
||||||
//public:
|
|
||||||
// Tparam(){};
|
|
||||||
// Tparam(T t11, T t12, T t21, T t22)
|
|
||||||
// : t11(t11), t12(t12), t21(t21), t22(t22){};
|
|
||||||
// void fromSparam(T S11, T S21, T S12, T S22) {
|
|
||||||
// t11 = -(S11*S22 - S12*S21) / S21;
|
|
||||||
// t12 = S11 / S21;
|
|
||||||
// t21 = -S22 / S21;
|
|
||||||
// t22 = 1.0 / S21;
|
|
||||||
// }
|
|
||||||
// void toSparam(T &S11, T &S21, T &S12, T &S22) {
|
|
||||||
// S11 = t12 / t22;
|
|
||||||
// S21 = T(1) / t22;
|
|
||||||
// S12 = (t11*t22 - t12*t21) / t22;
|
|
||||||
// S22 = -t21 / t22;
|
|
||||||
// }
|
|
||||||
// Tparam inverse() {
|
|
||||||
// Tparam i;
|
|
||||||
// T det = t11*t22 - t12*t21;
|
|
||||||
// i.t11 = t22 / det;
|
|
||||||
// i.t12 = -t12 / det;
|
|
||||||
// i.t21 = -t21 / det;
|
|
||||||
// i.t22 = t11 / det;
|
|
||||||
// return i;
|
|
||||||
// }
|
|
||||||
// Tparam root() {
|
|
||||||
// // calculate root of 2x2 matrix, according to https://en.wikipedia.org/wiki/Square_root_of_a_2_by_2_matrix (choose positive roots)
|
|
||||||
// auto tau = t11 + t22;
|
|
||||||
// auto sigma = t11*t22 - t12*t21;
|
|
||||||
// auto s = sqrt(sigma);
|
|
||||||
// auto t = sqrt(tau + 2.0*s);
|
|
||||||
// Tparam r = *this;
|
|
||||||
// r.t11 += s;
|
|
||||||
// r.t22 += s;
|
|
||||||
// r = r * (1.0/t);
|
|
||||||
// return r;
|
|
||||||
// }
|
|
||||||
// Tparam operator*(const Tparam &r) {
|
|
||||||
// Tparam p;
|
|
||||||
// p.t11 = t11*r.t11 + t12*r.t21;
|
|
||||||
// p.t12 = t11*r.t12 + t12*r.t22;
|
|
||||||
// p.t21 = t21*r.t11 + t22*r.t21;
|
|
||||||
// p.t22 = t21*r.t12 + t22*r.t22;
|
|
||||||
// return p;
|
|
||||||
// }
|
|
||||||
// Tparam operator*(const T &r) {
|
|
||||||
// Tparam p;
|
|
||||||
// p.t11 = t11 * r;
|
|
||||||
// p.t12 = t12 * r;
|
|
||||||
// p.t21 = t21 * r;
|
|
||||||
// p.t22 = t22 * r;
|
|
||||||
// return p;
|
|
||||||
// }
|
|
||||||
// T t11, t12, t21, t22;
|
|
||||||
//};
|
|
||||||
|
|
||||||
#endif // TPARAM_H
|
#endif // TPARAM_H
|
||||||
|
@ -212,10 +212,10 @@ void Math::DFTThread::run()
|
|||||||
dft.data.clear();
|
dft.data.clear();
|
||||||
int DCbin = timeDomain.size() / 2, startBin = 0;
|
int DCbin = timeDomain.size() / 2, startBin = 0;
|
||||||
if(DC > 0) {
|
if(DC > 0) {
|
||||||
dft.data.resize(timeDomain.size());
|
dft.data.resize(timeDomain.size(), TraceMath::Data());
|
||||||
} else {
|
} else {
|
||||||
startBin = (timeDomain.size()+1) / 2;
|
startBin = (timeDomain.size()+1) / 2;
|
||||||
dft.data.resize(timeDomain.size()/2);
|
dft.data.resize(timeDomain.size()/2, TraceMath::Data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// reverse effect of frequency domain window function from TDR (if available)
|
// reverse effect of frequency domain window function from TDR (if available)
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
public:
|
public:
|
||||||
Data() : x(){}
|
Data() : x(0){}
|
||||||
double x;
|
double x;
|
||||||
std::complex<double> y;
|
std::complex<double> y;
|
||||||
};
|
};
|
||||||
|
@ -825,13 +825,13 @@ void EyeDiagramPlot::updateThread(unsigned int xSamples)
|
|||||||
|
|
||||||
setStatus("Generating PRBS sequence...");
|
setStatus("Generating PRBS sequence...");
|
||||||
|
|
||||||
auto prbs = new PRBS(patternbits);
|
auto prbs = PRBS(patternbits);
|
||||||
|
|
||||||
auto getNextLevel = [&]() -> unsigned int {
|
auto getNextLevel = [&]() -> unsigned int {
|
||||||
unsigned int level = 0;
|
unsigned int level = 0;
|
||||||
for(unsigned int i=0;i<bitsPerSymbol;i++) {
|
for(unsigned int i=0;i<bitsPerSymbol;i++) {
|
||||||
level <<= 1;
|
level <<= 1;
|
||||||
if(prbs->next()) {
|
if(prbs.next()) {
|
||||||
level |= 0x01;
|
level |= 0x01;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,25 +289,25 @@ void TracePlot::finishContextMenu()
|
|||||||
contextmenu->addSeparator();
|
contextmenu->addSeparator();
|
||||||
if(parentTile) {
|
if(parentTile) {
|
||||||
auto add = new QMenu("Add tile...", contextmenu);
|
auto add = new QMenu("Add tile...", contextmenu);
|
||||||
auto left = new QAction("to the left");
|
auto left = new QAction("to the left", contextmenu);
|
||||||
connect(left, &QAction::triggered, [=](){
|
connect(left, &QAction::triggered, [=](){
|
||||||
// split, keep current graph on the right
|
// split, keep current graph on the right
|
||||||
parentTile->splitHorizontally(true);
|
parentTile->splitHorizontally(true);
|
||||||
});
|
});
|
||||||
add->addAction(left);
|
add->addAction(left);
|
||||||
auto right = new QAction("to the right");
|
auto right = new QAction("to the right", contextmenu);
|
||||||
connect(right, &QAction::triggered, [=](){
|
connect(right, &QAction::triggered, [=](){
|
||||||
// split, keep current graph on the left
|
// split, keep current graph on the left
|
||||||
parentTile->splitHorizontally(false);
|
parentTile->splitHorizontally(false);
|
||||||
});
|
});
|
||||||
add->addAction(right);
|
add->addAction(right);
|
||||||
auto above = new QAction("above");
|
auto above = new QAction("above", contextmenu);
|
||||||
connect(above, &QAction::triggered, [=](){
|
connect(above, &QAction::triggered, [=](){
|
||||||
// split, keep current graph on the bottom
|
// split, keep current graph on the bottom
|
||||||
parentTile->splitVertically(true);
|
parentTile->splitVertically(true);
|
||||||
});
|
});
|
||||||
add->addAction(above);
|
add->addAction(above);
|
||||||
auto below = new QAction("below");
|
auto below = new QAction("below", contextmenu);
|
||||||
connect(below, &QAction::triggered, [=](){
|
connect(below, &QAction::triggered, [=](){
|
||||||
// split, keep current graph on the top
|
// split, keep current graph on the top
|
||||||
parentTile->splitVertically(false);
|
parentTile->splitVertically(false);
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
ModeHandler::ModeHandler(AppWindow *aw):
|
ModeHandler::ModeHandler(AppWindow *aw):
|
||||||
QObject(),
|
QObject(),
|
||||||
aw(aw)
|
currentModeIndex(0),
|
||||||
|
aw(aw),
|
||||||
|
activeMode(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void ModeHandler::shutdown()
|
void ModeHandler::shutdown()
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
int createMode(Mode *mode);
|
int createMode(Mode *mode);
|
||||||
Mode *createNew(AppWindow *window, QString name, Mode::Type t);
|
Mode *createNew(AppWindow *window, QString name, Mode::Type t);
|
||||||
AppWindow *aw;
|
AppWindow *aw;
|
||||||
Mode *activeMode = nullptr;
|
Mode *activeMode;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setStatusBarMessageChanged(const QString &msg);
|
void setStatusBarMessageChanged(const QString &msg);
|
||||||
|
@ -10,6 +10,6 @@ namespace Unit
|
|||||||
// prefixed need to be in ascending order (e.g. "m kMG" is okay, whjle "MkG" does not work)
|
// prefixed need to be in ascending order (e.g. "m kMG" is okay, whjle "MkG" does not work)
|
||||||
QString ToString(double value, QString unit = QString(), QString prefixes = " ", int precision = 6);
|
QString ToString(double value, QString unit = QString(), QString prefixes = " ", int precision = 6);
|
||||||
double SIPrefixToFactor(char prefix);
|
double SIPrefixToFactor(char prefix);
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif // UNIT_H
|
#endif // UNIT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user