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->ClearTriggerRate();
data->ClearData(); data->ClearData();
if( DPPType == DPPTypeCode::DPP_QDC_CODE ) SetOptimialAggOrg(); 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); 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; usleep(1000); // wait for 1 msec to start/Arm ACQ;
ret = CAEN_DGTZ_SWStartAcquisition(handle); 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(" Record Length (bit) : %u = %u sample = %u ns\n", RecordLen, RecordLen*8, RecordLen*8*16);
printf("==============================================================\n"); printf("==============================================================\n");
int eventSize = 6 + 2 * Ex + traceOn * RecordLen * 8; // sample int eventSize = 6 + 2 * Ex + traceOn * RecordLen * 8; // sample
printf(" estimated event size : %d sample \n", eventSize); printf(" estimated event size : %d sample \n", eventSize);
double maxAggOrg = log2( MemorySizekSample * 1024 / eventSize / EventAgg ); double maxAggOrg = log2( MemorySizekSample * 1024 / eventSize / EventAgg );

View File

@ -196,9 +196,9 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
{//^======================= Buttons {//^======================= Buttons
QWidget * buttonsWidget = new QWidget(tab); buttonsWidget[iDigi] = new QWidget(tab);
tabLayout_V1->addWidget(buttonsWidget); tabLayout_V1->addWidget(buttonsWidget[iDigi]);
QGridLayout * buttonLayout = new QGridLayout(buttonsWidget); QGridLayout * buttonLayout = new QGridLayout(buttonsWidget[iDigi]);
buttonLayout->setSpacing(2); buttonLayout->setSpacing(2);
int rowID = 0 ; int rowID = 0 ;
@ -367,12 +367,13 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
enableSignalSlot = true; enableSignalSlot = true;
//If any digitizer is running ACQ, disable the panel. //If any digitizer is running ACQ, disable the panel.
// for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){ for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
// if( digi[iDigi]->IsRunning() ) { if( digi[iDigi]->IsRunning() ) {
// this->setEnabled(false); // this->setEnabled(false);
// break; 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(){ void DigiSettingsPanel::SyncAllChannelsTab_PHA(){
DebugPrint("%s", "DigiSettingsPanel"); DebugPrint("%s", "DigiSettingsPanel");
SyncSpinBox(sbRecordLength); SyncSpinBox(sbRecordLength);

View File

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

View File

@ -1191,7 +1191,7 @@ void FSUDAQ::StartACQ(){
cbAutoRun->setEnabled(false); cbAutoRun->setEnabled(false);
bnSync->setEnabled(false); bnSync->setEnabled(false);
// if( digiSettings ) digiSettings->setEnabled(false); if( digiSettings ) digiSettings->EnableButtons(false);
if( onlineAnalyzer ) onlineAnalyzer->StartThread(); 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 {//^=== elog and database
if( influx && chkInflux->isChecked() && elogName != "" ) { if( influx && chkInflux->isChecked() && elogName != "" ) {