fixed crash when closing digitizer while Scope openned
This commit is contained in:
parent
30a46476ad
commit
e32cde9b4b
|
@ -928,8 +928,9 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){
|
|||
if( dummy != 0 ) printf("reach the end of file (read %ld).\n", dummy);
|
||||
|
||||
uint32_t boardInfo = GetSettingFromMemory(DPP::BoardInfo_R);
|
||||
if( (boardInfo & 0xFF) == 0x0E ) tick2ns = 4.0;
|
||||
if( (boardInfo & 0xFF) == 0x0B ) tick2ns = 2.0;
|
||||
if( (boardInfo & 0xFF) == 0x0E ) tick2ns = 4.0; // 725
|
||||
if( (boardInfo & 0xFF) == 0x0B ) tick2ns = 2.0; // 730
|
||||
if( (boardInfo & 0xFF) == 0x04 ) tick2ns = 16.0; // 740
|
||||
|
||||
///Should seperate file<->memory, memory<->board
|
||||
///ProgramSettingsToBoard(); /// do nothing if not connected.
|
||||
|
|
13
FSUDAQ.cpp
13
FSUDAQ.cpp
|
@ -719,17 +719,17 @@ void MainWindow::CloseDigitizers(){
|
|||
|
||||
LogMsg("MainWindow::Closing Digitizer(s)....");
|
||||
|
||||
scalarThread->Stop();
|
||||
scalarThread->quit();
|
||||
scalarThread->exit();
|
||||
CleanUpScalar();
|
||||
|
||||
if( scope ) {
|
||||
scope->close();
|
||||
delete scope;
|
||||
scope = nullptr;
|
||||
}
|
||||
|
||||
scalarThread->Stop();
|
||||
scalarThread->quit();
|
||||
scalarThread->exit();
|
||||
CleanUpScalar();
|
||||
|
||||
if( histThread){
|
||||
histThread->Stop();
|
||||
histThread->quit();
|
||||
|
@ -1016,7 +1016,7 @@ void MainWindow::UpdateScalar(){
|
|||
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
||||
influx->AddDataPoint("FileSize value=" + std::to_string(totalFileSize));
|
||||
}
|
||||
//influx->PrintDataPoints();
|
||||
//nflux->PrintDataPoints();
|
||||
influx->WriteData(dataBaseName.toStdString());
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
|
@ -1145,7 +1145,6 @@ void MainWindow::StopACQ(){
|
|||
histThread->wait();
|
||||
canvas->ClearInternalDataCount();
|
||||
}
|
||||
|
||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||
|
||||
bnStartACQ->setEnabled(true);
|
||||
|
|
41
Scope.cpp
41
Scope.cpp
|
@ -118,6 +118,12 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
|||
updateTraceThread->SetWaitTimeinSec(ScopeUpdateMiliSec / 1000.);
|
||||
connect(updateTraceThread, &TimingThread::timeUp, this, &Scope::UpdateScope);
|
||||
|
||||
updateScalarThread = new TimingThread();
|
||||
updateScalarThread->SetWaitTimeinSec(2);
|
||||
connect(updateScalarThread, &TimingThread::timeUp, this, [=](){
|
||||
emit UpdateScaler();
|
||||
});
|
||||
|
||||
NullThePointers();
|
||||
|
||||
//*================================== UI
|
||||
|
@ -305,6 +311,12 @@ Scope::~Scope(){
|
|||
updateTraceThread->quit();
|
||||
updateTraceThread->wait();
|
||||
delete updateTraceThread;
|
||||
|
||||
updateScalarThread->Stop();
|
||||
updateScalarThread->quit();
|
||||
updateScalarThread->wait();
|
||||
delete updateScalarThread;
|
||||
|
||||
for( int i = 0; i < MaxNumberOfTrace; i++) delete dataTrace[i];
|
||||
delete plot;
|
||||
}
|
||||
|
@ -358,7 +370,7 @@ void Scope::StartScope(){
|
|||
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
||||
digi[iDigi]->StartACQ();
|
||||
|
||||
printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||
if( readDataThread[iDigi]->isRunning() ){
|
||||
readDataThread[iDigi]->quit();
|
||||
readDataThread[iDigi]->wait();
|
||||
|
@ -366,10 +378,14 @@ void Scope::StartScope(){
|
|||
readDataThread[iDigi]->SetScopeMode(true);
|
||||
readDataThread[iDigi]->SetSaveData(false);
|
||||
readDataThread[iDigi]->start();
|
||||
printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||
}
|
||||
|
||||
printf("=========================== 1\n");
|
||||
|
||||
updateTraceThread->start();
|
||||
updateScalarThread->start();
|
||||
printf("=========================== 2\n");
|
||||
|
||||
bnScopeStart->setEnabled(false);
|
||||
bnScopeStart->setStyleSheet("");
|
||||
|
@ -377,6 +393,7 @@ void Scope::StartScope(){
|
|||
bnScopeStop->setStyleSheet("background-color: red;");
|
||||
|
||||
EnableControl(false);
|
||||
printf("=========================== 3\n");
|
||||
|
||||
TellACQOnOff(true);
|
||||
|
||||
|
@ -392,6 +409,10 @@ void Scope::StopScope(){
|
|||
updateTraceThread->quit();
|
||||
updateTraceThread->exit();
|
||||
|
||||
updateScalarThread->Stop();
|
||||
updateScalarThread->quit();
|
||||
updateScalarThread->exit();
|
||||
|
||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
||||
|
||||
if( readDataThread[iDigi]->isRunning() ){
|
||||
|
@ -501,18 +522,16 @@ void Scope::UpdateScope(){
|
|||
}
|
||||
digiMTX[ID].unlock();
|
||||
|
||||
if( data->TriggerRate[ch] == 0 ){
|
||||
dataTrace[0]->clear();
|
||||
dataTrace[1]->clear();
|
||||
dataTrace[2]->clear();
|
||||
dataTrace[3]->clear();
|
||||
dataTrace[4]->clear();
|
||||
}
|
||||
// if( data->TriggerRate[ch] == 0 ){
|
||||
// dataTrace[0]->clear();
|
||||
// dataTrace[1]->clear();
|
||||
// dataTrace[2]->clear();
|
||||
// dataTrace[3]->clear();
|
||||
// dataTrace[4]->clear();
|
||||
// }
|
||||
|
||||
plot->axes(Qt::Horizontal).first()->setRange(0, tick2ns * traceLength * factor);
|
||||
|
||||
emit UpdateScaler();
|
||||
|
||||
}
|
||||
|
||||
//*=======================================================
|
||||
|
|
3
Scope.h
3
Scope.h
|
@ -32,7 +32,7 @@ public:
|
|||
~Scope();
|
||||
|
||||
void closeEvent(QCloseEvent * event){
|
||||
StopScope();
|
||||
if(isACQStarted) StopScope();
|
||||
emit CloseWindow();
|
||||
event->accept();
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ private:
|
|||
|
||||
ReadDataThread ** readDataThread;
|
||||
TimingThread * updateTraceThread;
|
||||
TimingThread * updateScalarThread;
|
||||
|
||||
bool enableSignalSlot;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user