only load default calibration when connecting to device
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_15 (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 2026-02-11 15:06:17 +01:00
parent bf028e2d21
commit 1615bb419a
2 changed files with 20 additions and 8 deletions

View file

@ -804,17 +804,26 @@ void VNA::initializeDevice()
QSettings s;
auto key = "DefaultCalibration"+window->getDevice()->getSerial();
if (s.contains(key)) {
auto filename = s.value(key).toString();
qDebug() << "Attempting to load default calibration file " << filename;
if(QFile::exists(filename)) {
if(cal.fromFile(filename)) {
qDebug() << "Calibration successful from " << filename;
// only load default calibration once per device. This allows the user to switch to a different calibration
// and have it persist across device initializations. Only when connecting to the device again should the
// default calibration be loaded
if(defaultCalSerial != window->getDevice()->getSerial()) {
// we have never loaded the default calibration for this device, do so now
auto filename = s.value(key).toString();
qDebug() << "Attempting to load default calibration file " << filename;
if(QFile::exists(filename)) {
if(cal.fromFile(filename)) {
qDebug() << "Calibration successful from " << filename;
defaultCalSerial = window->getDevice()->getSerial();
} else {
qDebug() << "Calibration not successfull from: " << filename;
}
} else {
qDebug() << "Calibration not successfull from: " << filename;
qDebug() << "Calibration file not found: " << filename;
}
} else {
qDebug() << "Calibration file not found: " << filename;
}
removeDefaultCal->setEnabled(true);
} else {
qDebug() << "No default calibration file set for this device";
@ -833,6 +842,8 @@ void VNA::initializeDevice()
void VNA::deviceDisconnected()
{
defaultCalMenu->setEnabled(false);
qDebug() << "disconnected";
defaultCalSerial.clear();
emit sweepStopped();
}

View file

@ -180,6 +180,7 @@ private:
QMenu *defaultCalMenu;
QAction *assignDefaultCal, *removeDefaultCal;
QString defaultCalSerial;
QAction *saveCal;
Deembedding deembedding;