setting file inlcuded DPP type

This commit is contained in:
Ryan Tang 2024-06-11 14:25:56 -04:00
parent 15493870cf
commit 3e043fa7a0
4 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -5,7 +5,7 @@
#include <CAEN_FELib.h>
#include <cstdlib>
#include <string>
#include <map>
#include <unordered_map>
#include "Hit.h"
@ -66,9 +66,9 @@ class Digitizer2Gen {
Reg VGASetting[4];
Reg InputDelay[16];
std::map<std::string, int> boardMap;
std::map<std::string, int> LVDSMap;
std::map<std::string, int> chMap;
std::unordered_map<std::string, int> boardMap;
std::unordered_map<std::string, int> LVDSMap;
std::unordered_map<std::string, int> chMap;
public:
Digitizer2Gen();

View File

@ -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()) {

View File

@ -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 <b>" + settingFile + "</b> and loading. please wait.");
digi[i]->SetSettingFileName(settingFile.toStdString());