added digiSettings panel

This commit is contained in:
Ryan Tang 2023-01-25 17:16:14 -05:00
parent 4f1c8ce4f4
commit 7dd20c7064
7 changed files with 199 additions and 15 deletions

View File

@ -60,6 +60,8 @@ class Digitizer2Gen {
public:
Digitizer2Gen();
~Digitizer2Gen();
unsigned short GetSerialNumber() {return serialNumber;}
int OpenDigitizer(const char * url);
bool IsConnected() const {return isConnected;}

View File

@ -3,25 +3,23 @@
Ubuntu 22.04
CAEN_DIG2_v1.5.3
CAEN_FELIB_v1.2.2
qt6-base-dev libcurl4-openssl-dev
`sudo apt install qt6-base-dev libcurl4-openssl-dev`
Digitizer firmware V2745-dpp-pha-2022092903.cup
# Compile
use
`qmake -project `
to generate the *.pro
use `qmake6 -project ` to generate the *.pro
in the *.pro, add
` QT += widgets`
` LIBS += -lcurl -lCAEN_FELib`
then run
` qmake *.pro`
it will generate Makefile
then run ` qmake6 *.pro` it will generate Makefile
then
` make`
then ` make`

View File

@ -18,5 +18,5 @@ LIBS += -lcurl -lCAEN_FELib
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Input
HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp
HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h digiSettings.h
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettings.cpp

117
digiSettings.cpp Normal file
View File

@ -0,0 +1,117 @@
#include "digiSettings.h"
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QGridLayout>
#include <QScrollArea>
#include <QTabWidget>
#include <QGroupBox>
#include <QCheckBox>
#include <QDebug>
DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget * parent) : QWidget(parent){
qDebug() << "DigiSettings constructor";
setWindowTitle("Digitizers Settings");
setGeometry(200, 50, 1000, 1000);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->digi = digi;
this->nDigi = nDigi;
std::vector<std::vector<std::string>> info = {{"Serial Num : ", "/par/SerialNum"},
{"IP : ", "/par/IPAddress"},
{"Model Name : ", "/par/ModelName"},
{"FPGA firmware version : ", "/par/FPGA_FwVer"},
{"DPP Type : ", "/par/FwType"},
{"CUP version : ", "/par/cupver"},
{"ADC bits : ", "/par/ADC_Nbit"},
{"ADC rate [Msps] : ", "/par/ADC_SamplRate"},
{"Number of Channel : ", "/par/NumCh"}
};
QVBoxLayout * mainLayout = new QVBoxLayout(this);
this->setLayout(mainLayout);
QTabWidget * tabWidget = new QTabWidget(this);
mainLayout->addWidget(tabWidget);
//============ Tab for each digitizer
for(unsigned short i = 0; i < nDigi; i++){
QWidget * tab = new QWidget(tabWidget);
QScrollArea * scrollArea = new QScrollArea;
scrollArea->setWidget(tab);
scrollArea->setWidgetResizable(true);
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tabWidget->addTab(scrollArea, "Digi-" + QString::number(digi->GetSerialNumber()));
QGridLayout *tabLayout = new QGridLayout(tab);
tab->setLayout(tabLayout);
//-------- Group of Digitizer Info
QGroupBox * infoBox = new QGroupBox("Board Info", tab);
QGridLayout * infoLayout = new QGridLayout(infoBox);
infoBox->setLayout(infoLayout);
for( unsigned short j = 0; j < (unsigned short) info.size(); j++){
QLabel * lab = new QLabel(QString::fromStdString(info[j][0]), tab);
lab->setAlignment(Qt::AlignRight);
QLineEdit * txt = new QLineEdit(tab);
txt->setReadOnly(true);
txt->setText(QString::fromStdString(digi->ReadValue(info[j][1].c_str())));
//txt->setStyleSheet("color: black;");
infoLayout->addWidget(lab, j, 0);
infoLayout->addWidget(txt, j, 1);
}
tabLayout->addWidget(infoBox, 0, 0);
//------- Group digitizer settings
QGroupBox * digiBox = new QGroupBox("Board Settings", tab);
QGridLayout * digiLayout = new QGridLayout(digiBox);
digiBox->setLayout(digiLayout);
tabLayout->addWidget(digiBox, 1, 0, 4, 1);
//------- Group channel settings
QGroupBox * chBox = new QGroupBox("Channel Settings", tab);
QGridLayout * chLayout = new QGridLayout(chBox);
chBox->setLayout(chLayout);
for( unsigned short ch = 0; ch < digi->GetNChannels(); ch++){
QLabel * labCh = new QLabel(QString::number(ch), tab);
labCh->setAlignment(Qt::AlignRight);
chLayout->addWidget(labCh, ch, 0);
QCheckBox * cbCh = new QCheckBox(tab);
std::string onOff = digi->ReadValue(("/ch/" + std::to_string(ch)+ "/par/ChEnable").c_str());
//qDebug() << QString::fromStdString(std::to_string(ch) + ", " + onOff);
if( onOff == "True"){
cbCh->setChecked(true);
}else{
cbCh->setChecked(false);
}
chLayout->addWidget(cbCh, ch, 1);
}
tabLayout->addWidget(chBox, 0, 1, 5, 1);
}
}
DigiSettings::~DigiSettings(){
}

