diff --git a/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp b/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp index 63d2cb6..2046f63 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp @@ -818,7 +818,7 @@ VirtualDevice::Info::Info() .maxIFBW = 1000000, .maxPoints = 10000, .mindBm = -100, - .maxdBm = 100, + .maxdBm = 30, .minRBW = 1, .maxRBW = 1000000, }; diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp index 76f4f1b..d00f8a2 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp @@ -546,7 +546,7 @@ void EyeDiagramPlot::draw(QPainter &p) auto tickValue = Unit::ToString(t, unit, prefixes, significantDigits); p.setPen(QPen(pref.Graphs.Color.axis, 1)); QRect bounding; - p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*2, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*4, + p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); lastTickLabelEnd = bounding.x() + bounding.width(); } diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp index 716b20f..07fcd8b 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.cpp @@ -474,6 +474,33 @@ double XAxis::sampleToCoordinate(Trace::Data data, Trace *t, unsigned int sample void XAxis::set(Type type, bool log, bool autorange, double min, double max, double div) { + if(max <= min) { + auto info = VirtualDevice::getInfo(VirtualDevice::getConnected()); + // invalid selection, use default instead + switch(type) { + case Type::Frequency: + min = info.Limits.minFreq; + max = info.Limits.maxFreq; + break; + case Type::Power: + min = info.Limits.mindBm; + max = info.Limits.maxdBm; + break; + case Type::Time: + case Type::TimeZeroSpan: + min = 0.0; + max = 1.0; + break; + case Type::Distance: + min = 0.0; + max = 0.01; + break; + default: + min = 0.0; + max = 1.0; + break; + } + } this->type = type; this->log = log; this->autorange = autorange; diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/tracewaterfall.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/tracewaterfall.cpp index 1e0425e..22922e8 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/tracewaterfall.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/tracewaterfall.cpp @@ -328,7 +328,7 @@ void TraceWaterfall::draw(QPainter &p) p.setPen(QPen(pref.Graphs.Color.axis, 1)); if(displayFullFreq) { QRect bounding; - p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*2, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*4, + p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); lastTickLabelEnd = bounding.x() + bounding.width(); } else { @@ -340,7 +340,7 @@ void TraceWaterfall::draw(QPainter &p) tickValue.remove(0, tickValue.size() - displayLastDigits - unit.length()); QRect bounding; - p.drawText(QRect(xCoord - 40, plotAreaBottom + 5, 80, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); + p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); lastTickLabelEnd = bounding.x() + bounding.width(); p.setPen(QPen(QColor("orange"))); p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, pref.Graphs.fontSizeAxis), Qt::AlignRight, "..", &bounding); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp index acc6b82..d0ea87b 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp @@ -279,6 +279,8 @@ int TraceXYPlot::sideMargin(bool YAxisEnabled) void TraceXYPlot::axisSetupDialog() { auto setup = new XYplotAxisDialog(this); + setup->setAttribute(Qt::WA_DeleteOnClose); + connect(setup, &QDialog::finished, this, &TraceXYPlot::updateAxisTicks); if(AppWindow::showGUI()) { setup->show(); } @@ -691,7 +693,7 @@ void TraceXYPlot::draw(QPainter &p) p.setPen(QPen(pref.Graphs.Color.axis, 1)); if(displayFullFreq) { QRect bounding; - p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*2, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*4, + p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); lastTickLabelEnd = bounding.x() + bounding.width(); } else { @@ -703,7 +705,7 @@ void TraceXYPlot::draw(QPainter &p) tickValue.remove(0, tickValue.size() - displayLastDigits - unit.length()); QRect bounding; - p.drawText(QRect(xCoord - 40, plotAreaBottom + 5, 80, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); + p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding); lastTickLabelEnd = bounding.x() + bounding.width(); p.setPen(QPen(QColor("orange"))); p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, pref.Graphs.fontSizeAxis), Qt::AlignRight, "..", &bounding); @@ -823,9 +825,7 @@ void TraceXYPlot::updateAxisTicks() } } } - if(min < max) { - xAxis.set(xAxis.getType(), xAxis.getLog(), true, min, max, 0); - } + xAxis.set(xAxis.getType(), xAxis.getLog(), true, min, max, 0); } for(int i=0;i<2;i++) { diff --git a/Software/PC_Application/LibreVNA-GUI/usersjanappdatalocaltemptmp8qcgdn b/Software/PC_Application/LibreVNA-GUI/usersjanappdatalocaltemptmp8qcgdn new file mode 100644 index 0000000..e69de29