UpdateScalar also update digiSettings status, if exist and visible

This commit is contained in:
Ryan Tang 2023-04-14 14:10:02 -04:00
parent b916295a4d
commit 1fc203818e
4 changed files with 54 additions and 10 deletions

View File

@ -152,6 +152,7 @@ namespace PHA{
const Reg TempSensADC7 ("TempSensADC7", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "C"); const Reg TempSensADC7 ("TempSensADC7", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "C");
const std::vector<Reg> TempSensADC = {TempSensADC0,TempSensADC1,TempSensADC2,TempSensADC3,TempSensADC4,TempSensADC5,TempSensADC6,TempSensADC7}; const std::vector<Reg> TempSensADC = {TempSensADC0,TempSensADC1,TempSensADC2,TempSensADC3,TempSensADC4,TempSensADC5,TempSensADC6,TempSensADC7};
const std::vector<Reg> TempSensOthers = {TempSensAirIn,TempSensAirOut,TempSensCore,TempSensFirstADC,TempSensLastADC,TempSensHottestADC};
const Reg TempSensDCDC ("TempSensDCDC", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "C"); const Reg TempSensDCDC ("TempSensDCDC", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "C");
const Reg VInSensDCDC ("VInSensDCDC", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "V"); const Reg VInSensDCDC ("VInSensDCDC", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "V");

View File

@ -76,7 +76,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
enableSignalSlot = false; enableSignalSlot = false;
QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout); QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout);
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget); tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget);
//@========================== Tab for each digitizer //@========================== Tab for each digitizer
for(unsigned short iDigi = 0; iDigi < this->nDigi; iDigi++){ for(unsigned short iDigi = 0; iDigi < this->nDigi; iDigi++){
@ -91,8 +91,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QHBoxLayout * tabLayout_H = new QHBoxLayout(tab); //tab->setLayout(tabLayout_H); QHBoxLayout * tabLayout_H = new QHBoxLayout(tab); //tab->setLayout(tabLayout_H);
QVBoxLayout * tabLayout_V1 = new QVBoxLayout(); tabLayout_H->addLayout(tabLayout_V1); QVBoxLayout * tabLayout_V1 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V1);
QVBoxLayout * tabLayout_V2 = new QVBoxLayout(); tabLayout_H->addLayout(tabLayout_V2); QVBoxLayout * tabLayout_V2 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V2);
{//^====================== Group of Digitizer Info {//^====================== Group of Digitizer Info
QGroupBox * infoBox = new QGroupBox("Board Info", tab); QGroupBox * infoBox = new QGroupBox("Board Info", tab);
@ -163,6 +163,10 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
statusLayout->addWidget(leTemp[iDigi][i], 2, 1 + 2*i, 1, 2); statusLayout->addWidget(leTemp[iDigi][i], 2, 1 + 2*i, 1, 2);
} }
QPushButton * bnUpdateStatus = new QPushButton("Update Status", this);
statusLayout->addWidget(bnUpdateStatus, 2, 19);
connect(bnUpdateStatus, &QPushButton::clicked, this, &DigiSettingsPanel::UpdateStatus);
for( int i = 0; i < statusLayout->columnCount(); i++) statusLayout->setColumnStretch(i, 0 ); for( int i = 0; i < statusLayout->columnCount(); i++) statusLayout->setColumnStretch(i, 0 );
} }
@ -213,6 +217,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(bnClearData[iDigi], &QPushButton::clicked, this, [=](){ connect(bnClearData[iDigi], &QPushButton::clicked, this, [=](){
digi[ID]->SendCommand(PHA::DIG::ClearData); digi[ID]->SendCommand(PHA::DIG::ClearData);
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::ClearData.GetFullPara())); SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::ClearData.GetFullPara()));
UpdateStatus();
}); });
bnArmACQ[iDigi] = new QPushButton("Arm ACQ", tab); bnArmACQ[iDigi] = new QPushButton("Arm ACQ", tab);
@ -220,6 +225,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(bnArmACQ[iDigi], &QPushButton::clicked, this, [=](){ connect(bnArmACQ[iDigi], &QPushButton::clicked, this, [=](){
digi[ID]->SendCommand(PHA::DIG::ArmACQ); digi[ID]->SendCommand(PHA::DIG::ArmACQ);
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::ArmACQ.GetFullPara())); SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::ArmACQ.GetFullPara()));
UpdateStatus();
}); });
bnDisarmACQ[iDigi] = new QPushButton("Disarm ACQ", tab); bnDisarmACQ[iDigi] = new QPushButton("Disarm ACQ", tab);
@ -227,6 +233,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(bnDisarmACQ[iDigi], &QPushButton::clicked, this, [=](){ connect(bnDisarmACQ[iDigi], &QPushButton::clicked, this, [=](){
digi[ID]->SendCommand(PHA::DIG::DisarmACQ); digi[ID]->SendCommand(PHA::DIG::DisarmACQ);
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::DisarmACQ.GetFullPara())); SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::DisarmACQ.GetFullPara()));
UpdateStatus();
}); });
bnSoftwareStart[iDigi] = new QPushButton("Software Start ACQ", tab); bnSoftwareStart[iDigi] = new QPushButton("Software Start ACQ", tab);
@ -234,6 +241,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(bnSoftwareStart[iDigi], &QPushButton::clicked, this, [=](){ connect(bnSoftwareStart[iDigi], &QPushButton::clicked, this, [=](){
digi[ID]->SendCommand(PHA::DIG::SoftwareStartACQ); digi[ID]->SendCommand(PHA::DIG::SoftwareStartACQ);
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::SoftwareStartACQ.GetFullPara())); SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::SoftwareStartACQ.GetFullPara()));
UpdateStatus();
}); });
bnSoftwareStop[iDigi] = new QPushButton("Software Stop ACQ", tab); bnSoftwareStop[iDigi] = new QPushButton("Software Stop ACQ", tab);
@ -241,6 +249,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(bnSoftwareStop[iDigi], &QPushButton::clicked, this, [=](){ connect(bnSoftwareStop[iDigi], &QPushButton::clicked, this, [=](){
digi[ID]->SendCommand(PHA::DIG::SoftwareStopACQ); digi[ID]->SendCommand(PHA::DIG::SoftwareStopACQ);
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::SoftwareStopACQ.GetFullPara())); SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Send Command : " + QString::fromStdString(PHA::DIG::SoftwareStopACQ.GetFullPara()));
UpdateStatus();
}); });
//--------------- //---------------
@ -1585,6 +1594,24 @@ void DigiSettingsPanel::RefreshSettings(){
UpdatePanelFromMemory(); UpdatePanelFromMemory();
} }
void DigiSettingsPanel::UpdateStatus(){
if( tabWidget->currentIndex() >= nDigi) return;
digi[ID]->ReadValue(PHA::DIG::LED_status);
digi[ID]->ReadValue(PHA::DIG::ACQ_status);
for( int i = 0; i < (int) PHA::DIG::TempSensADC.size(); i++){
digi[ID]->ReadValue(PHA::DIG::TempSensADC[i]);
}
for( int i = 0; i < (int) PHA::DIG::TempSensOthers.size(); i++){
digi[ID]->ReadValue(PHA::DIG::TempSensOthers[i]);
}
UpdatePanelFromMemory(true);
}
void DigiSettingsPanel::EnableControl(){ void DigiSettingsPanel::EnableControl(){
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1703,16 +1730,16 @@ void DigiSettingsPanel::SetDefaultPHASettigns(){
RefreshSettings(); RefreshSettings();
} }
void DigiSettingsPanel::UpdatePanelFromMemory(){ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
if( !isVisible() ) return; if( !isVisible() ) return;
enableSignalSlot = false; enableSignalSlot = false;
printf("DigiSettingsPanel::%s Digi-%d\n", __func__, digi[ID]->GetSerialNumber()); if( onlyStatus){
printf("DigiSettingsPanel::%s Digi-%d [Only Board Status]\n", __func__, digi[ID]->GetSerialNumber());
for (unsigned short j = 0; j < (unsigned short) infoIndex.size(); j++){ }else{
leInfo[ID][j]->setText(QString::fromStdString(digi[ID]->GetSettingValue(infoIndex[j].second))); printf("DigiSettingsPanel::%s Digi-%d\n", __func__, digi[ID]->GetSerialNumber());
} }
//--------- LED Status //--------- LED Status
@ -1740,6 +1767,15 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
leTemp[ID][i]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::TempSensADC[i]))); leTemp[ID][i]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::TempSensADC[i])));
} }
if( onlyStatus ) {
enableSignalSlot = true;
return;
}
for (unsigned short j = 0; j < (unsigned short) infoIndex.size(); j++){
leInfo[ID][j]->setText(QString::fromStdString(digi[ID]->GetSettingValue(infoIndex[j].second)));
}
//-------- board settings //-------- board settings
FillComboBoxValueFromMemory(cbbClockSource[ID], PHA::DIG::ClockSource); FillComboBoxValueFromMemory(cbbClockSource[ID], PHA::DIG::ClockSource);

