Skip to content

Commit

Permalink
Add YAxis: impedance and enable log option
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Apr 16, 2024
1 parent 124feb5 commit cdfe95a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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 ";
Expand Down Expand Up @@ -337,6 +342,7 @@ std::set<YAxis::Type> 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);
Expand Down
1 change: 1 addition & 0 deletions Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class YAxis : public Axis {
Real,
Imaginary,
// derived parameter options
AbsImpedance,
SeriesR,
Reactance,
Capacitance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :

// Setup GUI connections
connect(ui->Y1type, qOverload<int>(&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();
Expand All @@ -74,7 +74,7 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :
});

connect(ui->Y2type, qOverload<int>(&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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<item>
<widget class="QRadioButton" name="Y1log">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Log</string>
Expand Down Expand Up @@ -204,7 +204,7 @@
<item>
<widget class="QRadioButton" name="Y2log">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Log</string>
Expand Down Expand Up @@ -592,8 +592,8 @@
</connection>
</connections>
<buttongroups>
<buttongroup name="Xgroup"/>
<buttongroup name="Y1group"/>
<buttongroup name="Xgroup"/>
<buttongroup name="Y2group"/>
</buttongroups>
</ui>

0 comments on commit cdfe95a

Please sign in to comment.