diff --git a/.vscode/settings.json b/.vscode/settings.json index 8e87245..e4d19a5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -149,6 +149,7 @@ "thread": "cpp", "cinttypes": "cpp", "typeinfo": "cpp", - "variant": "cpp" + "variant": "cpp", + "qmainwindow": "cpp" } } \ No newline at end of file diff --git a/DigiSettings.cpp b/DigiSettings.cpp new file mode 100644 index 0000000..c7a0618 --- /dev/null +++ b/DigiSettings.cpp @@ -0,0 +1,18 @@ +#include "DigiSettings.h" + +DigiSettings::DigiSettings(Digitizer ** digi, unsigned int nDigi, QMainWindow *parent): QMainWindow(parent){ + + this->digi = digi; + this->nDigi = nDigi; + + enableSignalSlot = false; + + setWindowTitle("Digitizer Settings"); + setGeometry(0, 0, 1000, 800); + +} + +DigiSettings::~DigiSettings(){ + printf("%s \n", __func__); + +} diff --git a/DigiSettings.h b/DigiSettings.h new file mode 100644 index 0000000..65cb977 --- /dev/null +++ b/DigiSettings.h @@ -0,0 +1,32 @@ +#ifndef DigiSettings_H +#define DigiSettings_H + +#include + +#include "macro.h" +#include "ClassDigitizer.h" +#include "CustomWidgets.h" + +class DigiSettings : public QMainWindow{ + Q_OBJECT + +public: + DigiSettings(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr); + ~DigiSettings(); + +private slots: + +signals: + void SendLogMsg(const QString &msg); + +private: + + Digitizer ** digi; + unsigned int nDigi; + + bool enableSignalSlot; + +}; + + +#endif \ No newline at end of file diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 58e8be3..930d459 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -25,6 +25,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ nDigi = 0; scope = nullptr; + digiSettings = nullptr; QWidget * mainLayoutWidget = new QWidget(this); setCentralWidget(mainLayoutWidget); @@ -50,7 +51,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ bnDigiSettings = new QPushButton("Digitizers Settings", this); layout->addWidget(bnDigiSettings, 1, 1); - //connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigiSettings); + connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigiSettings); } @@ -199,6 +200,8 @@ MainWindow::~MainWindow(){ if( scope ) delete scope; + if( digiSettings ) delete digiSettings; + if( scalar ) { CleanUpScalar(); scalarThread->Stop(); @@ -393,6 +396,18 @@ void MainWindow::CloseDigitizers(){ CleanUpScalar(); + if( scope ) { + scope->close(); + delete scope; + scope = nullptr; + } + + if( digiSettings ){ + digiSettings->close(); + delete digiSettings; + digiSettings = nullptr; + } + if( digi == nullptr ) return; for(unsigned int i = 0; i < nDigi; i ++){ @@ -724,7 +739,20 @@ void MainWindow::OpenScope(){ } +//*************************************************************** +//*************************************************************** +void MainWindow::OpenDigiSettings(){ + if( digiSettings == nullptr ) { + digiSettings = new DigiSettings(digi, nDigi); + //connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg); + digiSettings->show(); + }else{ + digiSettings->show(); + digiSettings->activateWindow(); + } + +} //*************************************************************** //*************************************************************** diff --git a/FSUDAQ.h b/FSUDAQ.h index d314f68..adf153e 100644 --- a/FSUDAQ.h +++ b/FSUDAQ.h @@ -14,6 +14,7 @@ #include "ClassDigitizer.h" #include "CustomThreads.h" #include "Scope.h" +#include "DigiSettings.h" //^#===================================================== MainWindow class MainWindow : public QMainWindow{ @@ -24,6 +25,7 @@ public: void closeEvent(QCloseEvent * event){ if( scope ) scope->close(); + if( digiSettings ) digiSettings->close(); event->accept(); } @@ -52,6 +54,8 @@ private slots: void OpenScope(); + void OpenDigiSettings(); + private: Digitizer ** digi; @@ -104,6 +108,9 @@ private: //@----- Scope Scope * scope; + //@----- DigiSettings + DigiSettings * digiSettings; + }; diff --git a/FSUDAQ_Qt6.pro b/FSUDAQ_Qt6.pro index c87963b..a8502fe 100644 --- a/FSUDAQ_Qt6.pro +++ b/FSUDAQ_Qt6.pro @@ -1,5 +1,5 @@ ###################################################################### -# Automatically generated by qmake (3.1) Tue Apr 18 13:09:25 2023 +# Automatically generated by qmake (3.1) Mon Apr 24 16:32:18 2023 ###################################################################### TEMPLATE = app @@ -23,11 +23,13 @@ HEADERS += ClassData.h \ ClassDigitizer.h \ CustomThreads.h \ CustomWidgets.h \ + DigiSettings.h \ FSUDAQ.h \ macro.h \ RegisterAddress.h \ Scope.h SOURCES += ClassDigitizer.cpp \ + DigiSettings.cpp \ FSUDAQ.cpp \ main.cpp \ Scope.cpp diff --git a/Scope.cpp b/Scope.cpp index a7a3661..9e5b665 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -74,6 +74,11 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh cbPeakAvg = nullptr; cbBaselineAvg = nullptr; + cbAnaProbe1 = nullptr; + cbAnaProbe2 = nullptr; + cbDigiProbe1 = nullptr; + cbDigiProbe2 = nullptr; + //*================================== UI int rowID = -1; @@ -687,6 +692,8 @@ void Scope::ReadSettingsFromBoard(){ digi[ID]->ReadRegister(Register::DPP::PreTrigger, ch); digi[ID]->ReadRegister(Register::DPP::ChannelDCOffset, ch); digi[ID]->ReadRegister(Register::DPP::InputDynamicRange, ch); + digi[ID]->ReadRegister(Register::DPP::BoardConfiguration, ch); + digi[ID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){