From cdfe95af17f4042a926c257e7cf1c115edd8e71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Tue, 16 Apr 2024 18:56:26 +0200 Subject: [PATCH] Add YAxis: impedance and enable log option --- Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp | 6 ++++++ Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h | 1 + .../PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.cpp | 4 ++-- .../PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.ui | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp index 0d3541c8..2af7051c 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp @@ -108,6 +108,8 @@ double YAxis::sampleToCoordinate(Trace::Data data, Trace *t, unsigned int sample return data.y.real(); case YAxis::Type::Imaginary: return data.y.imag(); + case YAxis::Type::AbsImpedance: + return abs(Util::SparamToImpedance(data.y, t->getReferenceImpedance())); case YAxis::Type::SeriesR: return Util::SparamToResistance(data.y, t->getReferenceImpedance()); case YAxis::Type::Reactance: @@ -201,6 +203,7 @@ QString YAxis::TypeToName(Type type) case Type::VSWR: return "VSWR"; case Type::Real: return "Real"; case Type::Imaginary: return "Imaginary"; + case Type::AbsImpedance: return "Impedance (absolute)"; case Type::SeriesR: return "Resistance"; case Type::Reactance: return "Reactance"; case Type::Capacitance: return "Capacitance"; @@ -247,6 +250,7 @@ QString YAxis::Unit(Type type, TraceModel::DataSource source) case Type::Imaginary: case Type::QualityFactor: return ""; + case Type::AbsImpedance: return "Ω"; case Type::SeriesR: return "Ω"; case Type::Reactance: return "Ω"; case Type::Capacitance: return "F"; @@ -281,6 +285,7 @@ QString YAxis::Prefixes(Type type, TraceModel::DataSource source) case Type::Real: return "pnum "; case Type::Imaginary: return "pnum "; case Type::QualityFactor: return " "; + case Type::AbsImpedance: return " "; case Type::SeriesR: return "m kM"; case Type::Reactance: return "m kM"; case Type::Capacitance: return "pnum "; @@ -337,6 +342,7 @@ std::set YAxis::getSupported(XAxis::Type type, TraceModel::DataSour ret.insert(YAxis::Type::VSWR); ret.insert(YAxis::Type::Real); ret.insert(YAxis::Type::Imaginary); + ret.insert(YAxis::Type::AbsImpedance); ret.insert(YAxis::Type::SeriesR); ret.insert(YAxis::Type::Reactance); ret.insert(YAxis::Type::Capacitance); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h index 93346646..dfde29a9 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h +++ b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h @@ -71,6 +71,7 @@ class YAxis : public Axis { Real, Imaginary, // derived parameter options + AbsImpedance, SeriesR, Reactance, Capacitance, diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.cpp index 37dabf0f..8438509d 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.cpp @@ -50,7 +50,7 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) : // Setup GUI connections connect(ui->Y1type, qOverload(&QComboBox::currentIndexChanged), [=](int index) { - //ui->Y1log->setEnabled(index != 0); + ui->Y1log->setEnabled(index != 0); ui->Y1linear->setEnabled(index != 0); ui->Y1auto->setEnabled(index != 0); bool autoRange = ui->Y1auto->isChecked(); @@ -74,7 +74,7 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) : }); connect(ui->Y2type, qOverload(&QComboBox::currentIndexChanged), [=](int index) { - //ui->Y2log->setEnabled(index != 0); + ui->Y2log->setEnabled(index != 0); ui->Y2linear->setEnabled(index != 0); ui->Y2auto->setEnabled(index != 0); bool autoRange = ui->Y2auto->isChecked(); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.ui b/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.ui index 15b7dc50..b8e2ba7b 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.ui +++ b/Software/PC_Application/LibreVNA-GUI/Traces/xyplotaxisdialog.ui @@ -75,7 +75,7 @@ - false + true Log @@ -204,7 +204,7 @@ - false + true Log @@ -592,8 +592,8 @@ - +