fix the crashgit add -A!

This commit is contained in:
splitPoleDAQ 2023-05-23 14:52:23 -04:00
parent c895037896
commit b18610a406
5 changed files with 18 additions and 7 deletions

View File

@ -223,6 +223,11 @@ inline bool Data::OpenSaveFile(std::string fileNamePrefix){
inline void Data::SaveData(){ inline void Data::SaveData(){
if( buffer == nullptr) {
printf("buffer is null.\n");
return;
}
if( outFileSize > (unsigned int) MaxSaveFileSize){ if( outFileSize > (unsigned int) MaxSaveFileSize){
FinishedOutFilesSize += ftell(outFile); FinishedOutFilesSize += ftell(outFile);
CloseSaveFile(); CloseSaveFile();

View File

@ -25,7 +25,8 @@ public:
void SetSaveData(bool onOff) {this->isSaveData = onOff;} void SetSaveData(bool onOff) {this->isSaveData = onOff;}
void SetScopeMode(bool onOff) {this->isScope = onOff;} void SetScopeMode(bool onOff) {this->isScope = onOff;}
void run(){ void run(){
clock_gettime(CLOCK_REALTIME, &ta); clock_gettime(CLOCK_REALTIME, &t0);
ta = t0;
// clock_gettime(CLOCK_REALTIME, &t1); // clock_gettime(CLOCK_REALTIME, &t1);
stop = false; stop = false;
do{ do{
@ -46,7 +47,7 @@ public:
// clock_gettime(CLOCK_REALTIME, &t2); // clock_gettime(CLOCK_REALTIME, &t2);
// if( t2.tv_sec - t1.tv_sec > 2 ) { // 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; // readCount = 0;
// t1 = t2; // t1 = t2;
// } // }
@ -63,7 +64,8 @@ public:
clock_gettime(CLOCK_REALTIME, &tb); clock_gettime(CLOCK_REALTIME, &tb);
if( tb.tv_sec - ta.tv_sec > 2 ) { if( tb.tv_sec - ta.tv_sec > 2 ) {
digiMTX[ID].lock(); 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(); digiMTX[ID].unlock();
ta = tb; ta = tb;
} }
@ -78,7 +80,7 @@ private:
Digitizer * digi; Digitizer * digi;
bool stop; bool stop;
int ID; int ID;
timespec ta, tb, t1, t2; timespec ta, tb, t1, t2, t0;
bool isSaveData; bool isSaveData;
bool isScope; bool isScope;
unsigned long readCount; unsigned long readCount;

View File

@ -645,6 +645,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]->WriteRegister(DPP::SoftwareClear_W, 1);
digi[i]->GetData()->SetSaveWaveToMemory(false);
digi[i]->StartACQ(); digi[i]->StartACQ();
readDataThread[i]->start(); readDataThread[i]->start();
} }
@ -855,6 +856,8 @@ void MainWindow::OpenScope(){
bnStartACQ->setEnabled(false); bnStartACQ->setEnabled(false);
bnStopACQ->setEnabled(false); bnStopACQ->setEnabled(false);
chkSaveData->setChecked(false);
} }
//*************************************************************** //***************************************************************
@ -897,6 +900,6 @@ void MainWindow::LogMsg(QString msg){
} }
QScrollBar *v = logInfo->verticalScrollBar(); QScrollBar *v = logInfo->verticalScrollBar();
v->setValue(v->maximum()); v->setValue(v->maximum());
//qDebug() << outputStr; qDebug() << outputStr;
logInfo->repaint(); logInfo->repaint();
} }

View File

@ -5,7 +5,8 @@
CC = g++ 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 CAENLIBS = -lCAENDigitizer

View File

@ -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]) + " [" + QString::number(data->NumEventsDecoded[ch]) + "]");
leTriggerRate->setText(QString::number(data->TriggerRate[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(); unsigned short traceLength = data->Waveform1[ch][index].size();
if( data->TriggerRate[ch] > 0 ){ if( data->TriggerRate[ch] > 0 ){