added Run Status in Scalar
This commit is contained in:
parent
3819e422bd
commit
b9b60f7c18
46
FSUDAQ.cpp
46
FSUDAQ.cpp
|
@ -243,7 +243,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
}
|
}
|
||||||
needManualComment = true;
|
needManualComment = true;
|
||||||
StopACQ();
|
StopACQ();
|
||||||
});
|
});
|
||||||
|
|
||||||
layout->addWidget(lbPrefix, rowID, 0);
|
layout->addWidget(lbPrefix, rowID, 0);
|
||||||
layout->addWidget(lePrefix, rowID, 1);
|
layout->addWidget(lePrefix, rowID, 1);
|
||||||
|
@ -826,13 +826,13 @@ void MainWindow::SetupScalar(){
|
||||||
lbScalarACQStatus = new QLabel("ACQ status", scalar);
|
lbScalarACQStatus = new QLabel("ACQ status", scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
lbLastUpdateTime->setAlignment(Qt::AlignCenter);
|
lbLastUpdateTime->setAlignment(Qt::AlignRight);
|
||||||
scalarLayout->removeWidget(lbLastUpdateTime);
|
scalarLayout->removeWidget(lbLastUpdateTime);
|
||||||
scalarLayout->addWidget(lbLastUpdateTime, 0, 1, 1, 1 + nDigi);
|
scalarLayout->addWidget(lbLastUpdateTime, 0, 0, 1, 1 + nDigi);
|
||||||
|
|
||||||
lbScalarACQStatus->setAlignment(Qt::AlignCenter);
|
lbScalarACQStatus->setAlignment(Qt::AlignCenter);
|
||||||
scalarLayout->removeWidget(lbScalarACQStatus);
|
scalarLayout->removeWidget(lbScalarACQStatus);
|
||||||
scalarLayout->addWidget(lbScalarACQStatus, 1, 1, 1, 1 + nDigi);
|
scalarLayout->addWidget(lbScalarACQStatus, 0, 1 + nDigi);
|
||||||
|
|
||||||
int rowID = 3;
|
int rowID = 3;
|
||||||
///==== create the header row
|
///==== create the header row
|
||||||
|
@ -861,9 +861,20 @@ void MainWindow::SetupScalar(){
|
||||||
for( int ch = 0; ch < digi[iDigi]->GetNumInputCh(); ch++){
|
for( int ch = 0; ch < digi[iDigi]->GetNumInputCh(); ch++){
|
||||||
|
|
||||||
if( ch == 0 ){
|
if( ch == 0 ){
|
||||||
|
QWidget * hBox = new QWidget(scalar);
|
||||||
|
QHBoxLayout * hBoxLayout = new QHBoxLayout(hBox);
|
||||||
|
scalarLayout->addWidget(hBox, rowID, 2*iDigi+1, 1, 2);
|
||||||
|
|
||||||
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
|
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
|
||||||
lbDigi->setAlignment(Qt::AlignCenter);
|
lbDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
scalarLayout->addWidget(lbDigi, rowID, 2*iDigi+1, 1, 2);
|
hBoxLayout->addWidget(lbDigi);
|
||||||
|
|
||||||
|
runStatus[iDigi] = new QPushButton("", scalar);
|
||||||
|
runStatus[iDigi]->setEnabled(false);
|
||||||
|
runStatus[iDigi]->setFixedSize(QSize(20,20));
|
||||||
|
runStatus[iDigi]->setToolTip("ACQ RUN On/OFF");
|
||||||
|
runStatus[iDigi]->setToolTipDuration(-1);
|
||||||
|
hBoxLayout->addWidget(runStatus[iDigi]);
|
||||||
|
|
||||||
rowID ++;
|
rowID ++;
|
||||||
|
|
||||||
|
@ -948,6 +959,13 @@ void MainWindow::UpdateScalar(){
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||||
digiMTX[iDigi].lock();
|
digiMTX[iDigi].lock();
|
||||||
|
|
||||||
|
uint32_t acqStatus = digi[iDigi]->ReadRegister(DPP::AcquisitionStatus_R);
|
||||||
|
if( ( acqStatus >> 2 ) & 0x1 ){
|
||||||
|
runStatus[iDigi]->setStyleSheet("background-color : green;");
|
||||||
|
}else{
|
||||||
|
runStatus[iDigi]->setStyleSheet("");
|
||||||
|
}
|
||||||
|
|
||||||
// printf("### %d ", iDigi);
|
// printf("### %d ", iDigi);
|
||||||
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
||||||
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
||||||
|
@ -976,6 +994,7 @@ void MainWindow::UpdateScalar(){
|
||||||
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
||||||
influx->AddDataPoint("FileSize value=" + std::to_string(totalFileSize));
|
influx->AddDataPoint("FileSize value=" + std::to_string(totalFileSize));
|
||||||
}
|
}
|
||||||
|
//influx->PrintDataPoints();
|
||||||
influx->WriteData(dataBaseName.toStdString());
|
influx->WriteData(dataBaseName.toStdString());
|
||||||
influx->ClearDataPointsBuffer();
|
influx->ClearDataPointsBuffer();
|
||||||
}
|
}
|
||||||
|
@ -1047,7 +1066,7 @@ if( chkSaveData->isChecked() ) SaveLastRunFile();
|
||||||
{//^=== elog and database
|
{//^=== elog and database
|
||||||
if( influx ){
|
if( influx ){
|
||||||
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
||||||
influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1");
|
if( elogName != "" ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1");
|
||||||
influx->WriteData(dataBaseName.toStdString());
|
influx->WriteData(dataBaseName.toStdString());
|
||||||
influx->ClearDataPointsBuffer();
|
influx->ClearDataPointsBuffer();
|
||||||
}
|
}
|
||||||
|
@ -1112,10 +1131,21 @@ void MainWindow::StopACQ(){
|
||||||
bnOpenScope->setEnabled(true);
|
bnOpenScope->setEnabled(true);
|
||||||
cbAutoRun->setEnabled(true);
|
cbAutoRun->setEnabled(true);
|
||||||
|
|
||||||
|
if( scalar ){
|
||||||
|
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
||||||
|
uint32_t acqStatus = digi[iDigi]->ReadRegister(DPP::AcquisitionStatus_R);
|
||||||
|
if( ( acqStatus >> 2 ) & 0x1 ){
|
||||||
|
runStatus[iDigi]->setStyleSheet("background-color : green;");
|
||||||
|
}else{
|
||||||
|
runStatus[iDigi]->setStyleSheet("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( digiSettings ) digiSettings->setEnabled(true);
|
if( digiSettings ) digiSettings->setEnabled(true);
|
||||||
|
|
||||||
{//^=== elog and database
|
{//^=== elog and database
|
||||||
if( influx ){
|
if( influx && elogName != "" ) {
|
||||||
influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
|
influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
|
||||||
influx->WriteData(dataBaseName.toStdString());
|
influx->WriteData(dataBaseName.toStdString());
|
||||||
influx->ClearDataPointsBuffer();
|
influx->ClearDataPointsBuffer();
|
||||||
|
|
1
FSUDAQ.h
1
FSUDAQ.h
|
@ -150,6 +150,7 @@ private:
|
||||||
TimingThread * scalarThread;
|
TimingThread * scalarThread;
|
||||||
QLineEdit *** leTrigger; // need to delete manually
|
QLineEdit *** leTrigger; // need to delete manually
|
||||||
QLineEdit *** leAccept; // need to delete manually
|
QLineEdit *** leAccept; // need to delete manually
|
||||||
|
QPushButton * runStatus[MaxNDigitizer];
|
||||||
QLabel * lbLastUpdateTime;
|
QLabel * lbLastUpdateTime;
|
||||||
QLabel * lbScalarACQStatus;
|
QLabel * lbScalarACQStatus;
|
||||||
|
|
||||||
|
|
37
Scope.cpp
37
Scope.cpp
|
@ -138,12 +138,20 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
layout->addWidget(bnClearBuffer, rowID, 4);
|
layout->addWidget(bnClearBuffer, rowID, 4);
|
||||||
connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1);});
|
connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1);});
|
||||||
|
|
||||||
|
QLabel * lbRun = new QLabel("Run Status : ", this);
|
||||||
|
lbRun->setAlignment(Qt::AlignCenter | Qt::AlignRight);
|
||||||
|
layout->addWidget(lbRun, rowID, 5);
|
||||||
|
|
||||||
|
runStatus = new QPushButton("", this);
|
||||||
|
runStatus->setEnabled(false);
|
||||||
|
runStatus->setFixedSize(QSize(20,20));
|
||||||
|
layout->addWidget(runStatus, rowID, 6);
|
||||||
|
|
||||||
//================ Trace settings
|
//================ Trace settings
|
||||||
rowID ++;
|
rowID ++;
|
||||||
{
|
{
|
||||||
settingGroup = new QGroupBox("Trace Settings",this);
|
settingGroup = new QGroupBox("Trace Settings",this);
|
||||||
layout->addWidget(settingGroup, rowID, 0, 1, 6);
|
layout->addWidget(settingGroup, rowID, 0, 1, 7);
|
||||||
|
|
||||||
settingLayout = new QGridLayout(settingGroup);
|
settingLayout = new QGridLayout(settingGroup);
|
||||||
settingLayout->setSpacing(0);
|
settingLayout->setSpacing(0);
|
||||||
|
@ -156,7 +164,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
//================ Plot view
|
//================ Plot view
|
||||||
rowID ++;
|
rowID ++;
|
||||||
plotView = new RChartView(plot, this);
|
plotView = new RChartView(plot, this);
|
||||||
layout->addWidget(plotView, rowID, 0, 1, 6);
|
layout->addWidget(plotView, rowID, 0, 1, 7);
|
||||||
|
|
||||||
|
|
||||||
//================ Key binding
|
//================ Key binding
|
||||||
|
@ -166,7 +174,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
|
|
||||||
QLabel * lbinfo = new QLabel("Trace updates every " + QString::number(updateTraceThread->GetWaitTimeinSec()) + " sec.", this);
|
QLabel * lbinfo = new QLabel("Trace updates every " + QString::number(updateTraceThread->GetWaitTimeinSec()) + " sec.", this);
|
||||||
lbinfo->setAlignment(Qt::AlignRight);
|
lbinfo->setAlignment(Qt::AlignRight);
|
||||||
layout->addWidget(lbinfo, rowID, 5);
|
layout->addWidget(lbinfo, rowID, 6);
|
||||||
|
|
||||||
rowID ++;
|
rowID ++;
|
||||||
//TODO =========== Trace step
|
//TODO =========== Trace step
|
||||||
|
@ -193,7 +201,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
layout->addWidget(leTriggerRate, rowID, 3);
|
layout->addWidget(leTriggerRate, rowID, 3);
|
||||||
|
|
||||||
QPushButton * bnClose = new QPushButton("Close", this);
|
QPushButton * bnClose = new QPushButton("Close", this);
|
||||||
layout->addWidget(bnClose, rowID, 5);
|
layout->addWidget(bnClose, rowID, 6);
|
||||||
connect(bnClose, &QPushButton::clicked, this, &Scope::close);
|
connect(bnClose, &QPushButton::clicked, this, &Scope::close);
|
||||||
|
|
||||||
layout->setColumnStretch(0, 1);
|
layout->setColumnStretch(0, 1);
|
||||||
|
@ -362,8 +370,16 @@ void Scope::UpdateScope(){
|
||||||
if( digi[ID]->GetInputChannelOnOff(ch) == false) return;
|
if( digi[ID]->GetInputChannelOnOff(ch) == false) return;
|
||||||
|
|
||||||
//printf("### %d %d \n", ch, digi[ID]->GetData()->DataIndex[ch]);
|
//printf("### %d %d \n", ch, digi[ID]->GetData()->DataIndex[ch]);
|
||||||
|
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
|
|
||||||
|
uint32_t acqStatus = digi[ID]->ReadRegister(DPP::AcquisitionStatus_R);
|
||||||
|
if( ( acqStatus >> 2 ) & 0x1 ){
|
||||||
|
runStatus->setStyleSheet("background-color : green;");
|
||||||
|
}else{
|
||||||
|
runStatus->setStyleSheet("");
|
||||||
|
}
|
||||||
|
|
||||||
Data * data = digi[ID]->GetData();
|
Data * data = digi[ID]->GetData();
|
||||||
|
|
||||||
//leTriggerRate->setText(QString::number(data->TriggerRate[ch]) + " [" + QString::number(data->NumEventsDecoded[ch]) + "]");
|
//leTriggerRate->setText(QString::number(data->TriggerRate[ch]) + " [" + QString::number(data->NumEventsDecoded[ch]) + "]");
|
||||||
|
@ -549,7 +565,7 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re
|
||||||
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ){
|
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ){
|
||||||
int grp = ch/8; // convert ch to grp
|
int grp = ch/8; // convert ch to grp
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
digi[ID]->WriteRegister(para, value, grp);
|
digi[ID]->WriteRegister(para, value, grp);
|
||||||
digiMTX[ID].unlock();
|
digiMTX[ID].unlock();
|
||||||
}else{
|
}else{
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
|
@ -764,7 +780,8 @@ void Scope::SetUpPanel_QDC() {
|
||||||
printf("==== %s \n", __func__);
|
printf("==== %s \n", __func__);
|
||||||
|
|
||||||
int rowID = 0;
|
int rowID = 0;
|
||||||
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::QDC::RecordLength);
|
|
||||||
|
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::QDC::RecordLength_W);
|
||||||
SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::QDC::PreTrigger);
|
SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::QDC::PreTrigger);
|
||||||
SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::QDC::DCOffset);
|
SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::QDC::DCOffset);
|
||||||
sbDCOffset->setDecimals(2);
|
sbDCOffset->setDecimals(2);
|
||||||
|
@ -774,7 +791,7 @@ void Scope::SetUpPanel_QDC() {
|
||||||
cbPolarity->addItem("Negative", 1);
|
cbPolarity->addItem("Negative", 1);
|
||||||
connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
digi[ID]->SetBits(DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex());
|
digi[ID]->SetBits(DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()/8);
|
||||||
});
|
});
|
||||||
|
|
||||||
rowID ++; //=============================================================
|
rowID ++; //=============================================================
|
||||||
|
@ -887,6 +904,10 @@ void Scope::EnableControl(bool enable){
|
||||||
cbPeakAvg->setEnabled(enable);
|
cbPeakAvg->setEnabled(enable);
|
||||||
sbPeakHoldOff->setEnabled(enable);
|
sbPeakHoldOff->setEnabled(enable);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
settingGroup->setEnabled(enable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
2
Scope.h
2
Scope.h
|
@ -101,6 +101,8 @@ private:
|
||||||
QGroupBox * settingGroup;
|
QGroupBox * settingGroup;
|
||||||
QGridLayout * settingLayout;
|
QGridLayout * settingLayout;
|
||||||
|
|
||||||
|
QPushButton * runStatus;
|
||||||
|
|
||||||
/// common to PSD and PHA
|
/// common to PSD and PHA
|
||||||
RSpinBox * sbReordLength;
|
RSpinBox * sbReordLength;
|
||||||
RSpinBox * sbPreTrigger;
|
RSpinBox * sbPreTrigger;
|
||||||
|
|
|
@ -144,7 +144,7 @@ void InfluxDB::Execute(){
|
||||||
respond = curl_easy_perform(curl);
|
respond = curl_easy_perform(curl);
|
||||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respondCode);
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respondCode);
|
||||||
//printf("==== respond %d (OK = %d)\n", respond, CURLE_OK);
|
//printf("==== respond %d (OK = %d)\n", respond, CURLE_OK);
|
||||||
if( respond != CURLE_OK) printf("############# InfluxDB::Execute fail\n");
|
if( respond != CURLE_OK) printf("############# InfluxDB::Execute fail | %ld\n", respondCode);
|
||||||
} catch (std::exception& e){ // in case of unexpected error
|
} catch (std::exception& e){ // in case of unexpected error
|
||||||
printf("%s\n", e.what());
|
printf("%s\n", e.what());
|
||||||
respond = CURLE_SEND_ERROR;
|
respond = CURLE_SEND_ERROR;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user