28
digiSettings.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef DigiSettings_H
#define DigiSettings_H
#include <QWidget>
#include "ClassDigitizer2Gen.h"
class DigiSettings : public QWidget{
Q_OBJECT
public:
DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget * parent = nullptr);
~DigiSettings();
private slots:
signals:
private:
Digitizer2Gen * digi;
unsigned short nDigi;
};
#endif

View File

@ -11,10 +11,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
setWindowIcon(icon);
nDigi = 0;
digiSerialNum.clear();
digiSetting = NULL;
QWidget * mainLayoutWidget = new QWidget(this);
setCentralWidget(mainLayoutWidget);
QVBoxLayout * layout1 = new QVBoxLayout();
QVBoxLayout * layout1 = new QVBoxLayout(mainLayoutWidget);
mainLayoutWidget->setLayout(layout1);
{
@ -34,6 +36,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
bnDigiSettings = new QPushButton("Digitizers Settings", this);
bnDigiSettings->setEnabled(false);
connect(bnDigiSettings, SIGNAL(clicked()), this, SLOT(OpenDigitizersSettings()));
bnStartACQ = new QPushButton("Start ACQ", this);
bnStartACQ->setEnabled(false);
@ -69,10 +72,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
LogMsg("Welcome to SOLARIS DAQ.");
bnOpenDigitizers_clicked();
OpenDigitizersSettings();
}
MainWindow::~MainWindow(){
delete digiSetting;
delete bnProgramSettings;
delete bnOpenDigitizers;
delete bnCloseDigitizers;
@ -98,10 +106,15 @@ void MainWindow::bnOpenDigitizers_clicked(){
digi->OpenDigitizer("dig2://192.168.0.100/");
if(digi->IsConnected()){
LogMsg("Open digitizer.");
bnCloseDigitizers->setEnabled(true);
digiSerialNum.push_back(digi->GetSerialNumber());
nDigi ++;
LogMsg("Opened digitizer : " + QString::number(digi->GetSerialNumber()));
bnOpenDigitizers->setEnabled(false);
bnCloseDigitizers->setEnabled(true);
bnDigiSettings->setEnabled(true);
bnStartACQ->setEnabled(true);
}else{
LogMsg("Cannot open digitizer");
@ -113,12 +126,29 @@ void MainWindow::bnCloseDigitizers_clicked(){
digi->CloseDigitizer();
delete digi;
digi = NULL;
LogMsg("Closed Digitizer.");
LogMsg("Closed Digitizer : " + QString::number(digiSerialNum[0]));
nDigi = 0;
digiSerialNum.clear();
bnOpenDigitizers->setEnabled(true);
bnCloseDigitizers->setEnabled(false);
bnDigiSettings->setEnabled(false);
bnStartACQ->setEnabled(false);
bnStopACQ->setEnabled(false);
}
}
void MainWindow::OpenDigitizersSettings(){
LogMsg("Open digitizers Settings Panel");
if( digiSetting == NULL){
digiSetting = new DigiSettings(digi, nDigi);
digiSetting->show();
}else{
digiSetting->show();
}
}
void MainWindow::LogMsg(QString msg){

View File

@ -11,7 +11,10 @@
#include <QScrollBar>
#include <QPushButton>
#include <vector>
#include "ClassDigitizer2Gen.h"
#include "digiSettings.h"
static Digitizer2Gen * digi = NULL;
@ -30,6 +33,8 @@ private slots:
void bnOpenDigitizers_clicked();
void bnCloseDigitizers_clicked();
void OpenDigitizersSettings();
signals :
@ -42,9 +47,13 @@ private:
QPushButton * bnStartACQ;
QPushButton * bnStopACQ;
DigiSettings * digiSetting;
QPlainTextEdit * logInfo;
unsigned short nDigi;
std::vector<unsigned short> digiSerialNum;
//QThread * StartRunThread;