View File

@ -41,7 +41,8 @@ private slots:
public slots: public slots:
void EnableControl(); void EnableControl();
void UpdatePanelFromMemory(); void UpdatePanelFromMemory(bool onlyStatus = false);
void UpdateStatus();
signals: signals:
@ -56,6 +57,8 @@ private:
QString digiSettingPath; QString digiSettingPath;
QTabWidget * tabWidget;
//------------ Layout/GroupBox //------------ Layout/GroupBox
QGroupBox * digiBox[MaxNumberOfDigitizer]; QGroupBox * digiBox[MaxNumberOfDigitizer];
QGroupBox * VGABox[MaxNumberOfDigitizer]; QGroupBox * VGABox[MaxNumberOfDigitizer];

View File

@ -1153,6 +1153,9 @@ void MainWindow::UpdateScalar(){
influx->ClearDataPointsBuffer(); influx->ClearDataPointsBuffer();
} }
//TODO record ADC temperature, and status. In this case, the digiSetting is only UpdateFromMemory, manually looping digitizers and get the status.
if( digiSetting && digiSetting->isVisible() ) digiSetting->UpdateStatus();
if( solarisSetting && solarisSetting->isVisible() ) solarisSetting->UpdateThreshold(); if( solarisSetting && solarisSetting->isVisible() ) solarisSetting->UpdateThreshold();
} }
@ -1877,6 +1880,7 @@ void MainWindow::CreateNewExperiment(const QString newExpName){
} }
//TODO is there anyway to create a new elog ?? direct edit the config.cfg??
//CheckElog(); //CheckElog();
logMsgHTMLMode = true; logMsgHTMLMode = true;
LogMsg("<font style=\"color red;\"> !!!! Please Create a new Elog with name <b>" + newExpName + "</b>. </font>"); LogMsg("<font style=\"color red;\"> !!!! Please Create a new Elog with name <b>" + newExpName + "</b>. </font>");