diff --git a/ClassData.h b/ClassData.h index b25b445..fb924f7 100644 --- a/ClassData.h +++ b/ClassData.h @@ -223,6 +223,11 @@ inline bool Data::OpenSaveFile(std::string fileNamePrefix){ inline void Data::SaveData(){ + if( buffer == nullptr) { + printf("buffer is null.\n"); + return; + } + if( outFileSize > (unsigned int) MaxSaveFileSize){ FinishedOutFilesSize += ftell(outFile); CloseSaveFile(); diff --git a/CustomThreads.h b/CustomThreads.h index 245cdd9..8daa8cf 100644 --- a/CustomThreads.h +++ b/CustomThreads.h @@ -25,7 +25,8 @@ public: void SetSaveData(bool onOff) {this->isSaveData = onOff;} void SetScopeMode(bool onOff) {this->isScope = onOff;} void run(){ - clock_gettime(CLOCK_REALTIME, &ta); + clock_gettime(CLOCK_REALTIME, &t0); + ta = t0; // clock_gettime(CLOCK_REALTIME, &t1); stop = false; do{ @@ -46,7 +47,7 @@ public: // clock_gettime(CLOCK_REALTIME, &t2); // if( t2.tv_sec - t1.tv_sec > 2 ) { - // printf("----Digi-%d read %ld / sec.\n", ID, readCount / 2); + // printf("----Digi-%d read %ld / sec.\n", ID, readCount / 3); // readCount = 0; // t1 = t2; // } @@ -63,7 +64,8 @@ public: clock_gettime(CLOCK_REALTIME, &tb); if( tb.tv_sec - ta.tv_sec > 2 ) { digiMTX[ID].lock(); - emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB"); + emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec]"); + //digi->GetData()->PrintStat(); digiMTX[ID].unlock(); ta = tb; } @@ -78,7 +80,7 @@ private: Digitizer * digi; bool stop; int ID; - timespec ta, tb, t1, t2; + timespec ta, tb, t1, t2, t0; bool isSaveData; bool isScope; unsigned long readCount; diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 2e4b4d0..4b38dc8 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -645,6 +645,7 @@ void MainWindow::StartACQ(){ readDataThread[i]->SetSaveData(chkSaveData->isChecked()); LogMsg("Digi-" + QString::number(digi[i]->GetSerialNumber()) + " is starting ACQ." ); digi[i]->WriteRegister(DPP::SoftwareClear_W, 1); + digi[i]->GetData()->SetSaveWaveToMemory(false); digi[i]->StartACQ(); readDataThread[i]->start(); } @@ -855,6 +856,8 @@ void MainWindow::OpenScope(){ bnStartACQ->setEnabled(false); bnStopACQ->setEnabled(false); + chkSaveData->setChecked(false); + } //*************************************************************** @@ -897,6 +900,6 @@ void MainWindow::LogMsg(QString msg){ } QScrollBar *v = logInfo->verticalScrollBar(); v->setValue(v->maximum()); - //qDebug() << outputStr; + qDebug() << outputStr; logInfo->repaint(); } diff --git a/Makefile_test b/Makefile_test index 3c15f27..d6f4a07 100644 --- a/Makefile_test +++ b/Makefile_test @@ -5,7 +5,8 @@ CC = g++ -COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread +#COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread +COPTS = -fPIC -DLINUX -g -std=c++17 -lpthread CAENLIBS = -lCAENDigitizer diff --git a/Scope.cpp b/Scope.cpp index 5d2accb..9c10256 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -300,7 +300,7 @@ void Scope::UpdateScope(){ //leTriggerRate->setText(QString::number(data->TriggerRate[ch]) + " [" + QString::number(data->NumEventsDecoded[ch]) + "]"); leTriggerRate->setText(QString::number(data->TriggerRate[ch])); - unsigned short index = data->EventIndex[ch] - 1; + unsigned short index = data->EventIndex[ch]; unsigned short traceLength = data->Waveform1[ch][index].size(); if( data->TriggerRate[ch] > 0 ){