save setting for each digitizer before run

This commit is contained in:
Ryan Tang 2024-02-26 16:17:41 -05:00
parent 08b7a60ec2
commit 3039a20f61
3 changed files with 15 additions and 3 deletions

View File

@ -1056,6 +1056,17 @@ void Digitizer::SaveSettingToFile(Reg registerAddress, unsigned int value, unsig
}
void Digitizer::SaveAllSettingsAsBin(std::string fileName){
SaveAllSettingsAsTextForRun(fileName);
if( !isSettingFilledinMemeory ) return;
settingFileName = fileName;
isSettingFileExist = true;
}
void Digitizer::SaveAllSettingsAsTextForRun (std::string fileName){
if( !isSettingFilledinMemeory ) return;
FILE * binFile = fopen(fileName.c_str(), "w+");
@ -1070,9 +1081,6 @@ void Digitizer::SaveAllSettingsAsBin(std::string fileName){
printf("Created file : %s. file size : %d Byte\n", fileName.c_str(), inFileSize);
fclose (binFile);
settingFileName = fileName;
isSettingFileExist = true;
}
void Digitizer::SaveAllSettingsAsText(std::string fileName){

View File

@ -156,6 +156,7 @@ class Digitizer{
/// memory <--> file
void SaveAllSettingsAsText (std::string fileName);
void SaveAllSettingsAsTextForRun (std::string fileName);
void SaveAllSettingsAsBin (std::string fileName);
std::string GetSettingFileName() {return settingFileName;}
/// tell the digitizer where to look at the setting file.

View File

@ -1044,6 +1044,9 @@ void MainWindow::StartACQ(){
for( int i = (int) nDigi-1; i >= 0 ; i--){
if( digi[i]->IsBoardDisabled() ) continue;
if( chkSaveData->isChecked() ) {
std::string runSettingName = (rawDataPath + "/" + prefix + "_" + QString::number(runID).rightJustified(3, '0') + "_" + QString::number(digi[i]->GetSerialNumber())).toStdString();
runSettingName += "_" + digi[i]->GetData()->DPPTypeStr + ".bin";
digi[i]->SaveAllSettingsAsTextForRun(runSettingName);
if( digi[i]->GetData()->OpenSaveFile((rawDataPath + "/" + prefix + "_" + QString::number(runID).rightJustified(3, '0')).toStdString()) == false ) {
LogMsg("Cannot open save file : " + QString::fromStdString(digi[i]->GetData()->GetOutFileName() ) + ". Probably read-only?");
continue;