In setting panel, change save setting as text to a checkbox for update setting
This commit is contained in:
parent
14c2ceab6c
commit
c0e6d7ae9a
|
@ -38,7 +38,8 @@ void Digitizer::Initalization(){
|
|||
|
||||
isSettingFilledinMemeory = false;
|
||||
settingFileName = "";
|
||||
settingFileExist = false;
|
||||
isSettingFileExist = false;
|
||||
isSettingFileCoupled = false;
|
||||
settingFile = NULL;
|
||||
|
||||
ret = -1;
|
||||
|
@ -255,8 +256,8 @@ void Digitizer::SetRegChannelMask(uint32_t mask){
|
|||
if( !isConnected ) return;
|
||||
regChannelMask = mask;
|
||||
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, regChannelMask);
|
||||
SaveSettingToFile(DPP::RegChannelEnableMask, mask);
|
||||
SetSettingToMemory(DPP::RegChannelEnableMask, mask);
|
||||
SaveSettingToFile(DPP::RegChannelEnableMask, mask);
|
||||
ErrorMsg(__func__);
|
||||
}
|
||||
|
||||
|
@ -941,11 +942,11 @@ void Digitizer::SetSettingBinaryPath(std::string fileName){
|
|||
SaveAllSettingsAsBin(fileName);
|
||||
|
||||
this->settingFileName = fileName;
|
||||
settingFileExist = true;
|
||||
isSettingFileExist = true;
|
||||
|
||||
}else{
|
||||
this->settingFileName = fileName;
|
||||
settingFileExist = true;
|
||||
isSettingFileExist = true;
|
||||
fclose(settingFile);
|
||||
printf("setting file already exist. do nothing. Should program the digitizer\n");
|
||||
}
|
||||
|
@ -958,11 +959,11 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){
|
|||
|
||||
if( settingFile == NULL ) {
|
||||
printf(" %s does not exist or cannot load.\n", fileName.c_str());
|
||||
settingFileExist = false;
|
||||
isSettingFileExist = false;
|
||||
return -1;
|
||||
|
||||
}else{
|
||||
settingFileExist = true;
|
||||
isSettingFileExist = true;
|
||||
settingFileName = fileName;
|
||||
fclose (settingFile);
|
||||
|
||||
|
@ -997,7 +998,7 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){
|
|||
}
|
||||
|
||||
unsigned int Digitizer::ReadSettingFromFile(Reg registerAddress, unsigned short ch){
|
||||
if ( !settingFileExist ) return -1;
|
||||
if ( !isSettingFileExist ) return -1;
|
||||
|
||||
unsigned short index = registerAddress.Index(ch);
|
||||
|
||||
|
@ -1018,7 +1019,8 @@ unsigned int Digitizer::ReadSettingFromFile(Reg registerAddress, unsigned short
|
|||
|
||||
void Digitizer::SaveSettingToFile(Reg registerAddress, unsigned int value, unsigned short ch){
|
||||
|
||||
if ( !settingFileExist ) return ;
|
||||
if ( !isSettingFileExist ) return ;
|
||||
if ( !isSettingFileCoupled ) return;
|
||||
|
||||
unsigned short index = registerAddress.Index(ch);
|
||||
setting[index] = value;
|
||||
|
@ -1048,7 +1050,7 @@ void Digitizer::SaveAllSettingsAsBin(std::string fileName){
|
|||
fclose (binFile);
|
||||
|
||||
settingFileName = fileName;
|
||||
settingFileExist = true;
|
||||
isSettingFileExist = true;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ class Digitizer{
|
|||
//^-------- setting
|
||||
std::string settingFileName; ///
|
||||
FILE * settingFile; ///
|
||||
bool settingFileExist; ///
|
||||
bool isSettingFileExist; ///
|
||||
bool isSettingFileCoupled;
|
||||
bool isSettingFilledinMemeory; /// false for disabled ReadAllSettingFromBoard()
|
||||
unsigned int setting[SETTINGSIZE]; /// Setting, 4bytes x 2048 = 8192 bytes
|
||||
|
||||
|
@ -147,8 +148,10 @@ class Digitizer{
|
|||
/// simply read settings from memory
|
||||
void SetSettingToMemory (Reg registerAddress, unsigned int value, unsigned short ch = 0);
|
||||
unsigned int GetSettingFromMemory (Reg registerAddress, unsigned short ch = 0);
|
||||
void PrintSettingFromMemory ();
|
||||
unsigned int * GetSettings() {return setting;};
|
||||
unsigned int * GetSettings() {return setting;}
|
||||
void PrintSettingFromMemory();
|
||||
void SetSettingFileCoupled(bool onOff) {isSettingFileCoupled = onOff;}
|
||||
bool IsSettingFileCoupled() const {return isSettingFileCoupled;}
|
||||
|
||||
/// memory <--> file
|
||||
void SaveAllSettingsAsText (std::string fileName);
|
||||
|
|
|
@ -216,9 +216,17 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
|
|||
buttonLayout->addWidget(bnSaveSettings, rowID, 2);
|
||||
connect(bnSaveSettings, &QPushButton::clicked, this, [=](){ SaveSetting(0);});
|
||||
|
||||
bnSaveSettingsToText = new QPushButton("Save Settings (txt)", this);
|
||||
buttonLayout->addWidget(bnSaveSettingsToText, rowID, 3);
|
||||
connect(bnSaveSettingsToText, &QPushButton::clicked, this, [=](){ SaveSetting(1);});
|
||||
// bnSaveSettingsToText = new QPushButton("Save Settings (txt)", this);
|
||||
// buttonLayout->addWidget(bnSaveSettingsToText, rowID, 3);
|
||||
// connect(bnSaveSettingsToText, &QPushButton::clicked, this, [=](){ SaveSetting(1);});
|
||||
|
||||
//checkBox, to coupled or decouple the setting file.
|
||||
chkCoupledSettingFile = new QCheckBox("Update Bin", this);
|
||||
buttonLayout->addWidget(chkCoupledSettingFile, rowID, 3);
|
||||
chkCoupledSettingFile->setCheckState(Qt::CheckState::Unchecked);
|
||||
connect(chkCoupledSettingFile, &QCheckBox::stateChanged, this, [=](){
|
||||
digi[ID]->SetSettingFileCoupled(chkCoupledSettingFile->isChecked());
|
||||
});
|
||||
}
|
||||
|
||||
{//^======================= Board Settings
|
||||
|
@ -4020,7 +4028,7 @@ void DigiSettingsPanel::SaveSetting(int opt){
|
|||
if( opt == 0 ){
|
||||
if( ext == "") filePath += ".bin";
|
||||
digi[ID]->SaveAllSettingsAsBin(filePath.toStdString().c_str());
|
||||
leSaveFilePath[ID]->setText(filePath + " | dynamic update");
|
||||
leSaveFilePath[ID]->setText(filePath);
|
||||
}
|
||||
if( opt == 1 ){
|
||||
if( ext == "") filePath += ".txt";
|
||||
|
|
|
@ -110,7 +110,8 @@ private:
|
|||
QPushButton * bnSendSoftwareClockSyncSignal;
|
||||
QPushButton * bnSaveSettings;
|
||||
QPushButton * bnLoadSettings;
|
||||
QPushButton * bnSaveSettingsToText;
|
||||
//QPushButton * bnSaveSettingsToText;
|
||||
QCheckBox * chkCoupledSettingFile;
|
||||
|
||||
/// ============================= Board Configure
|
||||
QGridLayout * bdCfgLayout[MaxNDigitizer];
|
||||
|
|
Loading…
Reference in New Issue
Block a user