many UI bugs fix and improvement, save Setting to temSettings when close digitizers.
This commit is contained in:
parent
e56cddaf06
commit
66c7211d7a
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@ SOLARIS_DAQ
|
||||||
programSettings.txt
|
programSettings.txt
|
||||||
test
|
test
|
||||||
windowID
|
windowID
|
||||||
|
tempSettings
|
||||||
screenshot.*
|
screenshot.*
|
||||||
*settings*.txt
|
*settings*.txt
|
||||||
*settings*.dat
|
*settings*.dat
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
Digitizer2Gen::Digitizer2Gen(){
|
Digitizer2Gen::Digitizer2Gen(){
|
||||||
printf("======== %s \n",__func__);
|
//printf("======== %s \n",__func__);
|
||||||
Initialization();
|
Initialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Digitizer2Gen::~Digitizer2Gen(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Digitizer2Gen::Initialization(){
|
void Digitizer2Gen::Initialization(){
|
||||||
printf("======== %s \n",__func__);
|
//printf("======== %s \n",__func__);
|
||||||
|
|
||||||
handle = 0;
|
handle = 0;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -131,10 +131,10 @@ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Digitizer2Gen::WriteValue(const char * parameter, std::string value){
|
bool Digitizer2Gen::WriteValue(const char * parameter, std::string value, bool verbose){
|
||||||
if( !isConnected ) return false;
|
if( !isConnected ) return false;
|
||||||
//ReadValue(parameter, 1);
|
//ReadValue(parameter, 1);
|
||||||
printf(" %s|%d|%-45s|%s|\n", __func__, serialNumber, parameter, value.c_str());
|
if( verbose) printf(" %s|%d|%-45s|%s|\n", __func__, serialNumber, parameter, value.c_str());
|
||||||
ret = CAEN_FELib_SetValue(handle, parameter, value.c_str());
|
ret = CAEN_FELib_SetValue(handle, parameter, value.c_str());
|
||||||
if (ret != CAEN_FELib_Success) {
|
if (ret != CAEN_FELib_Success) {
|
||||||
printf("WriteError|%s||%s|\n", parameter, value.c_str());
|
printf("WriteError|%s||%s|\n", parameter, value.c_str());
|
||||||
|
@ -185,7 +185,7 @@ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
|
||||||
|
|
||||||
void Digitizer2Gen::SendCommand(const char * parameter){
|
void Digitizer2Gen::SendCommand(const char * parameter){
|
||||||
if( !isConnected ) return;
|
if( !isConnected ) return;
|
||||||
printf("Send Command : %s \n", parameter);
|
printf(" %s|%d|Send Command : %s \n", __func__, serialNumber, parameter);
|
||||||
ret = CAEN_FELib_SendCommand(handle, parameter);
|
ret = CAEN_FELib_SendCommand(handle, parameter);
|
||||||
if (ret != CAEN_FELib_Success) {
|
if (ret != CAEN_FELib_Success) {
|
||||||
ErrorMsg(__func__);
|
ErrorMsg(__func__);
|
||||||
|
@ -201,11 +201,11 @@ void Digitizer2Gen::SendCommand(std::string shortPara){
|
||||||
//########################################### Open digitizer
|
//########################################### Open digitizer
|
||||||
int Digitizer2Gen::OpenDigitizer(const char * url){
|
int Digitizer2Gen::OpenDigitizer(const char * url){
|
||||||
|
|
||||||
printf("======== %s \n",__func__);
|
//printf("======== %s \n",__func__);
|
||||||
|
|
||||||
ret = CAEN_FELib_Open(url, &handle);
|
ret = CAEN_FELib_Open(url, &handle);
|
||||||
|
|
||||||
printf("=== ret : %d | %d \n", ret, CAEN_FELib_Success);
|
//printf("=== ret : %d | %d \n", ret, CAEN_FELib_Success);
|
||||||
|
|
||||||
if (ret != CAEN_FELib_Success) {
|
if (ret != CAEN_FELib_Success) {
|
||||||
ErrorMsg(__func__);
|
ErrorMsg(__func__);
|
||||||
|
@ -744,7 +744,7 @@ std::string Digitizer2Gen::ErrorMsg(const char * funcName){
|
||||||
printf("%s failed\n", __func__);
|
printf("%s failed\n", __func__);
|
||||||
return errMsg;
|
return errMsg;
|
||||||
}
|
}
|
||||||
printf("Error msg (%d): %s\n", ret, msg);
|
if( ret != CAEN_FELib_Stop ) printf("Error msg (%d): %s\n", ret, msg);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,10 +753,19 @@ void Digitizer2Gen::ReadAllSettings(){
|
||||||
if( !isConnected ) return;
|
if( !isConnected ) return;
|
||||||
for(int i = 0; i < (int) boardSettings.size(); i++){
|
for(int i = 0; i < (int) boardSettings.size(); i++){
|
||||||
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
|
if( !(ModelName == "VX2745" && FPGAType == "DPP_PHA") &&
|
||||||
|
(boardSettings[i].GetPara() == PHA::DIG::TempSensADC1.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC2.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC3.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC4.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC5.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC6.GetPara()
|
||||||
|
)
|
||||||
|
) continue;
|
||||||
ReadValue(boardSettings[i]);
|
ReadValue(boardSettings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 4 ; i ++) ReadValue(VGASetting[i], i);
|
if( ModelName == "VX2745" && FPGAType == "DPP_PHA") for(int i = 0; i < 4 ; i ++) ReadValue(VGASetting[i], i);
|
||||||
|
|
||||||
for(int ch = 0; ch < nChannels ; ch++ ){
|
for(int ch = 0; ch < nChannels ; ch++ ){
|
||||||
for( int i = 0; i < (int) chSettings[ch].size(); i++){
|
for( int i = 0; i < (int) chSettings[ch].size(); i++){
|
||||||
|
@ -784,14 +793,16 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 4 ; i ++){
|
if( ModelName == "VX2745" && FPGAType == "DPP_PHA") {
|
||||||
totCount ++;
|
for(int i = 0; i < 4 ; i ++){
|
||||||
if( VGASetting[i].GetValue() == "" ) break;
|
totCount ++;
|
||||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", VGASetting[i].GetFullPara(i).c_str(),
|
if( VGASetting[i].GetValue() == "" ) break;
|
||||||
VGASetting[i].ReadWrite(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", VGASetting[i].GetFullPara(i).c_str(),
|
||||||
9000 + i,
|
VGASetting[i].ReadWrite(),
|
||||||
VGASetting[i].GetValue().c_str());
|
9000 + i,
|
||||||
count ++;
|
VGASetting[i].GetValue().c_str());
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for( int i = 0; i < (int) chSettings[0].size(); i++){
|
for( int i = 0; i < (int) chSettings[0].size(); i++){
|
||||||
for(int ch = 0; ch < nChannels ; ch++ ){
|
for(int ch = 0; ch < nChannels ; ch++ ){
|
||||||
|
@ -889,7 +900,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
|
||||||
VGASetting[id - 9000].SetValue(value);
|
VGASetting[id - 9000].SetValue(value);
|
||||||
}
|
}
|
||||||
//printf("%s|%s|%d|%s|\n", para, readWrite, id, value);
|
//printf("%s|%s|%d|%s|\n", para, readWrite, id, value);
|
||||||
if( std::strcmp(readWrite, "2") == 0 && isConnected) WriteValue(para, value);
|
if( std::strcmp(readWrite, "2") == 0 && isConnected) WriteValue(para, value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] para;
|
delete [] para;
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Digitizer2Gen {
|
||||||
|
|
||||||
std::string ReadValue(const char * parameter, bool verbose = false);
|
std::string ReadValue(const char * parameter, bool verbose = false);
|
||||||
std::string ReadValue(const Reg para, int ch_index = -1, bool verbose = false); // read digitizer and save to memory
|
std::string ReadValue(const Reg para, int ch_index = -1, bool verbose = false); // read digitizer and save to memory
|
||||||
bool WriteValue(const char * parameter, std::string value);
|
bool WriteValue(const char * parameter, std::string value, bool verbose = true);
|
||||||
bool WriteValue(const Reg para, std::string value, int ch_index = -1); // write digituzer and save to memory
|
bool WriteValue(const Reg para, std::string value, int ch_index = -1); // write digituzer and save to memory
|
||||||
void SendCommand(const char * parameter);
|
void SendCommand(const char * parameter);
|
||||||
void SendCommand(std::string shortPara);
|
void SendCommand(std::string shortPara);
|
||||||
|
|
|
@ -38,6 +38,9 @@ class RSpinBox : public QDoubleSpinBox{
|
||||||
setToolTipDuration(-1);
|
setToolTipDuration(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetStyleNormal() { setStyleSheet(""); }
|
||||||
|
void SetStyleGreen() { setStyleSheet("color:green"); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void returnPressed();
|
void returnPressed();
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -185,6 +185,9 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
rowIndex ++;
|
rowIndex ++;
|
||||||
QLabel * info = new QLabel("Only simple trigger is avalible. For complex trigger scheme, please use the setting panel.", this);
|
QLabel * info = new QLabel("Only simple trigger is avalible. For complex trigger scheme, please use the setting panel.", this);
|
||||||
mainLayout->addWidget(info, rowIndex, 0, 1, 4);
|
mainLayout->addWidget(info, rowIndex, 0, 1, 4);
|
||||||
|
rowIndex ++;
|
||||||
|
QLabel * info2 = new QLabel("The panel is defined by " + analysisPath + "/working/Mapping.h", this);
|
||||||
|
mainLayout->addWidget(info2, rowIndex, 0, 1, 4);
|
||||||
|
|
||||||
///=================================
|
///=================================
|
||||||
rowIndex ++;
|
rowIndex ++;
|
||||||
|
|
|
@ -133,7 +133,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
LEDStatus[iDigi][i]->setToolTip(QString::number(i) + " - " + LEDToolTip[i]);
|
LEDStatus[iDigi][i]->setToolTip(QString::number(i) + " - " + LEDToolTip[i]);
|
||||||
LEDStatus[iDigi][i]->setToolTipDuration(-1);
|
LEDStatus[iDigi][i]->setToolTipDuration(-1);
|
||||||
//TODO set tooltip position on top
|
//TODO set tooltip position on top
|
||||||
statusLayout->addWidget(LEDStatus[iDigi][i], 0, 1 + 19 - i);
|
statusLayout->addWidget(LEDStatus[iDigi][i], 0, 19 - i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
ACQStatus[iDigi][i]->setFixedSize(QSize(30,30));
|
ACQStatus[iDigi][i]->setFixedSize(QSize(30,30));
|
||||||
ACQStatus[iDigi][i]->setToolTip(QString::number(i) + " - " + ACQToolTip[i]);
|
ACQStatus[iDigi][i]->setToolTip(QString::number(i) + " - " + ACQToolTip[i]);
|
||||||
ACQStatus[iDigi][i]->setToolTipDuration(-1);
|
ACQStatus[iDigi][i]->setToolTipDuration(-1);
|
||||||
statusLayout->addWidget(ACQStatus[iDigi][i], 1, 1 + 7 - i);
|
statusLayout->addWidget(ACQStatus[iDigi][i], 1, 7 - i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------- Temperatures
|
//------- Temperatures
|
||||||
|
@ -210,24 +210,38 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
rowId ++;
|
rowId ++;
|
||||||
bnClearData[iDigi] = new QPushButton("Clear Data", tab);
|
bnClearData[iDigi] = new QPushButton("Clear Data", tab);
|
||||||
bnLayout->addWidget(bnClearData[iDigi], rowId, 0, 1, 2);
|
bnLayout->addWidget(bnClearData[iDigi], rowId, 0, 1, 2);
|
||||||
connect(bnClearData[iDigi], &QPushButton::clicked, this, [=](){ digi[ID]->SendCommand(PHA::DIG::ClearData); });
|
connect(bnClearData[iDigi], &QPushButton::clicked, this, [=](){
|
||||||
|
digi[ID]->SendCommand(PHA::DIG::ClearData);
|
||||||
|
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::ClearData.GetFullPara()));
|
||||||
|
});
|
||||||
|
|
||||||
bnArmACQ[iDigi] = new QPushButton("Arm ACQ", tab);
|
bnArmACQ[iDigi] = new QPushButton("Arm ACQ", tab);
|
||||||
bnLayout->addWidget(bnArmACQ[iDigi], rowId, 2, 1, 2);
|
bnLayout->addWidget(bnArmACQ[iDigi], rowId, 2, 1, 2);
|
||||||
connect(bnArmACQ[iDigi], &QPushButton::clicked, this, [=](){ digi[ID]->SendCommand(PHA::DIG::ArmACQ); });
|
connect(bnArmACQ[iDigi], &QPushButton::clicked, this, [=](){
|
||||||
|
digi[ID]->SendCommand(PHA::DIG::ArmACQ);
|
||||||
|
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::ArmACQ.GetFullPara()));
|
||||||
|
});
|
||||||
|
|
||||||
bnDisarmACQ[iDigi] = new QPushButton("Disarm ACQ", tab);
|
bnDisarmACQ[iDigi] = new QPushButton("Disarm ACQ", tab);
|
||||||
bnLayout->addWidget(bnDisarmACQ[iDigi], rowId, 4, 1, 2);
|
bnLayout->addWidget(bnDisarmACQ[iDigi], rowId, 4, 1, 2);
|
||||||
connect(bnDisarmACQ[iDigi], &QPushButton::clicked, this, [=](){ digi[ID]->SendCommand(PHA::DIG::DisarmACQ); });
|
connect(bnDisarmACQ[iDigi], &QPushButton::clicked, this, [=](){
|
||||||
|
digi[ID]->SendCommand(PHA::DIG::DisarmACQ);
|
||||||
|
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::DisarmACQ.GetFullPara()));
|
||||||
|
});
|
||||||
|
|
||||||
bnSoftwareStart[iDigi] = new QPushButton("Software Start ACQ", tab);
|
bnSoftwareStart[iDigi] = new QPushButton("Software Start ACQ", tab);
|
||||||
bnLayout->addWidget(bnSoftwareStart[iDigi], rowId, 6, 1, 2);
|
bnLayout->addWidget(bnSoftwareStart[iDigi], rowId, 6, 1, 2);
|
||||||
connect(bnSoftwareStart[iDigi], &QPushButton::clicked, this, [=](){ digi[ID]->SendCommand(PHA::DIG::SoftwareStartACQ); });
|
connect(bnSoftwareStart[iDigi], &QPushButton::clicked, this, [=](){
|
||||||
|
digi[ID]->SendCommand(PHA::DIG::SoftwareStartACQ);
|
||||||
|
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::SoftwareStartACQ.GetFullPara()));
|
||||||
|
});
|
||||||
|
|
||||||
bnSoftwareStop[iDigi] = new QPushButton("Software Stop ACQ", tab);
|
bnSoftwareStop[iDigi] = new QPushButton("Software Stop ACQ", tab);
|
||||||
bnLayout->addWidget(bnSoftwareStop[iDigi], rowId, 8, 1, 2);
|
bnLayout->addWidget(bnSoftwareStop[iDigi], rowId, 8, 1, 2);
|
||||||
connect(bnSoftwareStop[iDigi], &QPushButton::clicked, this, [=](){ digi[ID]->SendCommand(PHA::DIG::SoftwareStopACQ); });
|
connect(bnSoftwareStop[iDigi], &QPushButton::clicked, this, [=](){
|
||||||
|
digi[ID]->SendCommand(PHA::DIG::SoftwareStopACQ);
|
||||||
|
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::SoftwareStopACQ.GetFullPara()));
|
||||||
|
});
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
if( digi[iDigi]->IsDummy() || !digi[iDigi]->IsConnected() ){
|
if( digi[iDigi]->IsDummy() || !digi[iDigi]->IsConnected() ){
|
||||||
|
@ -1170,7 +1184,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
sbBdSettingsWrite = new RSpinBox(ICTab);
|
sbBdSettingsWrite = new RSpinBox(ICTab);
|
||||||
sbBdSettingsWrite->setFixedWidth(200);
|
sbBdSettingsWrite->setFixedWidth(200);
|
||||||
inquiryLayout->addWidget(sbBdSettingsWrite, rowID, 7);
|
inquiryLayout->addWidget(sbBdSettingsWrite, rowID, 7);
|
||||||
connect(sbBdSettingsWrite, &RSpinBox::valueChanged, this, [=](){ sbBdSettingsWrite->setStyleSheet("color: green;");});
|
connect(sbBdSettingsWrite, &RSpinBox::valueChanged, this, [=](){if( enableSignalSlot ) sbBdSettingsWrite->setStyleSheet("color: green;");});
|
||||||
connect(sbBdSettingsWrite, &RSpinBox::returnPressed, this, [=](){
|
connect(sbBdSettingsWrite, &RSpinBox::returnPressed, this, [=](){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
if( sbBdSettingsWrite->decimals() == 0 && sbBdSettingsWrite->singleStep() != 1) {
|
if( sbBdSettingsWrite->decimals() == 0 && sbBdSettingsWrite->singleStep() != 1) {
|
||||||
|
@ -1201,7 +1215,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
leBdSettingsWrite->setAlignment(Qt::AlignRight);
|
leBdSettingsWrite->setAlignment(Qt::AlignRight);
|
||||||
leBdSettingsWrite->setFixedWidth(200);
|
leBdSettingsWrite->setFixedWidth(200);
|
||||||
inquiryLayout->addWidget(leBdSettingsWrite, rowID, 8);
|
inquiryLayout->addWidget(leBdSettingsWrite, rowID, 8);
|
||||||
connect(leBdSettingsWrite, &QLineEdit::textChanged, this, [=](){leBdSettingsWrite->setStyleSheet("color: green;");});
|
connect(leBdSettingsWrite, &QLineEdit::textChanged, this, [=](){if( enableSignalSlot )leBdSettingsWrite->setStyleSheet("color: green;");});
|
||||||
connect(leBdSettingsWrite, &QLineEdit::returnPressed, this, [=](){
|
connect(leBdSettingsWrite, &QLineEdit::returnPressed, this, [=](){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
std::string value = leBdSettingsWrite->text().toStdString();
|
std::string value = leBdSettingsWrite->text().toStdString();
|
||||||
|
@ -1289,7 +1303,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
sbChSettingsWrite = new RSpinBox(ICTab);
|
sbChSettingsWrite = new RSpinBox(ICTab);
|
||||||
sbChSettingsWrite->setFixedWidth(200);
|
sbChSettingsWrite->setFixedWidth(200);
|
||||||
inquiryLayout->addWidget(sbChSettingsWrite, rowID, 7);
|
inquiryLayout->addWidget(sbChSettingsWrite, rowID, 7);
|
||||||
connect(sbChSettingsWrite, &RSpinBox::valueChanged, this, [=](){ sbChSettingsWrite->setStyleSheet("color: green;");});
|
connect(sbChSettingsWrite, &RSpinBox::valueChanged, this, [=](){ if( enableSignalSlot ) sbChSettingsWrite->setStyleSheet("color: green;");});
|
||||||
connect(sbChSettingsWrite, &RSpinBox::returnPressed, this, [=](){
|
connect(sbChSettingsWrite, &RSpinBox::returnPressed, this, [=](){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
if( sbChSettingsWrite->decimals() == 0 && sbChSettingsWrite->singleStep() != 1) {
|
if( sbChSettingsWrite->decimals() == 0 && sbChSettingsWrite->singleStep() != 1) {
|
||||||
|
@ -1321,7 +1335,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
leChSettingsWrite = new QLineEdit(ICTab);
|
leChSettingsWrite = new QLineEdit(ICTab);
|
||||||
leChSettingsWrite->setFixedWidth(200);
|
leChSettingsWrite->setFixedWidth(200);
|
||||||
inquiryLayout->addWidget(leChSettingsWrite, rowID, 8);
|
inquiryLayout->addWidget(leChSettingsWrite, rowID, 8);
|
||||||
connect(leChSettingsWrite, &QLineEdit::textChanged, this, [=](){leChSettingsWrite->setStyleSheet("color: green;");});
|
connect(leChSettingsWrite, &QLineEdit::textChanged, this, [=](){if( enableSignalSlot ) leChSettingsWrite->setStyleSheet("color: green;");});
|
||||||
connect(leChSettingsWrite, &QLineEdit::returnPressed, this, [=](){
|
connect(leChSettingsWrite, &QLineEdit::returnPressed, this, [=](){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
std::string value = leChSettingsWrite->text().toStdString();
|
std::string value = leChSettingsWrite->text().toStdString();
|
||||||
|
|
|
@ -117,6 +117,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
QPushButton * bnEventBuilder = new QPushButton("Event Builder", this);
|
QPushButton * bnEventBuilder = new QPushButton("Event Builder", this);
|
||||||
bnEventBuilder->setEnabled(false);
|
bnEventBuilder->setEnabled(false);
|
||||||
|
|
||||||
|
QPushButton * bnHVController = new QPushButton("HV Controller", this);
|
||||||
|
bnHVController->setEnabled(false);
|
||||||
|
|
||||||
|
QPushButton * bnTargetFanController = new QPushButton("Target Fan", this);
|
||||||
|
bnTargetFanController->setEnabled(false);
|
||||||
|
|
||||||
layout1->addWidget(bnProgramSettings, 0, 0);
|
layout1->addWidget(bnProgramSettings, 0, 0);
|
||||||
layout1->addWidget(bnNewExp, 0, 1);
|
layout1->addWidget(bnNewExp, 0, 1);
|
||||||
layout1->addWidget(lExpName, 0, 2);
|
layout1->addWidget(lExpName, 0, 2);
|
||||||
|
@ -130,6 +136,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
layout1->addWidget(bnSOLSettings, 2, 2, 1, 2);
|
layout1->addWidget(bnSOLSettings, 2, 2, 1, 2);
|
||||||
|
|
||||||
layout1->addWidget(bnEventBuilder, 3, 0);
|
layout1->addWidget(bnEventBuilder, 3, 0);
|
||||||
|
layout1->addWidget(bnHVController, 3, 1);
|
||||||
|
layout1->addWidget(bnTargetFanController, 3, 2, 1, 2);
|
||||||
|
|
||||||
layout1->setColumnStretch(0, 2);
|
layout1->setColumnStretch(0, 2);
|
||||||
layout1->setColumnStretch(1, 2);
|
layout1->setColumnStretch(1, 2);
|
||||||
|
@ -181,6 +189,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
cbAutoRun->addItem("Every 5 hrs", -300);
|
cbAutoRun->addItem("Every 5 hrs", -300);
|
||||||
cbAutoRun->setEnabled(false);
|
cbAutoRun->setEnabled(false);
|
||||||
|
|
||||||
|
QComboBox * 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->setEnabled(false);
|
||||||
|
|
||||||
bnStartACQ = new QPushButton("Start ACQ", this);
|
bnStartACQ = new QPushButton("Start ACQ", this);
|
||||||
bnStartACQ->setEnabled(false);
|
bnStartACQ->setEnabled(false);
|
||||||
//connect(bnStartACQ, &QPushButton::clicked, this, &MainWindow::StartACQ);
|
//connect(bnStartACQ, &QPushButton::clicked, this, &MainWindow::StartACQ);
|
||||||
|
@ -214,26 +230,28 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
bnComment->setEnabled(false);
|
bnComment->setEnabled(false);
|
||||||
|
|
||||||
layout2->addWidget(lbRawDataPath, 0, 0);
|
layout2->addWidget(lbRawDataPath, 0, 0);
|
||||||
layout2->addWidget(leRawDataPath, 0, 1, 1, 4);
|
layout2->addWidget(leRawDataPath, 0, 1, 1, 5);
|
||||||
layout2->addWidget(bnOpenScalar, 0, 5);
|
layout2->addWidget(bnOpenScalar, 0, 6);
|
||||||
|
|
||||||
layout2->addWidget(lbRunID, 1, 0);
|
layout2->addWidget(lbRunID, 1, 0);
|
||||||
layout2->addWidget(leRunID, 1, 1);
|
layout2->addWidget(leRunID, 1, 1);
|
||||||
layout2->addWidget(chkSaveRun, 1, 2);
|
layout2->addWidget(chkSaveRun, 1, 2);
|
||||||
layout2->addWidget(cbAutoRun, 1, 3);
|
layout2->addWidget(cbAutoRun, 1, 3);
|
||||||
layout2->addWidget(bnStartACQ, 1, 4);
|
layout2->addWidget(cbDataFormat, 1, 4);
|
||||||
layout2->addWidget(bnStopACQ, 1, 5);
|
layout2->addWidget(bnStartACQ, 1, 5);
|
||||||
|
layout2->addWidget(bnStopACQ, 1, 6);
|
||||||
|
|
||||||
layout2->addWidget(lbRunComment, 2, 0);
|
layout2->addWidget(lbRunComment, 2, 0);
|
||||||
layout2->addWidget(leRunComment, 2, 1, 1, 4);
|
layout2->addWidget(leRunComment, 2, 1, 1, 5);
|
||||||
layout2->addWidget(bnComment, 2, 5);
|
layout2->addWidget(bnComment, 2, 6);
|
||||||
|
|
||||||
layout2->setColumnStretch(0, 2);
|
layout2->setColumnStretch(0, 1);
|
||||||
layout2->setColumnStretch(1, 1);
|
layout2->setColumnStretch(1, 1);
|
||||||
layout2->setColumnStretch(2, 1);
|
layout2->setColumnStretch(2, 1);
|
||||||
layout2->setColumnStretch(3, 1);
|
layout2->setColumnStretch(3, 1);
|
||||||
layout2->setColumnStretch(4, 3);
|
layout2->setColumnStretch(4, 1);
|
||||||
layout2->setColumnStretch(5, 3);
|
layout2->setColumnStretch(5, 3);
|
||||||
|
layout2->setColumnStretch(6, 3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,6 +735,12 @@ void MainWindow::CloseDigitizers(){
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
if( digi[i] == NULL) return;
|
if( digi[i] == NULL) return;
|
||||||
|
|
||||||
|
if( digi[i]->IsConnected() ){
|
||||||
|
int digiSN = digi[i]->GetSerialNumber();
|
||||||
|
LogMsg("Save digi-"+ QString::number(digiSN) + " Settings to " + settingFilePath + "/tempSettings/");
|
||||||
|
digi[i]->SaveSettingsToFile((settingFilePath + "/tempSettings/Setting_" + QString::number(digiSN)).toStdString().c_str());
|
||||||
|
}
|
||||||
digi[i]->CloseDigitizer();
|
digi[i]->CloseDigitizer();
|
||||||
delete digi[i];
|
delete digi[i];
|
||||||
|
|
||||||
|
@ -770,6 +794,11 @@ void MainWindow::OpenScope(){
|
||||||
influx->AddDataPoint(onOff ? "StartStop value=1" : "StartStop value=0");
|
influx->AddDataPoint(onOff ? "StartStop value=1" : "StartStop value=0");
|
||||||
influx->WriteData(DatabaseName.toStdString());
|
influx->WriteData(DatabaseName.toStdString());
|
||||||
}
|
}
|
||||||
|
if( onOff){
|
||||||
|
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||||
|
}else{
|
||||||
|
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if( influx ){
|
if( influx ){
|
||||||
|
@ -782,8 +811,11 @@ void MainWindow::OpenScope(){
|
||||||
digiSetting->EnableControl();
|
digiSetting->EnableControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope->StartScope();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
scope->show();
|
scope->show();
|
||||||
|
scope->StartScope();
|
||||||
if( digiSetting ) digiSetting->EnableControl();
|
if( digiSetting ) digiSetting->EnableControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -965,12 +997,16 @@ void MainWindow::SetUpScalar(){
|
||||||
|
|
||||||
scalar->setGeometry(0, 0, 10 + nDigi * 230, 1500);
|
scalar->setGeometry(0, 0, 10 + nDigi * 230, 1500);
|
||||||
|
|
||||||
lbLastUpdateTime = new QLabel("Last update : ");
|
if( lbLastUpdateTime == nullptr ) { // use lbLastUpdateTime as a flag
|
||||||
|
lbLastUpdateTime = new QLabel("Last update : ", scalar);
|
||||||
|
lbScalarACQStatus = new QLabel("ACQ status", scalar);
|
||||||
|
}
|
||||||
lbLastUpdateTime->setAlignment(Qt::AlignCenter);
|
lbLastUpdateTime->setAlignment(Qt::AlignCenter);
|
||||||
|
scalarLayout->removeWidget(lbLastUpdateTime);
|
||||||
scalarLayout->addWidget(lbLastUpdateTime, 0, 1, 1, 1 + nDigi);
|
scalarLayout->addWidget(lbLastUpdateTime, 0, 1, 1, 1 + nDigi);
|
||||||
|
|
||||||
lbScalarACQStatus = new QLabel("ACQ status");
|
|
||||||
lbScalarACQStatus->setAlignment(Qt::AlignCenter);
|
lbScalarACQStatus->setAlignment(Qt::AlignCenter);
|
||||||
|
scalarLayout->removeWidget(lbScalarACQStatus);
|
||||||
scalarLayout->addWidget(lbScalarACQStatus, 1, 1, 1, 1 + nDigi);
|
scalarLayout->addWidget(lbScalarACQStatus, 1, 1, 1, 1 + nDigi);
|
||||||
|
|
||||||
///==== create the 1st row
|
///==== create the 1st row
|
||||||
|
@ -978,13 +1014,18 @@ void MainWindow::SetUpScalar(){
|
||||||
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||||
|
|
||||||
if( ch == 0 ){
|
if( ch == 0 ){
|
||||||
QLabel * lbCH_H = new QLabel("Ch", scalar); scalarLayout->addWidget(lbCH_H, rowID, 0);
|
if( lbLastUpdateTime == nullptr ) {
|
||||||
|
QLabel * lbCH_H = new QLabel("Ch", scalar);
|
||||||
|
scalarLayout->addWidget(lbCH_H, rowID, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rowID ++;
|
rowID ++;
|
||||||
QLabel * lbCH = new QLabel(QString::number(ch), scalar);
|
if( lbLastUpdateTime == nullptr ) {
|
||||||
lbCH->setAlignment(Qt::AlignCenter);
|
QLabel * lbCH = new QLabel(QString::number(ch), scalar);
|
||||||
scalarLayout->addWidget(lbCH, rowID, 0);
|
lbCH->setAlignment(Qt::AlignCenter);
|
||||||
|
scalarLayout->addWidget(lbCH, rowID, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///===== create the trigger and accept
|
///===== create the trigger and accept
|
||||||
|
@ -1013,12 +1054,12 @@ void MainWindow::SetUpScalar(){
|
||||||
|
|
||||||
rowID ++;
|
rowID ++;
|
||||||
|
|
||||||
leTrigger[iDigi][ch] = new QLineEdit();
|
leTrigger[iDigi][ch] = new QLineEdit(scalar);
|
||||||
leTrigger[iDigi][ch]->setReadOnly(true);
|
leTrigger[iDigi][ch]->setReadOnly(true);
|
||||||
leTrigger[iDigi][ch]->setAlignment(Qt::AlignRight);
|
leTrigger[iDigi][ch]->setAlignment(Qt::AlignRight);
|
||||||
scalarLayout->addWidget(leTrigger[iDigi][ch], rowID, 2*iDigi+1);
|
scalarLayout->addWidget(leTrigger[iDigi][ch], rowID, 2*iDigi+1);
|
||||||
|
|
||||||
leAccept[iDigi][ch] = new QLineEdit();
|
leAccept[iDigi][ch] = new QLineEdit(scalar);
|
||||||
leAccept[iDigi][ch]->setReadOnly(true);
|
leAccept[iDigi][ch]->setReadOnly(true);
|
||||||
leAccept[iDigi][ch]->setAlignment(Qt::AlignRight);
|
leAccept[iDigi][ch]->setAlignment(Qt::AlignRight);
|
||||||
leAccept[iDigi][ch]->setStyleSheet("background-color: #F0F0F0;");
|
leAccept[iDigi][ch]->setStyleSheet("background-color: #F0F0F0;");
|
||||||
|
@ -1028,6 +1069,7 @@ void MainWindow::SetUpScalar(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::DeleteTriggerLineEdit(){
|
void MainWindow::DeleteTriggerLineEdit(){
|
||||||
|
|
||||||
if( leTrigger ) return;
|
if( leTrigger ) return;
|
||||||
|
|
15
scope.cpp
15
scope.cpp
|
@ -317,17 +317,25 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
StartScope();
|
//StartScope();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope::~Scope(){
|
Scope::~Scope(){
|
||||||
|
|
||||||
|
printf("------- %s \n", __func__);
|
||||||
|
|
||||||
|
StopScope();
|
||||||
|
|
||||||
|
printf("------- A \n");
|
||||||
updateTraceThread->Stop();
|
updateTraceThread->Stop();
|
||||||
updateTraceThread->quit();
|
updateTraceThread->quit();
|
||||||
updateTraceThread->wait();
|
updateTraceThread->wait();
|
||||||
delete updateTraceThread;
|
delete updateTraceThread;
|
||||||
for( int i = 0; i < 6; i++) delete dataTrace[i];
|
for( int i = 0; i < 6; i++) delete dataTrace[i];
|
||||||
|
printf("------- B \n");
|
||||||
delete plot;
|
delete plot;
|
||||||
|
printf("------- C \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ReadScopeSettings(){
|
void Scope::ReadScopeSettings(){
|
||||||
|
@ -536,8 +544,7 @@ void Scope::UpdateScope(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ProbeChange(RComboBox * cb[], const int size ){
|
void Scope::ProbeChange(RComboBox * cb[], const int size ){
|
||||||
|
//printf("%s\n", __func__);
|
||||||
printf("%s\n", __func__);
|
|
||||||
QStandardItemModel * model[size] = {NULL};
|
QStandardItemModel * model[size] = {NULL};
|
||||||
for( int i = 0; i < size; i++){
|
for( int i = 0; i < size; i++){
|
||||||
model[i] = qobject_cast<QStandardItemModel*>(cb[i]->model());
|
model[i] = qobject_cast<QStandardItemModel*>(cb[i]->model());
|
||||||
|
@ -613,7 +620,7 @@ void Scope::ScopeReadComboBoxValue(int iDigi, int ch, RComboBox *cb, const Reg d
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ScopeMakeSpinBox(RSpinBox * &sb, QString str, QGridLayout *layout, int row, int col, const Reg digPara){
|
void Scope::ScopeMakeSpinBox(RSpinBox * &sb, QString str, QGridLayout *layout, int row, int col, const Reg digPara){
|
||||||
printf("%s\n", __func__);
|
//printf("%s\n", __func__);
|
||||||
QLabel * lb = new QLabel(str, this);
|
QLabel * lb = new QLabel(str, this);
|
||||||
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
layout->addWidget(lb, row, col);
|
layout->addWidget(lb, row, col);
|
||||||
|
|
4
scope.h
4
scope.h
|
@ -129,10 +129,10 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void ReadScopeSettings(); // read from digitizer and show;
|
void ReadScopeSettings(); // read from digitizer and show;
|
||||||
void UpdateSettingsFromMemeory();
|
void UpdateSettingsFromMemeory();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void StartScope();
|
void StartScope();
|
||||||
void StopScope();
|
void StopScope();
|
||||||
|
|
||||||
|
private slots:
|
||||||
void UpdateScope();
|
void UpdateScope();
|
||||||
void ScopeControlOnOff(bool on);
|
void ScopeControlOnOff(bool on);
|
||||||
void ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara);
|
void ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user