diff --git a/.gitignore b/.gitignore index d6a1bc9..b0c1293 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ screenshot.* *settings*.txt *settings*.dat *.dat +Logs *~ *.autosave diff --git a/SOLARISpanel.cpp b/SOLARISpanel.cpp index 1889c2c..f1c2834 100644 --- a/SOLARISpanel.cpp +++ b/SOLARISpanel.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #define NCOL 10 // number of column @@ -12,6 +13,7 @@ std::vector SettingItems = {PHA::CH::TriggerThreshold, PHA::CH::DC_Offset}; const std::vector arrayLabel = {"e", "xf", "xn"}; SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, + QString analysisPath, std::vector> mapping, QStringList detType, std::vector detMaxID, @@ -22,9 +24,14 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, this->digi = digi; this->nDigi = nDigi; + if( this->nDigi > MaxNumberOfDigitizer ) { + this->nDigi = MaxNumberOfChannel; + qDebug() << "Please increase the MaxNumberOfChannel"; + } this->mapping = mapping; this->detType = detType; this->detMaxID = detMaxID; + this->digiSettingPath = analysisPath + "/Settings/"; //Check number of detector type; Array 0-199, Recoil 200-299, other 300- int nDetType = detType.size(); @@ -90,22 +97,22 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, QGridLayout * mainLayout = new QGridLayout(this); this->setLayout(mainLayout); ///================================= - int rowIndex = 0; + int rowIndex = 0 ; QPushButton * bnRefresh = new QPushButton("Refresh Settings", this); connect(bnRefresh, &QPushButton::clicked, this, &SOLARISpanel::RefreshSettings ); - mainLayout->addWidget(bnRefresh, rowIndex, 0); + mainLayout->addWidget(bnRefresh, rowIndex, 0, 1, 2); QPushButton * bnSaveSetting = new QPushButton("Save Settings", this); connect(bnSaveSetting, &QPushButton::clicked, this, &SOLARISpanel::SaveSettings); - mainLayout->addWidget(bnSaveSetting, rowIndex, 1); + mainLayout->addWidget(bnSaveSetting, rowIndex, 2, 1, 2); QPushButton * bnLoadSetting = new QPushButton("Load Settings", this); connect(bnLoadSetting, &QPushButton::clicked, this, &SOLARISpanel::LoadSettings); - mainLayout->addWidget(bnLoadSetting, rowIndex, 2); + mainLayout->addWidget(bnLoadSetting, rowIndex, 4, 1, 2); QLabel * lbCoinTime = new QLabel("Coin. Time (all ch.) [ns]", this); lbCoinTime->setAlignment(Qt::AlignRight | Qt::AlignCenter); - mainLayout->addWidget(lbCoinTime, rowIndex, 3); + mainLayout->addWidget(lbCoinTime, rowIndex, 6, 1, 2); sbCoinTime = new RSpinBox(this); sbCoinTime->setMinimum(-1); @@ -113,7 +120,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, sbCoinTime->setSingleStep(atof(PHA::CH::CoincidenceLength.GetAnswers()[2].first.c_str())); sbCoinTime->setDecimals(0); sbCoinTime->SetToolTip(atof(PHA::CH::CoincidenceLength.GetAnswers()[1].first.c_str())); - mainLayout->addWidget(sbCoinTime, rowIndex, 4); + mainLayout->addWidget(sbCoinTime, rowIndex, 8, 1, 2); connect(sbCoinTime, &RSpinBox::valueChanged, this, [=](){ if( !enableSignalSlot ) return; @@ -152,7 +159,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, ///================================= rowIndex ++; - QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget, rowIndex, 0, 1, 5); + QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget, rowIndex, 0, 1, 10); for( int detTypeID = 0; detTypeID < nDetType; detTypeID ++ ){ QTabWidget * tabSetting = new QTabWidget(tabWidget); @@ -441,7 +448,7 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList detID digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "Disabled", chID); }else { digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "Ch64Trigger", chID); - digi[digiID]->WriteValue(PHA::CH::CoincidenceLength, "100", chID); + digi[digiID]->WriteValue(PHA::CH::CoincidenceLength, "100"); //Form the trigger bit unsigned long mask = 1ULL << (detID[1] & 0xFF ); // trigger by energy @@ -454,7 +461,7 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList detID digi[digiID]->WriteValue(PHA::CH::WaveTriggerSource, "TRGIN", chID); digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "TRGIN", chID); - digi[digiID]->WriteValue(PHA::CH::CoincidenceLength, "100", chID); + digi[digiID]->WriteValue(PHA::CH::CoincidenceLength, "100"); }; break; case 3 : { /// disbaled digi[digiID]->WriteValue(PHA::CH::EventTriggerSource, "Disabled", chID); @@ -676,10 +683,48 @@ void SOLARISpanel::UpdateThreshold(){ //^######################################### void SOLARISpanel::SaveSettings(){ + for(int i = 0; i < nDigi; i++){ + //*------ search for settings_XXXX.dat + + //Check path exist + QDir dir(digiSettingPath); + if( !dir.exists() ) dir.mkpath("."); + + QString settingFile = digiSettingPath + "/setting_" + QString::number(digi[i]->GetSerialNumber()) + "_" + QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss") + ".dat"; + + + int flag = digi[i]->SaveSettingsToFile(settingFile.toStdString().c_str()); + + switch (flag) { + case 1 : { + SendLogMsg("Saved setting file " + settingFile + "."); + }; break; + case 0 : { + SendLogMsg(" Fail to write setting file. " + settingFile + " "); + }; break; + case -1 : { + SendLogMsg(" Fail to save setting file " + settingFile + " , same settings are empty."); + }; break; + }; + + } } void SOLARISpanel::LoadSettings(){ + for(int i = 0; i < nDigi; i++){ + //*------ search for settings_XXXX.dat + QString settingFile = digiSettingPath + "/settings_" + QString::number(digi[i]->GetSerialNumber()) + ".dat"; + if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){ + SendLogMsg("Found setting file " + settingFile + " and loading. please wait."); + digi[i]->SetSettingFileName(settingFile.toStdString()); + SendLogMsg("done settings."); + }else{ + SendLogMsg("Unable to found setting file " + settingFile + ". "); + digi[i]->SetSettingFileName(""); + } + + } } \ No newline at end of file diff --git a/SOLARISpanel.h b/SOLARISpanel.h index 8f4414d..387a756 100644 --- a/SOLARISpanel.h +++ b/SOLARISpanel.h @@ -32,6 +32,7 @@ class SOLARISpanel : public QWidget{ public: SOLARISpanel(Digitizer2Gen ** digi, unsigned short nDigi, + QString analysisPath, std::vector> mapping, QStringList detType, std::vector detMaxID, @@ -64,13 +65,14 @@ private: std::vector detMaxID; QList> detIDList; // 1-D array of { detID, (Digi << 8 ) + ch} + QString digiSettingPath; + int FindDetTypeID(QList detIDListElement); RSpinBox * sbCoinTime; QCheckBox * chkAll[MaxDetType][MaxSettingItem]; // checkBox for all setting on that tab; - QGroupBox * groupBox[MaxDetType][MaxSettingItem][MaxDetID]; QLineEdit * leDisplay[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel]; // [SettingID][DigiID][ChID] diff --git a/digiSettingsPanel.cpp b/digiSettingsPanel.cpp index 47067ec..9882793 100644 --- a/digiSettingsPanel.cpp +++ b/digiSettingsPanel.cpp @@ -58,7 +58,7 @@ QStringList chToolTip = { "Channel signal delay initialization status (1 = initi "Time-energy event free space status (1 = time-energy can be written)", "Waveform event free space status (1 = waveform can be written)"}; -DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QWidget * parent) : QWidget(parent){ +DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString analysisPath, QWidget * parent) : QWidget(parent){ setWindowTitle("Digitizers Settings"); setGeometry(0, 0, 1850, 1000); @@ -70,6 +70,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi this->nDigi = MaxNumberOfChannel; qDebug() << "Please increase the MaxNumberOfChannel"; } + this->digiSettingPath = analysisPath + "/Settings/"; ID = 0; enableSignalSlot = false; @@ -1623,8 +1624,11 @@ void DigiSettingsPanel::EnableControl(){ void DigiSettingsPanel::SaveSettings(){ - //TODO default file Path - QString filePath = QFileDialog::getSaveFileName(this, "Save Settings File", "", "Data file (*.dat);;Text files (*.txt);;All files (*.*)"); + //Check path exist + QDir dir(digiSettingPath); + if( !dir.exists() ) dir.mkpath("."); + + QString filePath = QFileDialog::getSaveFileName(this, "Save Settings File", digiSettingPath, "Data file (*.dat);;Text files (*.txt);;All files (*.*)"); if (!filePath.isEmpty()) { @@ -1641,12 +1645,12 @@ void DigiSettingsPanel::SaveSettings(){ }; break; case 0 : { leSettingFile[ID]->setText("fail to write setting file."); - SendLogMsg(" Fail to write setting file."); + SendLogMsg(" Fail to write setting file. " + filePath + ""); }; break; case -1 : { leSettingFile[ID]->setText("fail to save setting file, same settings are empty."); - SendLogMsg(" Fail to save setting file, same settings are empty."); + SendLogMsg(" Fail to save setting file " + filePath + ", same settings are empty."); }; break; }; @@ -1656,6 +1660,7 @@ void DigiSettingsPanel::SaveSettings(){ void DigiSettingsPanel::LoadSettings(){ QFileDialog fileDialog(this); + fileDialog.setDirectory(digiSettingPath); fileDialog.setFileMode(QFileDialog::ExistingFile); fileDialog.setNameFilter("Data file (*.dat);;Text file (*.txt);;All file (*.*)"); fileDialog.exec(); diff --git a/digiSettingsPanel.h b/digiSettingsPanel.h index 94bf6ef..82109c5 100644 --- a/digiSettingsPanel.h +++ b/digiSettingsPanel.h @@ -27,7 +27,7 @@ class DigiSettingsPanel : public QWidget{ Q_OBJECT public: - DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QWidget * parent = nullptr); + DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString analysisPath, QWidget * parent = nullptr); ~DigiSettingsPanel(); private slots: @@ -54,6 +54,8 @@ private: unsigned short nDigi; unsigned short ID; // index for digitizer; + QString digiSettingPath; + //------------ Layout/GroupBox QGroupBox * digiBox[MaxNumberOfDigitizer]; QGroupBox * VGABox[MaxNumberOfDigitizer]; diff --git a/mainwindow.cpp b/mainwindow.cpp index 533fa67..31b2950 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -194,9 +194,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ bnStartACQ->setEnabled(true); bnStopACQ->setEnabled(false); + bnComment->setEnabled(false); bnOpenScope->setEnabled(true); chkSaveRun->setEnabled(true); - cbAutoRun->setEnabled(true); + if(chkSaveRun->isChecked() ) cbAutoRun->setEnabled(true); if( digiSetting ) digiSetting->EnableControl(); @@ -207,6 +208,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ leRunComment = new QLineEdit(this); leRunComment->setReadOnly(true); leRunComment->setStyleSheet("background-color: #F3F3F3;"); + + bnComment = new QPushButton("Append Comment", this); + connect(bnComment, &QPushButton::clicked, this, &MainWindow::AppendComment); + bnComment->setEnabled(false); layout2->addWidget(lbRawDataPath, 0, 0); layout2->addWidget(leRawDataPath, 0, 1, 1, 4); @@ -220,7 +225,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ layout2->addWidget(bnStopACQ, 1, 5); layout2->addWidget(lbRunComment, 2, 0); - layout2->addWidget(leRunComment, 2, 1, 1, 5); + layout2->addWidget(leRunComment, 2, 1, 1, 4); + layout2->addWidget(bnComment, 2, 5); layout2->setColumnStretch(0, 2); layout2->setColumnStretch(1, 1); @@ -260,6 +266,16 @@ MainWindow::~MainWindow(){ printf("- %s\n", __func__); + LogMsg("Closing SOLARIS DAQ."); + + QFile file(analysisPath + "/working/Log_" + QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss") + ".dat"); + printf("-------- Save log msg to %s\n", file.fileName().toStdString().c_str()); + if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream stream(&file); + stream << logInfo->toPlainText(); + file.close(); + } + printf("-------- remove %s\n", DAQLockFile); remove(DAQLockFile); @@ -342,8 +358,8 @@ void MainWindow::StartACQ(){ if(result == QDialog::Accepted ){ startComment = lineEdit->text(); - if( startComment == "") startComment = "No commet was typed."; - leRunComment->setText(startComment); + if( startComment == "") startComment = "Start Comment: No commet was typed."; + leRunComment->setText("Start Comment: " + startComment); }else{ LogMsg("Start Run aborted. "); return; @@ -371,6 +387,7 @@ void MainWindow::StartACQ(){ //============================= start digitizer for( int i = 0 ; i < nDigi; i ++){ if( digi[i]->IsDummy () ) continue; + for( int ch = 0; ch < (int) digi[i]->GetNChannels(); ch ++) oldTimeStamp[i][ch] = 0; digi[i]->SetPHADataFormat(1);// only save 1 trace @@ -378,8 +395,13 @@ void MainWindow::StartACQ(){ //Additional settings digi[i]->WriteValue("/ch/0..63/par/WaveAnalogProbe0", "ADCInput"); + if( chkSaveRun->isChecked() ){ - QString outFileName = rawDataFolder + "/" + expName + "_" + runIDStr+ "_" + QString::number(digi[i]->GetSerialNumber()); + //Save setting to raw data with run ID + QString fileSetting = rawDataFolder + "/" + expName + "_" + runIDStr + "XSetting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat"; + digi[i]->SaveSettingsToFile(fileSetting.toStdString().c_str()); + + QString outFileName = rawDataFolder + "/" + expName + "_" + runIDStr + "_" + QString::number(digi[i]->GetSerialNumber()); qDebug() << outFileName; digi[i]->OpenOutFile(outFileName.toStdString());// overwrite } @@ -434,8 +456,8 @@ void MainWindow::StopACQ(){ if(result == QDialog::Accepted ){ stopComment = lineEdit->text(); - if( stopComment == "") stopComment = "No commet was typed."; - leRunComment->setText(stopComment); + if( stopComment == "") stopComment = "Stop Comment: No commet was typed."; + leRunComment->setText("Stop Comment: " + stopComment); }else{ LogMsg("Cancel Run aborted. "); return; @@ -503,6 +525,7 @@ void MainWindow::AutoRun(){ StartACQ(); bnStartACQ->setEnabled(false); bnStopACQ->setEnabled(true); + bnComment->setEnabled(false); bnOpenScope->setEnabled(false); chkSaveRun->setEnabled(false); cbAutoRun->setEnabled(false); @@ -524,6 +547,7 @@ void MainWindow::AutoRun(){ if( cbAutoRun->currentData().toInt() > 0 ) { bnStartACQ->setEnabled(true); bnStopACQ->setEnabled(false); + bnComment->setEnabled(false); } }else { StartACQ(); @@ -550,6 +574,7 @@ void MainWindow::AutoRun(){ bnStartACQ->setEnabled(false); bnStopACQ->setEnabled(true); + if(chkSaveRun->isChecked()) bnComment->setEnabled(true); bnOpenScope->setEnabled(false); chkSaveRun->setEnabled(false); cbAutoRun->setEnabled(false); @@ -567,6 +592,10 @@ void MainWindow::OpenDigitizers(){ int nDigiConnected = 0; + //Check path exist + QDir dir(analysisPath + "/Settings/"); + if( !dir.exists() ) dir.mkpath("."); + for( int i = 0; i < nDigi; i++){ LogMsg("IP : " + IPList[i] + " | " + QString::number(i+1) + "/" + QString::number(nDigi)); @@ -580,11 +609,9 @@ void MainWindow::OpenDigitizers(){ readDataThread[i] = new ReadDataThread(digi[i], i, this); connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg); - //connect(readDataThread[i], &ReadDataThread::checkFileSize, this, &MainWindow::CheckOutFileSize); - //connect(readDataThread[i], &ReadDataThread::endOfLastData, this, &MainWindow::CheckOutFileSize); //*------ search for settings_XXXX.dat - QString settingFile = analysisPath + "/settings_" + QString::number(digi[i]->GetSerialNumber()) + ".dat"; + QString settingFile = analysisPath + "/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat"; if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){ LogMsg("Found setting file " + settingFile + " and loading. please wait."); digi[i]->SetSettingFileName(settingFile.toStdString()); @@ -618,6 +645,7 @@ void MainWindow::OpenDigitizers(){ SetUpScalar(); bnStartACQ->setEnabled(true); bnStopACQ->setEnabled(false); + bnComment->setEnabled(false); bnOpenScope->setEnabled(true); chkSaveRun->setEnabled(true); bnOpenDigitizers->setEnabled(false); @@ -692,6 +720,7 @@ void MainWindow::CloseDigitizers(){ bnSOLSettings->setEnabled(false); bnStartACQ->setEnabled(false); bnStopACQ->setEnabled(false); + bnComment->setEnabled(false); bnOpenScope->setEnabled(false); bnOpenScalar->setEnabled(false); chkSaveRun->setEnabled(false); @@ -745,7 +774,7 @@ void MainWindow::OpenDigitizersSettings(){ LogMsg("Open digitizers Settings Panel"); if( digiSetting == NULL){ - digiSetting = new DigiSettingsPanel(digi, nDigi); + digiSetting = new DigiSettingsPanel(digi, nDigi, analysisPath); connect(digiSetting, &DigiSettingsPanel::SendLogMsg, this, &MainWindow::LogMsg); connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(1);}); @@ -757,15 +786,16 @@ void MainWindow::OpenDigitizersSettings(){ //^###################################################################### Open SOLARIS setting panel void MainWindow::OpenSOLARISpanel(){ + LogMsg("Open SOLARIS Panel."); solarisSetting->show(); solarisSetting->UpdatePanelFromMemory(); } bool MainWindow::CheckSOLARISpanelOK(){ - QFile file(analysisPath + "/Mapping.h"); + QFile file(analysisPath + "/working/Mapping.h"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - LogMsg("Fail to open " + analysisPath + "/Mapping.h . SOLARIS panel disabled."); + LogMsg("Fail to open " + file.fileName() + ". SOLARIS panel disabled."); //TODO ----- Create a template of the mapping @@ -848,7 +878,7 @@ bool MainWindow::CheckSOLARISpanelOK(){ } //@============= Create SOLAIRS panel - solarisSetting = new SOLARISpanel(digi, nDigi, mapping, detType, detMaxID); + solarisSetting = new SOLARISpanel(digi, nDigi, analysisPath, mapping, detType, detMaxID); connect(solarisSetting, &SOLARISpanel::SendLogMsg, this, &MainWindow::LogMsg); connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(2);}); @@ -1601,7 +1631,7 @@ bool MainWindow::LoadExpSettings(){ if( analysisPath == "") return false; - QString settingFile = analysisPath + "/expName.sh"; + QString settingFile = analysisPath + "/working/expName.sh"; LogMsg("Loading " + settingFile + " for Experiment."); @@ -1723,8 +1753,12 @@ void MainWindow::ChangeExperiment(const QString newExpName){ } void MainWindow::WriteExpNameSh(){ + + QDir dir(analysisPath + "/working/"); + if( !dir.exists() ) dir.mkpath("."); + //----- create the expName.sh - QFile file2(analysisPath + "/expName.sh"); + QFile file2(analysisPath + "/working/expName.sh"); file2.open(QIODevice::Text | QIODevice::WriteOnly); file2.write(("expName="+ expName + "\n").toStdString().c_str()); @@ -1733,7 +1767,7 @@ void MainWindow::WriteExpNameSh(){ file2.write(("elogID="+std::to_string(elogID)+"\n").c_str()); file2.write("//------------end of file."); file2.close(); - LogMsg("Saved expName.sh to "+ analysisPath + "/expName.sh."); + LogMsg("Saved expName.sh to "+ analysisPath + "/working/expName.sh."); } @@ -1899,3 +1933,52 @@ void MainWindow::WriteRunTimeStampDat(bool isStartRun){ file.close(); } + +void MainWindow::AppendComment(){ + + //if Started ACQ, append Comment, if ACQ stopped, disbale + + if( !chkSaveRun->isChecked() ) return; + + QDialog * dOpen = new QDialog(this); + dOpen->setWindowTitle("Append Run Comment"); + dOpen->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint); + dOpen->setMinimumWidth(600); + connect(dOpen, &QDialog::finished, dOpen, &QDialog::deleteLater); + + QGridLayout * vlayout = new QGridLayout(dOpen); + QLabel *label = new QLabel("Enter Append Run comment for Run-" + runIDStr + " : ", dOpen); + QLineEdit *lineEdit = new QLineEdit(dOpen); + QPushButton *button1 = new QPushButton("OK", dOpen); + QPushButton *button2 = new QPushButton("Cancel", dOpen); + + vlayout->addWidget(label, 0, 0, 1, 2); + vlayout->addWidget(lineEdit, 1, 0, 1, 2); + vlayout->addWidget(button1, 2, 0); + vlayout->addWidget(button2, 2, 1); + + connect(button1, &QPushButton::clicked, dOpen, &QDialog::accept); + connect(button2, &QPushButton::clicked, dOpen, &QDialog::reject); + int result = dOpen->exec(); + + if(result == QDialog::Accepted ){ + appendComment = lineEdit->text(); + if( appendComment == "") return; + + appendComment = QDateTime::currentDateTime().toString("[MM.dd hh:mm:ss]") + appendComment; + + AppendElog(appendComment); + + leRunComment->setText("Append Comment: " + appendComment); + + if( influx ){ + influx->ClearDataPointsBuffer(); + influx->AddDataPoint("RunID,start=1 value=" + std::to_string(runID) + ",expName=\"" + expName.toStdString()+ + "\",comment=\"" + appendComment.replace(' ', '_').toStdString() + "\""); + influx->WriteData(DatabaseName.toStdString()); + } + + }else{ + return; + } + +} diff --git a/mainwindow.h b/mainwindow.h index 6cf934f..80e8822 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -135,6 +135,7 @@ private: ReadDataThread ** readDataThread; QString startComment; QString stopComment; + QString appendComment; bool needManualComment; bool isRunning; QTimer * runTimer; @@ -184,6 +185,9 @@ private: //@------ connection between pannels void UpdateAllPanel(int panelID); + //@------ custom comment; + QPushButton * bnComment; + void AppendComment(); }; diff --git a/scope.cpp b/scope.cpp index 9306c56..0a0dd22 100644 --- a/scope.cpp +++ b/scope.cpp @@ -11,6 +11,10 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDataThread, QMainWindow *parent) : QMainWindow(parent){ this->digi = digi; this->nDigi = nDigi; + if( nDigi > MaxNumberOfDigitizer ) { + this->nDigi = MaxNumberOfChannel; + qDebug() << "Please increase the MaxNumberOfChannel"; + } this->readDataThread = readDataThread; setWindowTitle("Scope");