From 3e043fa7a0b2ab343ba57b4b564bc294db10804c Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Tue, 11 Jun 2024 14:25:56 -0400 Subject: [PATCH] setting file inlcuded DPP type --- ClassDigitizer2Gen.cpp | 3 ++- ClassDigitizer2Gen.h | 8 ++++---- digiSettingsPanel.cpp | 7 ++++++- mainwindow.cpp | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ClassDigitizer2Gen.cpp b/ClassDigitizer2Gen.cpp index f8e9ac3..31ea676 100644 --- a/ClassDigitizer2Gen.cpp +++ b/ClassDigitizer2Gen.cpp @@ -1366,6 +1366,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){ FILE * loadFile = fopen(settingFileName.c_str(), "r"); if( loadFile ){ + printf("Opened %s\n", settingFileName.c_str()); char * para = new char[100]; char * readWrite = new char[100]; char * idStr = new char[100]; @@ -1433,7 +1434,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){ return true; }else{ - //printf("Fail to load file %s\n", loadFileName); + printf("Fail to opened %s\n", settingFileName.c_str()); } return false; diff --git a/ClassDigitizer2Gen.h b/ClassDigitizer2Gen.h index 797e38c..fcd32a2 100644 --- a/ClassDigitizer2Gen.h +++ b/ClassDigitizer2Gen.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "Hit.h" @@ -66,9 +66,9 @@ class Digitizer2Gen { Reg VGASetting[4]; Reg InputDelay[16]; - std::map boardMap; - std::map LVDSMap; - std::map chMap; + std::unordered_map boardMap; + std::unordered_map LVDSMap; + std::unordered_map chMap; public: Digitizer2Gen(); diff --git a/digiSettingsPanel.cpp b/digiSettingsPanel.cpp index 70b0aea..d5646db 100644 --- a/digiSettingsPanel.cpp +++ b/digiSettingsPanel.cpp @@ -2414,7 +2414,12 @@ void DigiSettingsPanel::SaveSettings(){ QDir dir(digiSettingPath); if( !dir.exists() ) dir.mkpath("."); - QString filePath = QFileDialog::getSaveFileName(this, "Save Settings File", digiSettingPath, "Data file (*.dat);;Text files (*.txt);;All files (*.*)"); + QString defaultFileName = "setting_" + QString::number(digi[ID]->GetSerialNumber()) + "_" + QString::fromStdString(digi[ID]->GetFPGAType().substr(4)) + ".dat"; + + QString filePath = QFileDialog::getSaveFileName(this, + "Save Settings File", + QDir::toNativeSeparators(digiSettingPath + "/" + defaultFileName), + "Data file (*.dat);;Text files (*.txt);;All files (*.*)"); if (!filePath.isEmpty()) { diff --git a/mainwindow.cpp b/mainwindow.cpp index 92742e5..7e8554b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -721,8 +721,8 @@ void MainWindow::OpenDigitizers(){ readDataThread[i] = new ReadDataThread(digi[i], i, this); connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg); - //*------ search for settings_XXXX.dat - QString settingFile = analysisPath + "/working/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat"; + //*------ search for settings_XXX_YYY.dat, YYY is DPP-type, XXX is serial number + QString settingFile = analysisPath + "/working/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + "_" + QString::fromStdString(digi[i]->GetFPGAType().substr(4)) + ".dat"; if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){ LogMsg("Found setting file " + settingFile + " and loading. please wait."); digi[i]->SetSettingFileName(settingFile.toStdString());