initialize new plots with the correct span
Some checks failed
Build / PC_Application_Ubuntu (push) Has been cancelled
Build / PC_Application_RPi5 (push) Has been cancelled
Build / PC_Application_Windows (push) Has been cancelled
Build / PC_Application_OSX (push) Has been cancelled
Build / PC_Application_OSX_13 (push) Has been cancelled
Build / Embedded_Firmware (push) Has been cancelled
HIL_Tests / Get_Repository (push) Has been cancelled
Unit_Tests / Tests (push) Has been cancelled
HIL_Tests / PC_Application_RPi5 (push) Has been cancelled
HIL_Tests / Embedded_Firmware (push) Has been cancelled
HIL_Tests / HIL (push) Has been cancelled

This commit is contained in:
Jan Käberich 2025-10-31 15:42:42 +01:00
parent 7acb847a2b
commit d77215aecb
6 changed files with 19 additions and 6 deletions

View file

@ -914,7 +914,7 @@ void SpectrumAnalyzer::ConfigureDevice()
average.reset(DeviceDriver::SApoints());
UpdateAverageCount();
traceModel.clearLiveData();
emit traceModel.SpanChanged(settings.freqStart, settings.freqStop);
traceModel.setSpan(settings.freqStart, settings.freqStop);
} else {
if(window->getDevice()) {
changingSettings = true;

View file

@ -9,6 +9,8 @@ using namespace std;
TraceModel::TraceModel(QObject *parent)
: QAbstractTableModel(parent)
{
spanFmin = 0.0;
spanFmax = 6000000000.0;
traces.clear();
source = DataSource::Unknown;
lastSweepPosition = 0.0;
@ -368,6 +370,13 @@ double TraceModel::getSweepPosition() const
}
}
void TraceModel::setSpan(double fmin, double fmax)
{
spanFmin = fmin;
spanFmax = fmax;
emit SpanChanged(fmin, fmax);
}
MarkerModel *TraceModel::getMarkerModel() const
{
return markerModel;

View file

@ -62,6 +62,10 @@ public:
double getSweepPosition() const;
void setSpan(double fmin, double fmax);
double getSpanStart() {return spanFmin;}
double getSpanStop() {return spanFmax;}
signals:
void SpanChanged(double fmin, double fmax);
void traceAdded(Trace *t);
@ -80,6 +84,8 @@ private:
QDateTime lastReceivedData;
std::vector<Trace*> traces;
MarkerModel *markerModel;
double spanFmin, spanFmax;
};
#endif // TRACEMODEL_H

View file

@ -42,8 +42,7 @@ TracePlot::TracePlot(TraceModel &model, QWidget *parent)
lastUpdate = QTime::currentTime();
replotTimer.setSingleShot(true);
connect(&replotTimer, &QTimer::timeout, this, qOverload<>(&TracePlot::update));
sweep_fmin = std::numeric_limits<double>::lowest();
sweep_fmax = std::numeric_limits<double>::max();
TracePlot::updateSpan(model.getSpanStart(), model.getSpanStop());
xSweep = std::numeric_limits<double>::quiet_NaN();
// get notified when the span changes
connect(&model, &TraceModel::SpanChanged, this, qOverload<double, double>(&TracePlot::updateSpan));

View file

@ -29,8 +29,7 @@ TraceXYPlot::TraceXYPlot(TraceModel &model, QWidget *parent)
// Setup default axis
setYAxis(0, YAxis::Type::Magnitude, false, false, YAxis::getDefaultLimitMin(YAxis::Type::Magnitude), YAxis::getDefaultLimitMax(YAxis::Type::Magnitude), 14, true);
setYAxis(1, YAxis::Type::Phase, false, false, YAxis::getDefaultLimitMin(YAxis::Type::Phase), YAxis::getDefaultLimitMax(YAxis::Type::Phase), 12, true);
// enable autoscaling and set for full span (no information about actual span available yet)
updateSpan(0, 6000000000);
setXAxis(XAxis::Type::Frequency, XAxisMode::UseSpan, false, 0, 6000000000, 10, true);
initializeTraceInfo();
}

View file

@ -1961,7 +1961,7 @@ void VNA::ConfigureDevice(bool resetTraces, std::function<void(bool)> cb)
double start = settings.sweepType == SweepType::Frequency ? settings.Freq.start : settings.Power.start;
double stop = settings.sweepType == SweepType::Frequency ? settings.Freq.stop : settings.Power.stop;
int npoints = settings.npoints;
emit traceModel.SpanChanged(start, stop);
traceModel.setSpan(start, stop);
if (settings.segments > 1) {
// more than one segment, adjust start/stop
npoints = ceil((double) settings.npoints / settings.segments);