diff --git a/Software/PC_Application/Generator/generator.cpp b/Software/PC_Application/Generator/generator.cpp index 7a46bbf..0f66e4a 100644 --- a/Software/PC_Application/Generator/generator.cpp +++ b/Software/PC_Application/Generator/generator.cpp @@ -43,7 +43,6 @@ void Generator::updateDevice() // can't update if not connected return; } - // TODO comment in once status is filled with valid values Protocol::PacketInfo p; p.type = Protocol::PacketType::Generator; p.generator = central->getDeviceStatus(); diff --git a/Software/PC_Application/Traces/tracexyplot.cpp b/Software/PC_Application/Traces/tracexyplot.cpp index f5aa5f2..4571bbe 100644 --- a/Software/PC_Application/Traces/tracexyplot.cpp +++ b/Software/PC_Application/Traces/tracexyplot.cpp @@ -56,10 +56,10 @@ static double TimeAxisTransformation(TraceXYPlot::YAxisType type, Trace *t, int class QwtTraceSeries : public QwtSeriesData { public: - QwtTraceSeries(Trace &t, TraceXYPlot::YAxisType Ytype, TraceXYPlot::XAxisType Xtype) + QwtTraceSeries(Trace &t, TraceXYPlot::YAxisType Ytype, const TraceXYPlot *plot) : QwtSeriesData(), Ytype(Ytype), - Xtype(Xtype), + plot(plot), t(t){} size_t size() const override { switch(Ytype) { @@ -91,7 +91,7 @@ public: case TraceXYPlot::YAxisType::Impedance: { auto sample = t.getTDR()[i]; QPointF p; - if(Xtype == TraceXYPlot::XAxisType::Time) { + if(plot->XAxis.type == TraceXYPlot::XAxisType::Time) { p.setX(sample.time); } else { p.setX(sample.distance); @@ -110,7 +110,7 @@ public: private: TraceXYPlot::YAxisType Ytype; - TraceXYPlot::XAxisType Xtype; + const TraceXYPlot *plot; Trace &t; }; @@ -499,20 +499,19 @@ void TraceXYPlot::updateXAxis() } auto div_step = max_div_step * decimals_shift; // round min up to next multiple of div_step - min = ceil(min / div_step) * div_step; + auto start_div = ceil(min / div_step) * div_step; QList tickList; - for(double tick = min;tick <= max;tick += div_step) { + for(double tick = start_div;tick <= max;tick += div_step) { tickList.append(tick); } QwtScaleDiv scalediv(min, max, QList(), QList(), tickList); plot->setAxisScaleDiv(QwtPlot::xBottom, scalediv); } - triggerReplot(); } QwtSeriesData *TraceXYPlot::createQwtSeriesData(Trace &t, int axis) { - return new QwtTraceSeries(t, YAxis[axis].type, XAxis.type); + return new QwtTraceSeries(t, YAxis[axis].type, this); } void TraceXYPlot::traceColorChanged(Trace *t) diff --git a/Software/PC_Application/Traces/tracexyplot.h b/Software/PC_Application/Traces/tracexyplot.h index 1846fd0..709254c 100644 --- a/Software/PC_Application/Traces/tracexyplot.h +++ b/Software/PC_Application/Traces/tracexyplot.h @@ -27,6 +27,7 @@ public: class TraceXYPlot : public TracePlot { friend class XYplotAxisDialog; + friend class QwtTraceSeries; Q_OBJECT public: TraceXYPlot(TraceModel &model, QWidget *parent = nullptr); diff --git a/Software/PC_Application/VNA/vna.cpp b/Software/PC_Application/VNA/vna.cpp index 43de246..faa07d0 100644 --- a/Software/PC_Application/VNA/vna.cpp +++ b/Software/PC_Application/VNA/vna.cpp @@ -528,7 +528,6 @@ void VNA::SpanZoomOut() void VNA::SetSourceLevel(double level) { - // TODO remove hardcoded limits if(level > Device::Limits().cdbm_max / 100.0) { level = Device::Limits().cdbm_max / 100.0; } else if(level < Device::Limits().cdbm_min / 100.0) { @@ -541,9 +540,8 @@ void VNA::SetSourceLevel(double level) void VNA::SetPoints(unsigned int points) { - // TODO remove hardcoded limits - if (points < 1) { - points = 1; + if (points < 2) { + points = 2; } else if(points > Device::Limits().maxPoints) { points = Device::Limits().maxPoints; } @@ -611,7 +609,6 @@ void VNA::ApplyCalibration(Calibration::Type type) } } else { // Not all required traces available - // TODO start tracedata dialog with required traces QMessageBox::information(window, "Missing calibration traces", "Not all calibration traces for this type of calibration have been measured. The calibration can be enabled after the missing traces have been acquired."); DisableCalibration(true); StartCalibrationDialog(type);