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