Skip to content

Commit

Permalink
Fix segmented sweep
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Oct 23, 2023
1 parent 5a78091 commit 59f3057
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ VNA::VNA(AppWindow *window, QString name)

configurationTimer.setSingleShot(true);
connect(&configurationTimer, &QTimer::timeout, this, [=](){
ConfigureDevice();
ConfigureDevice(configurationTimerResetTraces);
});

// Create default traces
Expand Down Expand Up @@ -725,7 +725,7 @@ void VNA::initializeDevice()
}
// Configure initial state of device
ConstrainAndUpdateFrequencies();
SettingsChanged();
SettingsChanged(true);
emit deviceInitialized();
if(window->getDevice() && !cal.validForDevice(window->getDevice()->getSerial())) {
InformationBox::ShowMessage("Invalid calibration", "The current calibration was created for a different device. You can still use it but the resulting "
Expand Down Expand Up @@ -940,13 +940,12 @@ void VNA::NewDatapoint(DeviceDriver::VNAMeasurement m)
lastPoint = m_avg.pointNum;

if (needsSegmentUpdate) {
changingSettings = true;
if( settings.activeSegment < settings.segments - 1) {
settings.activeSegment++;
} else {
settings.activeSegment = 0;
}
SettingsChanged();
SettingsChanged(false);
}
}

Expand All @@ -955,11 +954,14 @@ void VNA::UpdateAverageCount()
lAverages->setText(QString::number(average.getLevel()) + "/");
}

void VNA::SettingsChanged()
void VNA::SettingsChanged(bool resetTraces)
{
configurationTimer.start(100);
changingSettings = true;
ResetLiveTraces();
configurationTimerResetTraces = resetTraces;
if(resetTraces) {
ResetLiveTraces();
}
}

void VNA::StartImpedanceMatching()
Expand Down
3 changes: 2 additions & 1 deletion Software/PC_Application/LibreVNA-GUI/VNA/vna.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private slots:
bool CalibrationMeasurementActive() { return calWaitFirst || calMeasuring; }
void SetupSCPI();
void UpdateAverageCount();
void SettingsChanged();
void SettingsChanged(bool resetTraces = true);
void ConstrainAndUpdateFrequencies();
void LoadSweepSettings();
void StoreSweepSettings();
Expand All @@ -143,6 +143,7 @@ private slots:
bool singleSweep;
bool running;
QTimer configurationTimer;
bool configurationTimerResetTraces;

// Calibration
Calibration cal;
Expand Down

0 comments on commit 59f3057

Please sign in to comment.