fix bug when no digitizer connected. becasue the scalar did not setup

This commit is contained in:
Ryan Tang 2023-03-27 18:34:22 -04:00
parent d839def1f2
commit 28b447673b
3 changed files with 6 additions and 6 deletions

View File

@ -37,7 +37,7 @@ int main(int argc, char *argv[]){
msgBox.setText("The DAQ program is already opened, or crashed perviously. \nPID is " + QString::number(pid) + "\n You can kill the procee by \"kill -9 <pid>\" and delete the " + DAQLockFile + "\n or click the \"Kill\" button");
msgBox.setIcon(QMessageBox::Information);
QPushButton * kill = msgBox.addButton("Kill", QMessageBox::AcceptRole);
QPushButton * kill = msgBox.addButton("Kill and Open New", QMessageBox::AcceptRole);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);

View File

@ -34,6 +34,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
setWindowIcon(icon);
nDigi = 0;
nDigiConnected = 0;
digiSetting = nullptr;
influx = nullptr;
readDataThread = nullptr;
@ -594,7 +595,7 @@ void MainWindow::OpenDigitizers(){
digi = new Digitizer2Gen*[nDigi];
readDataThread = new ReadDataThread*[nDigi];
int nDigiConnected = 0;
nDigiConnected = 0;
//Check path exist
QDir dir(analysisPath + "/working/Settings/");
@ -664,7 +665,7 @@ void MainWindow::OpenDigitizers(){
bnProgramSettings->setEnabled(false);
bnNewExp->setEnabled(false);
bnSOLSettings->setEnabled(CheckSOLARISpanelOK());
if( nDigiConnected > 0 ) bnSOLSettings->setEnabled(CheckSOLARISpanelOK());
}
@ -672,7 +673,7 @@ void MainWindow::CloseDigitizers(){
if( digi == NULL) return;
if(scalar ){ // scalar is child of this
if(scalar && nDigiConnected > 0 ){ // scalar is child of this
scalar->close();
DeleteTriggerLineEdit(); // this use digi->GetNChannels();
}
@ -702,8 +703,6 @@ void MainWindow::CloseDigitizers(){
LogMsg("Closed Digitizer : " + QString::number(digi[i]->GetSerialNumber()));
if( digiSetting != NULL ) digiSetting->close();
if( readDataThread[i] != NULL ){
LogMsg("Waiting for readData Thread .....");
readDataThread[i]->quit();

View File

@ -92,6 +92,7 @@ private:
static Digitizer2Gen ** digi;
unsigned short nDigi;
unsigned short nDigiConnected = 0;
//@----- log msg
QPlainTextEdit * logInfo;