add DigiSettings.cpp/h

This commit is contained in:
splitPoleDAQ 2023-04-24 16:37:57 -04:00
parent a041b11cb8
commit b53a32f50e
7 changed files with 98 additions and 3 deletions

View File

@ -149,6 +149,7 @@
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
"variant": "cpp",
"qmainwindow": "cpp"
}
}

18
DigiSettings.cpp Normal file
View File

@ -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__);
}

32
DigiSettings.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef DigiSettings_H
#define DigiSettings_H
#include <QMainWindow>
#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

View File

@ -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();
}
}
//***************************************************************
//***************************************************************

View File

@ -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;
};

View File

@ -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

View File

@ -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 ){