many bugs fix, plan to add SyncHelper

This commit is contained in:
Ryan Tang 2023-09-15 17:31:07 -04:00
parent 8a0c828ebe
commit 9736f5cdc6
11 changed files with 215 additions and 74 deletions

View File

@ -1,13 +1,12 @@
#ifndef MANYTHREADS_H
#define MANYTHREADS_H
#ifndef CUSTOMTHREADS_H
#define CUSTOMTHREADS_H
#include <QThread>
#include <QMutex>
#include "macro.h"
#include "ClassDigitizer2Gen.h"
#include "macro.h"
static QMutex digiMTX[MaxNumberOfDigitizer];
@ -19,11 +18,15 @@ public:
this->digi = dig;
this->ID = digiID;
isSaveData = false;
stop = false;
}
void Stop(){ this->stop = true;}
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
void run(){
stop = false;
clock_gettime(CLOCK_REALTIME, &ta);
while(true){
while(!stop){
digiMTX[ID].lock();
int ret = digi->ReadData();
digiMTX[ID].unlock();
@ -59,7 +62,7 @@ private:
Digitizer2Gen * digi;
int ID;
timespec ta, tb;
bool isSaveData;
bool isSaveData, stop;
};
//^#======================================================= Timing Thread, for some action need to be done periodically

View File

@ -1,3 +1,41 @@
# Architecture
The core digitizer control classes are independent from the UI classes
## Core digitizer class/files
- Event.h
- DigiParameters.h
- ClassDigitizer2Gen.h/cpp
The test.cpp is a demo code to use the ClassDigitizer2Gen.h/cpp.
## Auxillary classes
- influxdb.h/cpp
## UI classes/files
- main.cpp
- mainwindow.h/cpp
- digiSettingsPanel.h/cpp
- CustomWidget.h
- CustomThreads.h
- scope.h/cpp
- SOLARISpanel.h/cpp
## Other files
- makeTest
- test.cpp
- script.C
- SolReader.h
- windowID.cpp
## Wiki
https://fsunuc.physics.fsu.edu/wiki/index.php/FRIB_SOLARIS_Collaboration
# Required / Development enviroment
Ubuntu 22.04
@ -12,6 +50,7 @@ Digitizer firmware V2745-dpp-pha-2022092903.cup
# Compile
## if *.pro does not exist
use `qmake6 -project ` to generate the *.pro
in the *.pro, add
@ -20,6 +59,8 @@ in the *.pro, add
` LIBS += -lcurl -lCAEN_FELib`
then run ` qmake6 *.pro` it will generate Makefile
## if *.pro exist
run ` qmake6 *.pro` it will generate Makefile
then ` make`

View File

@ -8,6 +8,7 @@ INCLUDEPATH += .
QT += widgets charts
QMAKE_CXXFLAGS += -g # for gdb debug
LIBS += -lcurl -lCAEN_FELib -lX11
# You can make your code fail to compile if you use deprecated APIs.
@ -18,5 +19,22 @@ LIBS += -lcurl -lCAEN_FELib -lX11
#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 digiSettingsPanel.h Digiparameters.h scope.h manyThread.h CustomWidgets.h macro.h SOLARISpanel.h
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettingsPanel.cpp scope.cpp SOLARISpanel.cpp
HEADERS += ClassDigitizer2Gen.h \
Event.h \
influxdb.h \
mainwindow.h \
digiSettingsPanel.h \
Digiparameters.h \
scope.h \
CustomThreads.h \
CustomWidgets.h \
macro.h \
SOLARISpanel.h
SOURCES += ClassDigitizer2Gen.cpp \
influxdb.cpp \
main.cpp \
mainwindow.cpp \
digiSettingsPanel.cpp \
scope.cpp \
SOLARISpanel.cpp

View File

@ -276,6 +276,29 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//-------------------------------------
SetupComboBox(cbbClockSource[iDigi], PHA::DIG::ClockSource, -1, true, "Clock Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbEnClockFP = new QLabel("Enable Clock Out Font Panel :", tab);
lbEnClockFP->setAlignment(Qt::AlignRight | Qt::AlignCenter);
boardLayout->addWidget(lbEnClockFP, rowId, 2, 1, 3);
cbbEnClockFrontPanel[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbEnClockFrontPanel[iDigi], rowId, 5);
SetupShortComboBox(cbbEnClockFrontPanel[iDigi], PHA::DIG::EnableClockOutFrontPanel);
connect(cbbEnClockFrontPanel[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableClockOutFrontPanel.GetPara());
msg += " = " + cbbEnClockFrontPanel[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableClockOutFrontPanel, cbbEnClockFrontPanel[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
cbbEnClockFrontPanel[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbEnClockFrontPanel[ID]->setStyleSheet("color:red;");
}
});
//-------------------------------------
rowId ++;
QLabel * lbStartSource = new QLabel("Start Source :", tab);
@ -320,7 +343,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = QString::fromStdString(PHA::DIG::EnableAutoDisarmACQ.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableAutoDisarmACQ.GetPara());
msg += " = " + cbbAutoDisarmAcq[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableAutoDisarmACQ, cbbAutoDisarmAcq[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
@ -345,7 +368,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(cbbStatEvents[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
QString msg;
msg = QString::fromStdString(PHA::DIG::EnableStatisticEvents.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableStatisticEvents.GetPara());
msg += " = " + cbbStatEvents[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString()) ){
SendLogMsg(msg + "|OK.");
@ -382,7 +405,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
QString msg;
msg = QString::fromStdString(PHA::DIG::BoardVetoWidth.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoWidth.GetPara());
msg += " = " + QString::number(dsbBdVetoWidth[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoWidth, std::to_string(dsbBdVetoWidth[iDigi]->value()), -1) ){
dsbBdVetoWidth[ID]->setStyleSheet("");
@ -424,7 +447,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
double value = dsbVolatileClockOutDelay[ID]->value();
dsbVolatileClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg;
msg = QString::fromStdString(PHA::DIG::VolatileClockOutDelay.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::VolatileClockOutDelay.GetPara());
msg += " = " + QString::number(dsbVolatileClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::VolatileClockOutDelay, std::to_string(dsbVolatileClockOutDelay[ID]->value()), -1) ){
dsbVolatileClockOutDelay[ID]->setStyleSheet("");
@ -461,7 +484,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
double value = dsbClockOutDelay[ID]->value();
dsbClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg;
msg = QString::fromStdString(PHA::DIG::PermanentClockOutDelay.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::PermanentClockOutDelay.GetPara());
msg += " = " + QString::number(dsbClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::PermanentClockOutDelay, std::to_string(dsbClockOutDelay[ID]->value()), -1) ){
dsbClockOutDelay[ID]->setStyleSheet("");
@ -523,7 +546,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
double value = VGA[ID][k]->value();
VGA[ID][k]->setValue( (std::round(value/step) * step) );
QString msg;
msg = QString::fromStdString(PHA::VGA::VGAGain.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::VGA::VGAGain.GetPara());
if( PHA::VGA::VGAGain.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(k);
msg += " = " + QString::number(VGA[ID][k]->value());
if( digi[ID]->WriteValue(PHA::VGA::VGAGain, std::to_string(VGA[ID][k]->value()), k)){
@ -1543,7 +1566,7 @@ void DigiSettingsPanel::onTriggerClick(int haha){
QString kaka = QString::number(mask);
QString msg;
msg = QString::fromStdString(PHA::CH::ChannelsTriggerMask.GetPara() ) + "|DIG:" + QString::number(digi[iDig]->GetNChannels()) + ",CH:" + QString::number(ch) + " = 0x" + QString::number(mask,16);
msg = "DIG:" + QString::number(digi[iDig]->GetNChannels()) + ",CH:" + QString::number(ch) + "|" + QString::fromStdString(PHA::CH::ChannelsTriggerMask.GetPara() ) + " = 0x" + QString::number(mask,16);
if( digi[iDig]->WriteValue(PHA::CH::ChannelsTriggerMask, kaka.toStdString(), ch) ){
SendLogMsg(msg + "|OK.");
@ -1616,31 +1639,32 @@ void DigiSettingsPanel::EnableControl(){
UpdatePanelFromMemory();
bool enable = !digi[ID]->IsAcqOn();
for( int id = 0; id < nDigi; id ++){
bool enable = !digi[id]->IsAcqOn();
digiBox[ID]->setEnabled(enable);
if( digi[ID]->GetFPGAType() == "DPP_PHA") VGABox[ID]->setEnabled(enable);
if( ckbGlbTrgSource[ID][3]->isChecked() ) testPulseBox[ID]->setEnabled(enable);
box1[ID]->setEnabled(enable);
box3[ID]->setEnabled(enable);
box4[ID]->setEnabled(enable);
box5[ID]->setEnabled(enable);
box6[ID]->setEnabled(enable);
digiBox[id]->setEnabled(enable);
if( digi[id]->GetFPGAType() == "DPP_PHA") VGABox[id]->setEnabled(enable);
if( ckbGlbTrgSource[id][3]->isChecked() ) testPulseBox[id]->setEnabled(enable);
box1[id]->setEnabled(enable);
box3[id]->setEnabled(enable);
box4[id]->setEnabled(enable);
box5[id]->setEnabled(enable);
box6[id]->setEnabled(enable);
bnReadSettngs[ID]->setEnabled(enable);
bnResetBd[ID]->setEnabled(enable);
bnDefaultSetting[ID]->setEnabled(enable);
bnSaveSettings[ID]->setEnabled(enable);
bnLoadSettings[ID]->setEnabled(enable);
bnClearData[ID]->setEnabled(enable);
bnArmACQ[ID]->setEnabled(enable);
bnDisarmACQ[ID]->setEnabled(enable);
bnSoftwareStart[ID]->setEnabled(enable);
bnSoftwareStop[ID]->setEnabled(enable);
bnReadSettngs[id]->setEnabled(enable);
bnResetBd[id]->setEnabled(enable);
bnDefaultSetting[id]->setEnabled(enable);
bnSaveSettings[id]->setEnabled(enable);
bnLoadSettings[id]->setEnabled(enable);
bnClearData[id]->setEnabled(enable);
bnArmACQ[id]->setEnabled(enable);
bnDisarmACQ[id]->setEnabled(enable);
bnSoftwareStart[id]->setEnabled(enable);
bnSoftwareStop[id]->setEnabled(enable);
if( digi[ID]->GetFPGAType() != "DPP_PHA" || digi[ID]->GetModelName() != "VX2745" ) VGABox[ID]->setEnabled(false);
if( digi[id]->GetFPGAType() != "DPP_PHA" || digi[id]->GetModelName() != "VX2745" ) VGABox[id]->setEnabled(false);
QVector<QTabWidget*> tempArray = {inputTab[ID], trapTab[ID], probeTab[ID], otherTab[ID] };
QVector<QTabWidget*> tempArray = {inputTab[id], trapTab[id], probeTab[id], otherTab[id] };
for( int k = 0; k < tempArray.size(); k++){
for( int i = 0; i < tempArray[k]->count(); i++) {
@ -1659,6 +1683,7 @@ void DigiSettingsPanel::EnableControl(){
icBox1->setEnabled(enable);
icBox2->setEnabled(enable);
}
}
@ -1964,7 +1989,7 @@ void DigiSettingsPanel::SetStartSource(){
//printf("================ %s\n", value.c_str());
QString msg;
msg = QString::fromStdString(PHA::DIG::StartSource.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::StartSource.GetPara());
msg += " = " + QString::fromStdString(value);
SendLogMsg(msg);
@ -1987,7 +2012,7 @@ void DigiSettingsPanel::SetGlobalTriggerSource(){
//printf("================ %s\n", value.c_str());
QString msg;
msg = QString::fromStdString(PHA::DIG::GlobalTriggerSource.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::GlobalTriggerSource.GetPara());
msg += " = " + QString::fromStdString(value);
SendLogMsg(msg);
@ -2019,7 +2044,7 @@ void DigiSettingsPanel::SetupComboBox(RComboBox *&cbb, const Reg para, int ch_in
//int index = ch_index;
//printf("%s %d %s \n", para.GetPara().c_str(), index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
if( para.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(index);
msg += " = " + cbb->currentData().toString();
@ -2069,7 +2094,7 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
}
int index = ( ch_index == -1 && isMaster ? cbChPick[ID]->currentData().toInt() : ch_index);
QString msg;
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()) ;
if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
msg += " = " + QString::number(spb->value());
if( digi[ID]->WriteValue(para, std::to_string(spb->value()), index)){

View File

@ -134,6 +134,7 @@ private:
//-------------- board settings
RComboBox * cbbClockSource[MaxNumberOfDigitizer];
RComboBox * cbbEnClockFrontPanel[MaxNumberOfDigitizer];
QCheckBox * ckbStartSource[MaxNumberOfDigitizer][5];
QCheckBox * ckbGlbTrgSource[MaxNumberOfDigitizer][5];
RComboBox * cbbTrgOut[MaxNumberOfDigitizer];

View File

@ -101,19 +101,23 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope);
bnOpenDigitizers = new QPushButton("Open Digitizers", this);
connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(OpenDigitizers()));
connect(bnOpenDigitizers, &QPushButton::clicked, this, &MainWindow::OpenDigitizers);
bnCloseDigitizers = new QPushButton("Close Digitizers", this);
bnCloseDigitizers->setEnabled(false);
connect(bnCloseDigitizers, SIGNAL(clicked()), this, SLOT(CloseDigitizers()));
connect(bnCloseDigitizers, &QPushButton::clicked, this, &MainWindow::CloseDigitizers);
bnDigiSettings = new QPushButton("Digitizers Settings", this);
bnDigiSettings->setEnabled(false);
connect(bnDigiSettings, SIGNAL(clicked()), this, SLOT(OpenDigitizersSettings()));
connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigitizersSettings);
bnSOLSettings = new QPushButton("SOLARIS Settings", this);
bnSOLSettings->setEnabled(false);
connect(bnSOLSettings, SIGNAL(clicked()), this, SLOT(OpenSOLARISpanel()));
connect(bnSOLSettings, &QPushButton::clicked, this, &MainWindow::OpenSOLARISpanel);
bnSyncHelper = new QPushButton("Sync Helper", this);
bnSyncHelper->setEnabled(false);
connect(bnSyncHelper, &QPushButton::clicked, this, &MainWindow::OpenSyncHelper);
QPushButton * bnEventBuilder = new QPushButton("Event Builder", this);
bnEventBuilder->setEnabled(false);
@ -129,6 +133,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout1->addWidget(lExpName, 0, 2);
layout1->addWidget(leExpName, 0, 3);
layout1->addWidget(bnSyncHelper, 1, 0);
layout1->addWidget(bnOpenDigitizers, 1, 1);
layout1->addWidget(bnCloseDigitizers, 1, 2, 1, 2);
@ -172,7 +177,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
leRunID->setStyleSheet("background-color: #F3F3F3;");
chkSaveRun = new QCheckBox("Save Run", this);
chkSaveRun->setChecked(true);
chkSaveRun->setChecked(false);
chkSaveRun->setEnabled(false);
connect(chkSaveRun, &QCheckBox::clicked, this, [=]() { cbAutoRun->setEnabled(chkSaveRun->isChecked()); });
@ -190,12 +195,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
cbAutoRun->addItem("Every 5 hrs", -300);
cbAutoRun->setEnabled(false);
QComboBox * cbDataFormat = new QComboBox(this);
cbDataFormat = new QComboBox(this);
cbDataFormat->addItem("Everything", 0);
cbDataFormat->addItem("1 trace", 1);
cbDataFormat->addItem("No trace", 2);
cbDataFormat->addItem("Minimum", 3);
cbDataFormat->setCurrentIndex(1);
cbDataFormat->setCurrentIndex(3);
cbDataFormat->setEnabled(false);
bnStartACQ = new QPushButton("Start ACQ", this);
@ -419,7 +424,9 @@ int MainWindow::StartACQ(){
for( int ch = 0; ch < (int) digi[i]->GetNChannels(); ch ++) oldTimeStamp[i][ch] = 0;
digi[i]->SetPHADataFormat(1);// only save 1 trace
//digi[i]->SetPHADataFormat(1);// only save 1 trace
int dataFormatID = cbDataFormat->currentData().toInt();
digi[i]->SetPHADataFormat(dataFormatID);// only save 1 trace
//Additional settings
digi[i]->WriteValue("/ch/0..63/par/WaveAnalogProbe0", "ADCInput");
@ -507,6 +514,7 @@ void MainWindow::StopACQ(){
digi[i]->StopACQ();
if( readDataThread[i]->isRunning()){
readDataThread[i]->Stop();
readDataThread[i]->quit();
readDataThread[i]->wait();
}
@ -585,6 +593,7 @@ void MainWindow::AutoRun(){
bnOpenScope->setEnabled(true);
chkSaveRun->setEnabled(true);
cbAutoRun->setEnabled(true);
cbDataFormat->setEnabled(true);
if( digiSetting ) digiSetting->EnableControl();
}else{
@ -664,9 +673,9 @@ void MainWindow::OpenDigitizers(){
}else{
LogMsg("<font style=\"color: red;\">Unable to found setting file <b>" + settingFile + "</b>. </font>");
digi[i]->SetSettingFileName("");
LogMsg("Reset digitizer And set default PHA settings.");
digi[i]->Reset();
digi[i]->ProgramPHA(false);
//LogMsg("Reset digitizer And set default PHA settings.");
//digi[i]->Reset();
//digi[i]->ProgramPHA(false);
}
digi[i]->ReadAllSettings();
@ -693,9 +702,11 @@ void MainWindow::OpenDigitizers(){
bnComment->setEnabled(false);
bnOpenScope->setEnabled(true);
chkSaveRun->setEnabled(true);
bnSyncHelper->setEnabled(true);
bnOpenDigitizers->setEnabled(false);
bnOpenDigitizers->setStyleSheet("");
cbAutoRun->setEnabled(true);
cbDataFormat->setEnabled(true);
bnOpenScalar->setEnabled(true);
}
@ -751,6 +762,7 @@ void MainWindow::CloseDigitizers(){
if( readDataThread[i] != NULL ){
LogMsg("Waiting for readData Thread .....");
readDataThread[i]->Stop();
readDataThread[i]->quit();
readDataThread[i]->wait();
delete readDataThread[i];
@ -761,7 +773,7 @@ void MainWindow::CloseDigitizers(){
digi = NULL;
readDataThread = NULL;
bnSyncHelper->setEnabled(false);
bnOpenDigitizers->setEnabled(true);
bnOpenDigitizers->setFocus();
bnCloseDigitizers->setEnabled(false);
@ -774,6 +786,7 @@ void MainWindow::CloseDigitizers(){
bnOpenScalar->setEnabled(false);
chkSaveRun->setEnabled(false);
cbAutoRun->setEnabled(false);
cbDataFormat->setEnabled(false);
bnProgramSettings->setEnabled(true);
bnNewExp->setEnabled(true);
@ -782,6 +795,41 @@ void MainWindow::CloseDigitizers(){
}
void MainWindow::OpenSyncHelper(){
LogMsg("Open <b>Sync Helper</b>.");
QDialog dialog(this);
dialog.setWindowTitle("Sync Helper");
dialog.setWindowFlags(Qt::Dialog | Qt::WindowTitleHint);
QVBoxLayout * layout = new QVBoxLayout(&dialog);
QPushButton * bnNoSync = new QPushButton("No Sync", &dialog);
QPushButton * bnMethod1 = new QPushButton("Software TRG-OUT --> TRG-IN ", &dialog);
QPushButton * bnMethod2 = new QPushButton("Software TRG-OUT --> S-IN ", &dialog);
QPushButton * bnMethod3 = new QPushButton("External TRG-OUT --> S-IN ", &dialog);
layout->addWidget( bnNoSync, 1);
layout->addWidget(bnMethod1, 2);
layout->addWidget(bnMethod2, 3);
layout->addWidget(bnMethod3, 4);
bnNoSync->setFixedHeight(40);
bnMethod1->setFixedHeight(40);
bnMethod2->setFixedHeight(40);
bnMethod3->setFixedHeight(40);
connect(bnNoSync, &QPushButton::clicked, [&](){
for(unsigned int i = 0; i < nDigi; i++){
}
dialog.accept();
});
dialog.exec();
}
//*######################################################################
//*###################################################################### Open Scope
void MainWindow::OpenScope(){
@ -815,11 +863,11 @@ void MainWindow::OpenScope(){
digiSetting->EnableControl();
}
scope->StartScope();
//scope->StartScope();
}else{
scope->show();
scope->StartScope();
//scope->StartScope();
if( digiSetting ) digiSetting->EnableControl();
}
}

View File

@ -24,7 +24,7 @@
#include "ClassDigitizer2Gen.h"
#include "influxdb.h"
#include "manyThread.h"
#include "CustomThreads.h"
#include "digiSettingsPanel.h"
#include "scope.h"
@ -47,6 +47,7 @@ private slots:
void OpenScope();
void OpenDigitizersSettings();
void OpenSyncHelper();
void OpenSOLARISpanel();
bool CheckSOLARISpanelOK();
@ -105,6 +106,7 @@ private:
QPushButton * bnNewExp;
QLineEdit * leExpName;
QPushButton * bnSyncHelper;
QPushButton * bnOpenDigitizers;
QPushButton * bnCloseDigitizers;
@ -133,6 +135,7 @@ private:
QPushButton * bnStopACQ;
QCheckBox * chkSaveRun;
QComboBox * cbAutoRun;
QComboBox * cbDataFormat;
QLineEdit * leRunID;
QLineEdit * leRawDataPath;
QLineEdit * leRunComment;

0
makeTest Executable file → Normal file
View File

View File

@ -296,11 +296,12 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
rowID ++;
bnScopeStart = new QPushButton("Start", this);
layout->addWidget(bnScopeStart, rowID, 0);
bnScopeStart->setEnabled(false);
bnScopeStart->setEnabled(true);
connect(bnScopeStart, &QPushButton::clicked, this, [=](){this->StartScope();});
bnScopeStop = new QPushButton("Stop", this);
layout->addWidget(bnScopeStop, rowID, 1);
bnScopeStop->setEnabled(false);
connect(bnScopeStop, &QPushButton::clicked, this, &Scope::StopScope);
QLabel * lbTriggerRate = new QLabel("Trigger Rate [Hz] : ", this);
@ -479,6 +480,7 @@ void Scope::StopScope(){
digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1);
digiMTX[i].unlock();
readDataThread[i]->Stop();
readDataThread[i]->quit();
readDataThread[i]->wait();
}
@ -559,15 +561,15 @@ void Scope::ProbeChange(RComboBox * cb[], const int size ){
}
}
int ID = cbScopeDigi->currentIndex();
digiMTX[ID].lock();
//int ID = cbScopeDigi->currentIndex();
//digiMTX[ID].lock();
if( size == 2) {// analog probes
for( int j = 0; j < 2; j++ )dataTrace[j]->setName(cb[j]->currentText());
}
if( size == 4){ // digitial probes
for( int j = 2; j < 6; j++ )dataTrace[j]->setName(cb[j-2]->currentText());
}
digiMTX[ID].unlock();
//digiMTX[ID].unlock();
}

View File

@ -19,7 +19,7 @@
#include "macro.h"
#include "ClassDigitizer2Gen.h"
#include "manyThread.h"
#include "CustomThreads.h"
#include "CustomWidgets.h"
class Trace : public QChart{

View File

@ -9,7 +9,7 @@
void script(){
SolReader * reader = new SolReader("haha_000.sol");
SolReader * reader = new SolReader("/home/ryan/analysis/data_raw/test_000_01_21233_000.sol");
Event * evt = reader->evt;
printf("----------file size: %u Byte\n", reader->GetFileSize());