Bugfix: use correct time/distance data when changing X scale
This commit is contained in:
parent
32270dc747
commit
8d71cd6541
@ -43,7 +43,6 @@ void Generator::updateDevice()
|
|||||||
// can't update if not connected
|
// can't update if not connected
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO comment in once status is filled with valid values
|
|
||||||
Protocol::PacketInfo p;
|
Protocol::PacketInfo p;
|
||||||
p.type = Protocol::PacketType::Generator;
|
p.type = Protocol::PacketType::Generator;
|
||||||
p.generator = central->getDeviceStatus();
|
p.generator = central->getDeviceStatus();
|
||||||
|
@ -56,10 +56,10 @@ static double TimeAxisTransformation(TraceXYPlot::YAxisType type, Trace *t, int
|
|||||||
|
|
||||||
class QwtTraceSeries : public QwtSeriesData<QPointF> {
|
class QwtTraceSeries : public QwtSeriesData<QPointF> {
|
||||||
public:
|
public:
|
||||||
QwtTraceSeries(Trace &t, TraceXYPlot::YAxisType Ytype, TraceXYPlot::XAxisType Xtype)
|
QwtTraceSeries(Trace &t, TraceXYPlot::YAxisType Ytype, const TraceXYPlot *plot)
|
||||||
: QwtSeriesData<QPointF>(),
|
: QwtSeriesData<QPointF>(),
|
||||||
Ytype(Ytype),
|
Ytype(Ytype),
|
||||||
Xtype(Xtype),
|
plot(plot),
|
||||||
t(t){}
|
t(t){}
|
||||||
size_t size() const override {
|
size_t size() const override {
|
||||||
switch(Ytype) {
|
switch(Ytype) {
|
||||||
@ -91,7 +91,7 @@ public:
|
|||||||
case TraceXYPlot::YAxisType::Impedance: {
|
case TraceXYPlot::YAxisType::Impedance: {
|
||||||
auto sample = t.getTDR()[i];
|
auto sample = t.getTDR()[i];
|
||||||
QPointF p;
|
QPointF p;
|
||||||
if(Xtype == TraceXYPlot::XAxisType::Time) {
|
if(plot->XAxis.type == TraceXYPlot::XAxisType::Time) {
|
||||||
p.setX(sample.time);
|
p.setX(sample.time);
|
||||||
} else {
|
} else {
|
||||||
p.setX(sample.distance);
|
p.setX(sample.distance);
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TraceXYPlot::YAxisType Ytype;
|
TraceXYPlot::YAxisType Ytype;
|
||||||
TraceXYPlot::XAxisType Xtype;
|
const TraceXYPlot *plot;
|
||||||
Trace &t;
|
Trace &t;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -499,20 +499,19 @@ void TraceXYPlot::updateXAxis()
|
|||||||
}
|
}
|
||||||
auto div_step = max_div_step * decimals_shift;
|
auto div_step = max_div_step * decimals_shift;
|
||||||
// round min up to next multiple of div_step
|
// 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<double> tickList;
|
QList<double> tickList;
|
||||||
for(double tick = min;tick <= max;tick += div_step) {
|
for(double tick = start_div;tick <= max;tick += div_step) {
|
||||||
tickList.append(tick);
|
tickList.append(tick);
|
||||||
}
|
}
|
||||||
QwtScaleDiv scalediv(min, max, QList<double>(), QList<double>(), tickList);
|
QwtScaleDiv scalediv(min, max, QList<double>(), QList<double>(), tickList);
|
||||||
plot->setAxisScaleDiv(QwtPlot::xBottom, scalediv);
|
plot->setAxisScaleDiv(QwtPlot::xBottom, scalediv);
|
||||||
}
|
}
|
||||||
triggerReplot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QwtSeriesData<QPointF> *TraceXYPlot::createQwtSeriesData(Trace &t, int axis)
|
QwtSeriesData<QPointF> *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)
|
void TraceXYPlot::traceColorChanged(Trace *t)
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
class TraceXYPlot : public TracePlot
|
class TraceXYPlot : public TracePlot
|
||||||
{
|
{
|
||||||
friend class XYplotAxisDialog;
|
friend class XYplotAxisDialog;
|
||||||
|
friend class QwtTraceSeries;
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TraceXYPlot(TraceModel &model, QWidget *parent = nullptr);
|
TraceXYPlot(TraceModel &model, QWidget *parent = nullptr);
|
||||||
|
@ -528,7 +528,6 @@ void VNA::SpanZoomOut()
|
|||||||
|
|
||||||
void VNA::SetSourceLevel(double level)
|
void VNA::SetSourceLevel(double level)
|
||||||
{
|
{
|
||||||
// TODO remove hardcoded limits
|
|
||||||
if(level > Device::Limits().cdbm_max / 100.0) {
|
if(level > Device::Limits().cdbm_max / 100.0) {
|
||||||
level = Device::Limits().cdbm_max / 100.0;
|
level = Device::Limits().cdbm_max / 100.0;
|
||||||
} else if(level < Device::Limits().cdbm_min / 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)
|
void VNA::SetPoints(unsigned int points)
|
||||||
{
|
{
|
||||||
// TODO remove hardcoded limits
|
if (points < 2) {
|
||||||
if (points < 1) {
|
points = 2;
|
||||||
points = 1;
|
|
||||||
} else if(points > Device::Limits().maxPoints) {
|
} else if(points > Device::Limits().maxPoints) {
|
||||||
points = Device::Limits().maxPoints;
|
points = Device::Limits().maxPoints;
|
||||||
}
|
}
|
||||||
@ -611,7 +609,6 @@ void VNA::ApplyCalibration(Calibration::Type type)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not all required traces available
|
// 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.");
|
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);
|
DisableCalibration(true);
|
||||||
StartCalibrationDialog(type);
|
StartCalibrationDialog(type);
|
||||||
|
Loading…
Reference in New Issue
Block a user