added digitizer Info

This commit is contained in:
splitPoleDAQ 2023-04-24 17:37:03 -04:00
parent b53a32f50e
commit 26056070f0
9 changed files with 149 additions and 55 deletions

View File

@ -99,6 +99,7 @@ class Digitizer{
uint32_t PrintRegister(uint32_t address, std::string msg);
//^================ Get Board info
CAEN_DGTZ_BoardInfo_t GetBoardInfo() const {return BoardInfo;}
std::string GetModelName() const {return BoardInfo.ModelName;}
int GetSerialNumber() const {return BoardInfo.SerialNumber;}
int GetChannelMask() const {return channelMask;}

View File

@ -1,18 +0,0 @@
#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__);
}

View File

@ -1,32 +0,0 @@
#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

101
DigiSettingsPanel.cpp Normal file
View File

@ -0,0 +1,101 @@
#include "DigiSettingsPanel.h"
#include <QScrollArea>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGroupBox>
DigiSettingsPanel::DigiSettingsPanel(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);
tabWidget = new QTabWidget(this);
setCentralWidget(tabWidget);
//@===================================== tab
for( unsigned int iDigi = 0 ; iDigi < this->nDigi; iDigi ++ ){
QScrollArea * scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tabWidget->addTab(scrollArea, "Digi-" + QString::number(digi[iDigi]->GetSerialNumber()));
QWidget * tab = new QWidget(tabWidget);
scrollArea->setWidget(tab);
QHBoxLayout * tabLayout_H = new QHBoxLayout(tab); //tab->setLayout(tabLayout_H);
QVBoxLayout * tabLayout_V1 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V1);
QVBoxLayout * tabLayout_V2 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V2);
{//^====================== Group of Digitizer Info
QGroupBox * infoBox = new QGroupBox("Board Info", tab);
//infoBox->setSizePolicy(sizePolicy);
QGridLayout * infoLayout = new QGridLayout(infoBox);
tabLayout_V1->addWidget(infoBox);
SetUpInfo( "Model ", digi[iDigi]->GetModelName(), infoLayout, 0, 0);
SetUpInfo( "DPP Type ", digi[iDigi]->GetDPPString(), infoLayout, 0, 2);
SetUpInfo("Link Type ", digi[iDigi]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link" , infoLayout, 0, 4);
SetUpInfo( "S/N No. ", std::to_string(digi[iDigi]->GetSerialNumber()), infoLayout, 1, 0);
SetUpInfo( "No. Ch. ", std::to_string(digi[iDigi]->GetNChannels()), infoLayout, 1, 2);
SetUpInfo("Sampling Rate ", std::to_string(digi[iDigi]->GetCh2ns()), infoLayout, 1, 4);
SetUpInfo("ADC bit ", std::to_string(digi[iDigi]->GetADCBits()), infoLayout, 2, 0);
SetUpInfo("ROC version ", digi[iDigi]->GetROCVersion(), infoLayout, 2, 2);
SetUpInfo("AMC version ", digi[iDigi]->GetAMCVersion(), infoLayout, 2, 4);
}
{//^======================= Board status
QGroupBox * bardStatusBox = new QGroupBox("Board Status", tab);
QGridLayout * statusLayout = new QGridLayout(bardStatusBox);
tabLayout_V1->addWidget(bardStatusBox);
}
{//^======================= Board Settings
QGroupBox * boardSettingBox = new QGroupBox("Board Settings", tab);
QGridLayout * settingLayout = new QGridLayout(boardSettingBox);
tabLayout_V1->addWidget(boardSettingBox);
}
{//^======================= Channel Settings
QTabWidget * chTab = new QTabWidget(tab);
tabLayout_H->addWidget(chTab);
QScrollArea * scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
chTab->addTab(scrollArea, "Channel Settings");
}
}
}
DigiSettingsPanel::~DigiSettingsPanel(){
printf("%s \n", __func__);
}
//*================================================================
//*================================================================
void DigiSettingsPanel::SetUpInfo(QString name, std::string value, QGridLayout *gLayout, int row, int col){
QLabel * lab = new QLabel(name, this);
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter);
QLineEdit * leInfo = new QLineEdit(this);
leInfo->setReadOnly(true);
leInfo->setText(QString::fromStdString(value));
gLayout->addWidget(lab, row, col);
gLayout->addWidget(leInfo, row, col + 1);
}

39
DigiSettingsPanel.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef DigiSettings_H
#define DigiSettings_H
#include <QMainWindow>
#include <QTabWidget>
#include <QLineEdit>
#include <QGridLayout>
#include "macro.h"
#include "ClassDigitizer.h"
#include "CustomWidgets.h"
class DigiSettingsPanel : public QMainWindow{
Q_OBJECT
public:
DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr);
~DigiSettingsPanel();
private slots:
signals:
void SendLogMsg(const QString &msg);
private:
void SetUpInfo(QString name, std::string value, QGridLayout *gLayout, int row, int col);
Digitizer ** digi;
unsigned int nDigi;
bool enableSignalSlot;
QTabWidget * tabWidget;
};
#endif

View File

@ -744,7 +744,7 @@ void MainWindow::OpenScope(){
void MainWindow::OpenDigiSettings(){
if( digiSettings == nullptr ) {
digiSettings = new DigiSettings(digi, nDigi);
digiSettings = new DigiSettingsPanel(digi, nDigi);
//connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
digiSettings->show();
}else{

View File

@ -14,7 +14,7 @@
#include "ClassDigitizer.h"
#include "CustomThreads.h"
#include "Scope.h"
#include "DigiSettings.h"
#include "DigiSettingsPanel.h"
//^#===================================================== MainWindow
class MainWindow : public QMainWindow{
@ -109,7 +109,7 @@ private:
Scope * scope;
//@----- DigiSettings
DigiSettings * digiSettings;
DigiSettingsPanel * digiSettings;
};

View File

@ -23,13 +23,13 @@ HEADERS += ClassData.h \
ClassDigitizer.h \
CustomThreads.h \
CustomWidgets.h \
DigiSettings.h \
DigiSettingsPanel.h \
FSUDAQ.h \
macro.h \
RegisterAddress.h \
Scope.h
SOURCES += ClassDigitizer.cpp \
DigiSettings.cpp \
DigiSettingsPanel.cpp \
FSUDAQ.cpp \
main.cpp \
Scope.cpp

View File

@ -3,6 +3,9 @@
#define MaxNPorts 1
#define MaxNBoards 1
#define MaxNDigitizer MaxNPorts * MaxNBoards
#define MaxNChannels 16
#define MaxRecordLength 0x3fff * 8
#define MaxSaveFileSize 1024 * 1024 * 1024 * 2