change the scalar update rountine. scalar will update every 2 sec once it opened and keep running unit digitizer closed. scalar also update board status if digi setting pannel open
This commit is contained in:
parent
8169567af2
commit
7845b8fb8c
|
@ -537,39 +537,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
vgaLayout->setAlignment(Qt::AlignTop| Qt::AlignLeft);
|
||||
|
||||
for( int k = 0; k < 4; k ++){
|
||||
QLabel * lb = new QLabel("VGA-" + QString::number(k) + " [dB] :", tab);
|
||||
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
vgaLayout->addWidget(lb, k, 0);
|
||||
|
||||
VGA[iDigi][k] = new RSpinBox(tab, 1);
|
||||
VGA[iDigi][k]->setMinimum(0);
|
||||
VGA[iDigi][k]->setMaximum(40);
|
||||
SetupSpinBox(VGA[iDigi][k], PHA::VGA::VGAGain, -1, false, "VGA-" + QString::number(k) + " [dB] :", vgaLayout, k, 0);
|
||||
VGA[iDigi][k]->setSingleStep(0.5);
|
||||
VGA[iDigi][k]->setFixedWidth(40);
|
||||
VGA[iDigi][k]->SetToolTip();
|
||||
|
||||
vgaLayout->addWidget(VGA[iDigi][k], k, 1);
|
||||
connect(VGA[iDigi][k], &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
VGA[ID][k]->setStyleSheet("color:blue;");
|
||||
});
|
||||
connect(VGA[iDigi][k], &RSpinBox::returnPressed, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
|
||||
double step = VGA[ID][k]->singleStep();
|
||||
double value = VGA[ID][k]->value();
|
||||
VGA[ID][k]->setValue( (std::round(value/step) * step) );
|
||||
QString msg;
|
||||
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)){
|
||||
VGA[ID][k]->setStyleSheet("");
|
||||
SendLogMsg(msg + "|OK.");
|
||||
}else{
|
||||
VGA[ID][k]->setStyleSheet("color:red;");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,18 +559,18 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
SetupSpinBox( sbITLAMajority[iDigi], PHA::DIG::ITLAMajorityLev, -1, false, "Majority", aLayout, 1, 0);
|
||||
SetupComboBox(cbITLAPairLogic[iDigi], PHA::DIG::ITLAPairLogic, -1, false, "Pair Logic", aLayout, 2, 0);
|
||||
SetupComboBox(cbITLAPolarity[iDigi], PHA::DIG::ITLAPolarity, -1, false, "Polarity", aLayout, 3, 0);
|
||||
SetupSpinBox( sbITLAGateWidth[iDigi], PHA::DIG::ITLAGateWidth, -1, false, "GateWidth [ns]", aLayout, 4, 0);
|
||||
SetupSpinBox( sbITLAGateWidth[iDigi], PHA::DIG::ITLAGateWidth, -1, false, "Output GateWidth [ns]", aLayout, 4, 0);
|
||||
|
||||
|
||||
QGroupBox * gbITLB = new QGroupBox("ITL-B", bdITL[iDigi]);
|
||||
ITLLayout->addWidget(gbITLB, 0, 1);
|
||||
QGridLayout * bLayout = new QGridLayout(gbITLB);
|
||||
|
||||
SetupComboBox(cbITLBMainLogic[iDigi], PHA::DIG::ITLAMainLogic, -1, false, "Main Logic", bLayout, 0, 0);
|
||||
SetupSpinBox( sbITLBMajority[iDigi], PHA::DIG::ITLAMajorityLev, -1, false, "Majority", bLayout, 1, 0);
|
||||
SetupComboBox(cbITLBPairLogic[iDigi], PHA::DIG::ITLAPairLogic, -1, false, "Pair Logic", bLayout, 2, 0);
|
||||
SetupComboBox(cbITLBPolarity[iDigi], PHA::DIG::ITLAPolarity, -1, false, "Polarity", bLayout, 3, 0);
|
||||
SetupSpinBox( sbITLBGateWidth[iDigi], PHA::DIG::ITLAGateWidth, -1, false, "GateWidth [ns]", bLayout, 4, 0);
|
||||
SetupComboBox(cbITLBMainLogic[iDigi], PHA::DIG::ITLBMainLogic, -1, false, "Main Logic", bLayout, 0, 0);
|
||||
SetupSpinBox( sbITLBMajority[iDigi], PHA::DIG::ITLBMajorityLev, -1, false, "Majority", bLayout, 1, 0);
|
||||
SetupComboBox(cbITLBPairLogic[iDigi], PHA::DIG::ITLBPairLogic, -1, false, "Pair Logic", bLayout, 2, 0);
|
||||
SetupComboBox(cbITLBPolarity[iDigi], PHA::DIG::ITLBPolarity, -1, false, "Polarity", bLayout, 3, 0);
|
||||
SetupSpinBox( sbITLBGateWidth[iDigi], PHA::DIG::ITLBGateWidth, -1, false, "Output GateWidth [ns]", bLayout, 4, 0);
|
||||
|
||||
|
||||
QGroupBox * gbITL = new QGroupBox("ITL-Connect", bdITL[iDigi]);
|
||||
|
@ -1775,6 +1747,7 @@ void DigiSettingsPanel::UpdateStatus(){
|
|||
digi[ID]->ReadValue(PHA::DIG::ACQ_status);
|
||||
|
||||
for( int i = 0; i < (int) PHA::DIG::TempSensADC.size(); i++){
|
||||
if( digi[ID]->GetModelName() != "VX2745" && i > 0 ) continue;
|
||||
digi[ID]->ReadValue(PHA::DIG::TempSensADC[i]);
|
||||
}
|
||||
for( int i = 0; i < (int) PHA::DIG::TempSensOthers.size(); i++){
|
||||
|
@ -1798,6 +1771,9 @@ void DigiSettingsPanel::EnableControl(){
|
|||
|
||||
bdCfg[id]->setEnabled(enable);
|
||||
bdTestPulse[id]->setEnabled(enable);
|
||||
bdVGA[id]->setEnabled(enable);
|
||||
bdLVDS[id]->setEnabled(enable);
|
||||
bdITL[id]->setEnabled(enable);
|
||||
|
||||
box1[id]->setEnabled(enable);
|
||||
box3[id]->setEnabled(enable);
|
||||
|
|
|
@ -42,8 +42,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
|
||||
runTimer = new QTimer();
|
||||
needManualComment = true;
|
||||
isRunning = false;
|
||||
|
||||
{
|
||||
scalarOutputInflux = false;
|
||||
scalar = new QMainWindow(this);
|
||||
scalar->setWindowTitle("Scalar");
|
||||
scalar->setGeometry(0, 0, 1000, 800);
|
||||
|
@ -333,6 +335,11 @@ MainWindow::~MainWindow(){
|
|||
CloseDigitizers(); // SOlaris panel, digiSetting, scope are also deleted.
|
||||
|
||||
printf("-------- Delete scalar Thread\n");
|
||||
if( scalarThread->isRunning()){
|
||||
scalarThread->Stop();
|
||||
scalarThread->quit();
|
||||
scalarThread->wait();
|
||||
}
|
||||
CleanUpScalar();
|
||||
delete scalarThread;
|
||||
|
||||
|
@ -460,8 +467,10 @@ int MainWindow::StartACQ(){
|
|||
}
|
||||
|
||||
if( !scalar->isVisible() ) scalar->show();
|
||||
isRunning = True;
|
||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||
scalarThread->start();
|
||||
//scalarThread->start();
|
||||
scalarOutputInflux = true;
|
||||
|
||||
return 1;
|
||||
|
||||
|
@ -521,11 +530,12 @@ void MainWindow::StopACQ(){
|
|||
if( chkSaveRun->isChecked() ) digi[i]->CloseOutFile();
|
||||
}
|
||||
|
||||
if( scalarThread->isRunning()){
|
||||
scalarThread->Stop();
|
||||
scalarThread->quit();
|
||||
scalarThread->wait();
|
||||
}
|
||||
// if( scalarThread->isRunning()){
|
||||
// scalarThread->Stop();
|
||||
// scalarThread->quit();
|
||||
// scalarThread->wait();
|
||||
// }
|
||||
scalarOutputInflux = false;
|
||||
|
||||
if( influx ){
|
||||
influx->ClearDataPointsBuffer();
|
||||
|
@ -557,6 +567,7 @@ void MainWindow::StopACQ(){
|
|||
LogMsg("=========================== no-Save Run stopped.");
|
||||
}
|
||||
|
||||
isRunning = false;
|
||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||
|
||||
}
|
||||
|
@ -855,7 +866,7 @@ void MainWindow::OpenScope(){
|
|||
if( !scope ){
|
||||
scope = new Scope(digi, nDigi, readDataThread);
|
||||
connect(scope, &Scope::CloseWindow, this, [=](){ bnStartACQ->setEnabled(true); });
|
||||
connect(scope, &Scope::UpdateScalar, this, &MainWindow::UpdateScalar);
|
||||
//connect(scope, &Scope::UpdateScalar, this, &MainWindow::UpdateScalar);
|
||||
connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
|
||||
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanel(0);});
|
||||
connect(scope, &Scope::TellACQOnOff, this, [=](const bool onOff){
|
||||
|
@ -1063,6 +1074,13 @@ void MainWindow::UpdateAllPanel(int panelID){
|
|||
//^###################################################################### Open Scaler, when DAQ is running
|
||||
void MainWindow::OpenScaler(){
|
||||
scalar->show();
|
||||
if( isRunning ) {
|
||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||
}else{
|
||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||
}
|
||||
|
||||
scalarThread->start();
|
||||
|
||||
if( scalar->isVisible() ) scalar->activateWindow();
|
||||
}
|
||||
|
@ -1081,8 +1099,12 @@ void MainWindow::SetUpScalar(){
|
|||
scalarLayout->removeWidget(lbScalarACQStatus);
|
||||
scalarLayout->addWidget(lbScalarACQStatus, 1, 1, 1, 1 + nDigi);
|
||||
|
||||
// QPushButton * bnUpdateScaler = new QPushButton("Manual Update", scalar);
|
||||
// scalarLayout->addWidget(bnUpdateScaler, 2, 1, 1, 1 + nDigi);
|
||||
// connect(bnUpdateScaler, &QPushButton::clicked, this, &MainWindow::UpdateScalar);
|
||||
|
||||
///==== create the 1st row
|
||||
int rowID = 3;
|
||||
int rowID = 4;
|
||||
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||
|
||||
if( ch == 0 ){
|
||||
|
@ -1100,7 +1122,7 @@ void MainWindow::SetUpScalar(){
|
|||
leTrigger = new QLineEdit**[nDigi];
|
||||
leAccept = new QLineEdit**[nDigi];
|
||||
for( int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||
rowID = 2;
|
||||
rowID = 3;
|
||||
leTrigger[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
||||
leAccept[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
||||
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||
|
@ -1165,7 +1187,7 @@ void MainWindow::UpdateScalar(){
|
|||
|
||||
lbLastUpdateTime->setText("Last update: " + QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"));
|
||||
|
||||
if( influx ) influx->ClearDataPointsBuffer();
|
||||
if( influx && scalarOutputInflux) influx->ClearDataPointsBuffer();
|
||||
std::string haha[MaxNumberOfChannel] = {""};
|
||||
double acceptRate[MaxNumberOfChannel] = {0};
|
||||
|
||||
|
@ -1209,7 +1231,7 @@ void MainWindow::UpdateScalar(){
|
|||
}
|
||||
|
||||
///============== push the trigger, acceptRate rate database
|
||||
if( influx ){
|
||||
if( influx && scalarOutputInflux ){
|
||||
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++ ){
|
||||
influx->AddDataPoint("Rate,Bd=" + std::to_string(digi[iDigi]->GetSerialNumber()) + ",Ch=" + QString::number(ch).rightJustified(2, '0').toStdString() + " value=" + haha[ch]);
|
||||
if( !std::isnan(acceptRate[ch]) ) influx->AddDataPoint("AccpRate,Bd=" + std::to_string(digi[iDigi]->GetSerialNumber()) + ",Ch=" + QString::number(ch).rightJustified(2, '0').toStdString() + " value=" + std::to_string(acceptRate[ch]));
|
||||
|
@ -1218,7 +1240,7 @@ void MainWindow::UpdateScalar(){
|
|||
totalFileSize += digi[iDigi]->GetTotalFilesSize();
|
||||
}
|
||||
|
||||
if( influx && influx->GetDataLength() > 0 ){
|
||||
if( influx && influx->GetDataLength() > 0 && scalarOutputInflux ){
|
||||
if( chkSaveRun->isChecked() ) influx->AddDataPoint("FileSize value=" + std::to_string(totalFileSize));
|
||||
//influx->PrintDataPoints();
|
||||
influx->WriteData(DatabaseName.toStdString());
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
QLineEdit *** leAccept; // need to delete manually
|
||||
QLabel * lbLastUpdateTime;
|
||||
QLabel * lbScalarACQStatus;
|
||||
|
||||
bool scalarOutputInflux;
|
||||
|
||||
InfluxDB * influx;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user