disable digitizer panel button when ACQ started

This commit is contained in:
Ryan Tang 2024-08-23 16:24:17 -04:00
parent bf989d2c72
commit 823adf67eb
4 changed files with 34 additions and 15 deletions

View File

@ -572,14 +572,13 @@ void Digitizer::StartACQ(){
}
AcqRun = true;
data->ClearTriggerRate();
data->ClearData();
if( DPPType == DPPTypeCode::DPP_QDC_CODE ) SetOptimialAggOrg();
printf(" ACQ mode : %s (%d), TRG-OUT mode : %s (%d) \n", acqStr.c_str(), acqID, trgOutStr.c_str(), trgOutID);
AcqRun = true;
usleep(1000); // wait for 1 msec to start/Arm ACQ;
ret = CAEN_DGTZ_SWStartAcquisition(handle);
@ -1372,7 +1371,6 @@ void Digitizer::SetOptimialAggOrg(){
printf(" Record Length (bit) : %u = %u sample = %u ns\n", RecordLen, RecordLen*8, RecordLen*8*16);
printf("==============================================================\n");
int eventSize = 6 + 2 * Ex + traceOn * RecordLen * 8; // sample
printf(" estimated event size : %d sample \n", eventSize);
double maxAggOrg = log2( MemorySizekSample * 1024 / eventSize / EventAgg );

View File

@ -196,9 +196,9 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
{//^======================= Buttons
QWidget * buttonsWidget = new QWidget(tab);
tabLayout_V1->addWidget(buttonsWidget);
QGridLayout * buttonLayout = new QGridLayout(buttonsWidget);
buttonsWidget[iDigi] = new QWidget(tab);
tabLayout_V1->addWidget(buttonsWidget[iDigi]);
QGridLayout * buttonLayout = new QGridLayout(buttonsWidget[iDigi]);
buttonLayout->setSpacing(2);
int rowID = 0 ;
@ -367,12 +367,13 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
enableSignalSlot = true;
//If any digitizer is running ACQ, disable the panel.
// for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
// if( digi[iDigi]->IsRunning() ) {
// this->setEnabled(false);
// break;
// }
// }
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
if( digi[iDigi]->IsRunning() ) {
// this->setEnabled(false);
EnableButtons(false);
break;
}
}
}
@ -3632,6 +3633,20 @@ void DigiSettingsPanel::SyncCheckBox(QCheckBox *(&chk)[][MaxRegChannel+1]){
}
}
void DigiSettingsPanel::EnableButtons(bool enable){
for( int i = 0; i < nDigi; i++ ){
if( !enable ) {
leSaveFilePath[i]->setText("changing setting is disabled due to ACQ is running.");
leSaveFilePath[i]->setStyleSheet("color:red;");
}else{
leSaveFilePath[i]->setText((QString::fromStdString(digi[i]->GetSettingFileName())));
leSaveFilePath[i]->setStyleSheet("");
}
buttonsWidget[i]->setEnabled(enable);
}
}
void DigiSettingsPanel::SyncAllChannelsTab_PHA(){
DebugPrint("%s", "DigiSettingsPanel");
SyncSpinBox(sbRecordLength);

View File

@ -33,6 +33,8 @@ public slots:
void SaveSetting(int opt);
void LoadSetting();
void EnableButtons(bool enable);
signals:
void SendLogMsg(const QString &msg);
void UpdateOtherPanels();
@ -69,7 +71,6 @@ private:
void SyncComboBox(RComboBox *(&cb)[][MaxRegChannel+1]);
void SyncCheckBox(QCheckBox *(&chk)[][MaxRegChannel+1]);
void SyncAllChannelsTab_PHA();
void UpdateSettings_PHA();
void SyncAllChannelsTab_PSD();
@ -102,6 +103,8 @@ private:
QLineEdit * leSaveFilePath[MaxNDigitizer];
QWidget * buttonsWidget[MaxNDigitizer];
QPushButton * bnRefreshSetting; // read setting from board
QPushButton * bnProgramPreDefined;
QPushButton * bnClearBuffer;

View File

@ -1191,7 +1191,7 @@ void FSUDAQ::StartACQ(){
cbAutoRun->setEnabled(false);
bnSync->setEnabled(false);
// if( digiSettings ) digiSettings->setEnabled(false);
if( digiSettings ) digiSettings->EnableButtons(false);
if( onlineAnalyzer ) onlineAnalyzer->StartThread();
@ -1285,7 +1285,10 @@ void FSUDAQ::StopACQ(){
}
}
if( digiSettings ) digiSettings->ReadSettingsFromBoard();
if( digiSettings ) {
digiSettings->EnableButtons(true);
digiSettings->ReadSettingsFromBoard();
}
{//^=== elog and database
if( influx && chkInflux->isChecked() && elogName != "" ) {