This commit is contained in:
splitPoleDAQ 2023-05-23 11:19:43 -04:00
parent 8bead5a54b
commit c895037896
4 changed files with 17 additions and 8 deletions

View File

@ -188,6 +188,7 @@ inline void Data::ClearData(){
} }
inline void Data::ClearBuffer(){ inline void Data::ClearBuffer(){
printf("==== %s \n", __func__);
delete buffer; delete buffer;
buffer = nullptr; buffer = nullptr;
AllocatedSize = 0; AllocatedSize = 0;

View File

@ -662,7 +662,7 @@ void Digitizer::ProgramSettingsToBoard(){
if( DPPType == V1730_DPP_PSD_CODE ){ if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterPSDList.size(); p++){ for( int p = 0; p < (int) RegisterPSDList.size(); p++){
if( RegisterPSDList[p].GetType() == RW::ReadWrite){ if( RegisterPSDList[p].GetType() == RW::ReadWrite){
haha = RegisterPHAList[p]; haha = RegisterPSDList[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(1 * 1000); usleep(1 * 1000);
} }
@ -731,13 +731,13 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){
}else{ }else{
/// load binary to memoery /// load binary to memoery
DPPType = fileDPP; DPPType = fileDPP;
printf("DPPType in the file is %s(0x%X). \n", GetDPPString(fileDPP).c_str(), fileDPP); printf("DPPType in the file is %s(0x%X). Board Type is %s \n", GetDPPString(fileDPP).c_str(), fileDPP, GetDPPString().c_str());
settingFile = fopen(fileName.c_str(), "r"); settingFile = fopen(fileName.c_str(), "r");
size_t dummy = fread( setting, SETTINGSIZE * sizeof(unsigned int), 1, settingFile); size_t dummy = fread( setting, SETTINGSIZE * sizeof(unsigned int), 1, settingFile);
fclose (settingFile); fclose (settingFile);
if( dummy == 0 ) printf("reach the end of file\n"); if( dummy != 0 ) printf("reach the end of file (read %ld).\n", dummy);
uint32_t boardInfo = GetSettingFromMemory(DPP::BoardInfo_R); uint32_t boardInfo = GetSettingFromMemory(DPP::BoardInfo_R);
if( (boardInfo & 0xFF) == 0x0E ) ch2ns = 4.0; if( (boardInfo & 0xFF) == 0x0E ) ch2ns = 4.0;

View File

@ -194,7 +194,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this); bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this);
buttonLayout->addWidget(bnClearBuffer, rowID, 2); buttonLayout->addWidget(bnClearBuffer, rowID, 2);
connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1);}); connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1); UpdateBoardAndChannelsStatus();});
bnLoadSettings = new QPushButton("Load Settings", this); bnLoadSettings = new QPushButton("Load Settings", this);
buttonLayout->addWidget(bnLoadSettings, rowID, 3); buttonLayout->addWidget(bnLoadSettings, rowID, 3);
@ -203,11 +203,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
rowID ++; //--------------------------- rowID ++; //---------------------------
bnSendSoftwareTriggerSignal = new QPushButton("Send SW Trigger Signal", this); bnSendSoftwareTriggerSignal = new QPushButton("Send SW Trigger Signal", this);
buttonLayout->addWidget(bnSendSoftwareTriggerSignal, rowID, 0); buttonLayout->addWidget(bnSendSoftwareTriggerSignal, rowID, 0);
connect(bnSendSoftwareTriggerSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareTrigger_W, 1);}); connect(bnSendSoftwareTriggerSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareTrigger_W, 1); UpdateBoardAndChannelsStatus();});
bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this); bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this);
buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1); buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1);
connect(bnSendSoftwareClockSyncSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClockSync_W, 1);}); connect(bnSendSoftwareClockSyncSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClockSync_W, 1); UpdateBoardAndChannelsStatus();});
bnSaveSettings = new QPushButton("Save Settings (bin)", this); bnSaveSettings = new QPushButton("Save Settings (bin)", this);
buttonLayout->addWidget(bnSaveSettings, rowID, 2); buttonLayout->addWidget(bnSaveSettings, rowID, 2);
@ -2226,7 +2226,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QTabWidget * othersTab = new QTabWidget(this); QTabWidget * othersTab = new QTabWidget(this);
otherLayout->addWidget(othersTab); otherLayout->addWidget(othersTab);
QStringList tabName = {"Tab-1", "Test Pulse", "Veto", "Extra2"}; QStringList tabName = {"Tab-1", "Test Pulse", "Veto", "Extra"};
const int nTab = tabName.count(); const int nTab = tabName.count();
@ -2285,7 +2285,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
if( i == 3 ){ if( i == 3 ){
if( ch == 0 ){ if( ch == 0 ){
QLabel * lb2 = new QLabel("Extra2 Option [G]", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2); QLabel * lb2 = new QLabel("Extra Option [G]", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2);
} }
SetUpComboBoxBit(cbExtra2Option[ID][ch], "", tabLayout, ch + 1, 1, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 2, ch); SetUpComboBoxBit(cbExtra2Option[ID][ch], "", tabLayout, ch + 1, 1, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 2, ch);
} }

View File

@ -432,6 +432,13 @@ void MainWindow::CloseDigitizers(){
for(unsigned int i = 0; i < nDigi; i ++){ for(unsigned int i = 0; i < nDigi; i ++){
digi[i]->CloseDigitizer(); digi[i]->CloseDigitizer();
delete digi[i]; delete digi[i];
if(readDataThread[i]->isRunning()){
readDataThread[i]->Stop();
readDataThread[i]->quit();
readDataThread[i]->wait();
}
delete readDataThread[i]; delete readDataThread[i];
} }
delete [] digi; delete [] digi;
@ -637,6 +644,7 @@ void MainWindow::StartACQ(){
} }
readDataThread[i]->SetSaveData(chkSaveData->isChecked()); readDataThread[i]->SetSaveData(chkSaveData->isChecked());
LogMsg("Digi-" + QString::number(digi[i]->GetSerialNumber()) + " is starting ACQ." ); LogMsg("Digi-" + QString::number(digi[i]->GetSerialNumber()) + " is starting ACQ." );
digi[i]->WriteRegister(DPP::SoftwareClear_W, 1);
digi[i]->StartACQ(); digi[i]->StartACQ();
readDataThread[i]->start(); readDataThread[i]->start();
} }