add more ANSTYPE for 64-byte or binary
This commit is contained in:
parent
74a17b07de
commit
c6df41184f
|
@ -5,7 +5,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum ANSTYPE {INTEGER, FLOAT, LIST, STR, NONE};
|
||||
enum ANSTYPE {INTEGER, FLOAT, LIST, STR, BYTE, BINARY, NONE};
|
||||
enum TYPE {CH, DIG, LVDS, VGA};
|
||||
enum RW { ReadOnly, WriteOnly, ReadWrite};
|
||||
|
||||
|
@ -133,8 +133,8 @@ namespace PHA{
|
|||
const Reg IPAddress ("IPAddress", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR);
|
||||
const Reg NetMask ("Netmask", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR);
|
||||
const Reg Gateway ("Gateway", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR);
|
||||
const Reg LED_status ("LedStatus", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR, "byte");
|
||||
const Reg ACQ_status ("AcquisitionStatus", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR, "byte");
|
||||
const Reg LED_status ("LedStatus", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::BINARY, "byte");
|
||||
const Reg ACQ_status ("AcquisitionStatus", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::BINARY, "byte");
|
||||
const Reg MaxRawDataSize ("MaxRawDataSize", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR, "byte");
|
||||
const Reg TempSensAirIn ("TempSensAirIn", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "C");
|
||||
const Reg TempSensAirOut ("TempSensAirOut", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "C");
|
||||
|
@ -161,7 +161,7 @@ namespace PHA{
|
|||
const Reg DutyCycleSensDCDC ("DutyCycleSensDCDC", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "%");
|
||||
const Reg SpeedSensFan1 ("SpeedSensFan1", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "rpm");
|
||||
const Reg SpeedSensFan2 ("SpeedSensFan2", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::INTEGER, "rpm");
|
||||
const Reg ErrorFlags ("ErrorFlags", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::STR, "byte");
|
||||
const Reg ErrorFlags ("ErrorFlags", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::BINARY, "byte");
|
||||
const Reg BoardReady ("BoardReady", RW::ReadOnly, TYPE::DIG, {{"True", "No Error"}, {"False", "Error"}});
|
||||
|
||||
///============= read write
|
||||
|
@ -234,8 +234,8 @@ namespace PHA{
|
|||
const Reg TestPulseWidth ("TestPulseWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg ErrorFlagMask ("ErrorFlagMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::STR);
|
||||
const Reg ErrorFlagDataMask ("ErrorFlagDataMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::STR);
|
||||
const Reg ErrorFlagMask ("ErrorFlagMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BINARY);
|
||||
const Reg ErrorFlagDataMask ("ErrorFlagDataMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BINARY);
|
||||
const Reg DACoutMode ("DACoutMode", RW::ReadWrite, TYPE::DIG, {{"Static", "DAC fixed level"},
|
||||
{"ChInput", "From Channel"},
|
||||
{"ChSum", "Sum of all Channels"},
|
||||
|
@ -474,7 +474,7 @@ namespace PHA{
|
|||
{"ChSelfTrigger", "Channel Self-Trigger"},
|
||||
{"Ch64Trigger", "Channel 64-Trigger"},
|
||||
{"Disabled", "Disabled"}});
|
||||
const Reg ChannelsTriggerMask ("ChannelsTriggerMask", RW::ReadWrite, TYPE::CH, {}, ANSTYPE::STR, "64-bit" );
|
||||
const Reg ChannelsTriggerMask ("ChannelsTriggerMask", RW::ReadWrite, TYPE::CH, {}, ANSTYPE::BYTE, "64-bit" );
|
||||
const Reg ChannelVetoSource ("ChannelVetoSource", RW::ReadWrite, TYPE::CH, {{"BoardVeto", "Board Veto"},
|
||||
{"ADCOverSaturation", "ADC Over Saturation"},
|
||||
{"ADCUnderSaturation", "ADC Under Saturation"},
|
||||
|
|
|
@ -133,7 +133,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
LEDStatus[iDigi][i] = new QPushButton(tab);
|
||||
LEDStatus[iDigi][i]->setEnabled(false);
|
||||
LEDStatus[iDigi][i]->setFixedSize(QSize(30,30));
|
||||
LEDStatus[iDigi][i]->setToolTip(LEDToolTip[i]);
|
||||
LEDStatus[iDigi][i]->setToolTip(QString::number(i) + " - " + LEDToolTip[i]);
|
||||
LEDStatus[iDigi][i]->setToolTipDuration(-1);
|
||||
//TODO set tooltip position on top
|
||||
statusLayout->addWidget(LEDStatus[iDigi][i], 0, 1 + 19 - i);
|
||||
|
@ -149,7 +149,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
ACQStatus[iDigi][i] = new QPushButton(tab);
|
||||
ACQStatus[iDigi][i]->setEnabled(false);
|
||||
ACQStatus[iDigi][i]->setFixedSize(QSize(30,30));
|
||||
ACQStatus[iDigi][i]->setToolTip(ACQToolTip[i]);
|
||||
ACQStatus[iDigi][i]->setToolTip(QString::number(i) + " - " + ACQToolTip[i]);
|
||||
ACQStatus[iDigi][i]->setToolTipDuration(-1);
|
||||
statusLayout->addWidget(ACQStatus[iDigi][i], 1, 1 + 7 - i);
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
chStatus[iDigi][ch][k] = new QPushButton(statusTab);
|
||||
chStatus[iDigi][ch][k]->setEnabled(false);
|
||||
chStatus[iDigi][ch][k]->setFixedSize(QSize(10,25));
|
||||
chStatus[iDigi][ch][k]->setToolTip(chToolTip[k]);
|
||||
chStatus[iDigi][ch][k]->setToolTip(QString::number(k) + " - " + chToolTip[k]);
|
||||
chStatus[iDigi][ch][k]->setToolTipDuration(-1);
|
||||
layout->addWidget(chStatus[iDigi][ch][k], 1 + ch/2, ch%2 * 12 + 9 - k); // arrange backward, so that it is like a bit-wise
|
||||
}
|
||||
|
@ -2030,12 +2030,22 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
|
|||
case RW::ReadWrite : type ="Read/Write"; break;
|
||||
}
|
||||
leBdSettingsType->setText(type);
|
||||
leBdSettingsRead->setText(QString::fromStdString(digi[cbIQDigi->currentIndex()]->ReadValue(PHA::DIG::AllSettings[cbIndex])));
|
||||
|
||||
QString ans = QString::fromStdString(digi[cbIQDigi->currentIndex()]->ReadValue(PHA::DIG::AllSettings[cbIndex]));
|
||||
ANSTYPE haha = PHA::DIG::AllSettings[cbIndex].GetAnswerType();
|
||||
|
||||
if( haha == ANSTYPE::BYTE){
|
||||
leBdSettingsRead->setText( "0x" + QString::number(ans.toULong(), 16).rightJustified(16, '0'));
|
||||
}else if( haha == ANSTYPE::BINARY ){
|
||||
leBdSettingsRead->setText( "0b" + QString::number(ans.toUInt(), 2).rightJustified(18, '0'));
|
||||
}else{
|
||||
leBdSettingsRead->setText(ans);
|
||||
}
|
||||
leBdSettingsUnit->setText(QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetUnit()));
|
||||
|
||||
ANSTYPE haha = PHA::DIG::AllSettings[cbIndex].GetAnswerType();
|
||||
if( PHA::DIG::AllSettings[cbIndex].ReadWrite() != RW::ReadOnly && haha != ANSTYPE::NONE ){
|
||||
|
||||
//===== spin box
|
||||
if( haha == ANSTYPE::FLOAT || haha == ANSTYPE::INTEGER ){
|
||||
cbBdAns->clear();
|
||||
cbBdAns->setEnabled(false);
|
||||
|
@ -2049,6 +2059,7 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
|
|||
sbBdSettingsWrite->setDecimals(0);
|
||||
}
|
||||
if( haha == ANSTYPE::FLOAT) sbBdSettingsWrite->setDecimals(3);
|
||||
//===== combo Box
|
||||
if( haha == ANSTYPE::LIST){
|
||||
cbBdAns->setEnabled(true);
|
||||
cbBdAns->clear();
|
||||
|
@ -2061,7 +2072,8 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
|
|||
leBdSettingsWrite->setEnabled(false);
|
||||
leBdSettingsWrite->clear();
|
||||
}
|
||||
if( haha == ANSTYPE::STR){
|
||||
//===== lineEdit
|
||||
if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){
|
||||
cbBdAns->clear();
|
||||
cbBdAns->setEnabled(false);
|
||||
leBdSettingsWrite->setEnabled(true);
|
||||
|
@ -2098,10 +2110,20 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
|
|||
case RW::ReadWrite : type ="Read/Write"; break;
|
||||
}
|
||||
leChSettingsType->setText(type);
|
||||
leChSettingsRead->setText(QString::fromStdString(digi[cbIQDigi->currentIndex()]->ReadValue(PHA::CH::AllSettings[cbIndex], cbIQCh->currentData().toInt())));
|
||||
|
||||
QString ans = QString::fromStdString(digi[cbIQDigi->currentIndex()]->ReadValue(PHA::CH::AllSettings[cbIndex], cbIQCh->currentData().toInt()));
|
||||
ANSTYPE haha = PHA::CH::AllSettings[cbIndex].GetAnswerType();
|
||||
|
||||
if( haha == ANSTYPE::BYTE){
|
||||
leChSettingsRead->setText( "0x" + QString::number(ans.toULong(), 16).rightJustified(16, '0'));
|
||||
}else if( haha == ANSTYPE::BINARY ){
|
||||
leChSettingsRead->setText( "0b" + QString::number(ans.toUInt(), 2).rightJustified(18, '0'));
|
||||
}else{
|
||||
leChSettingsRead->setText(ans);
|
||||
}
|
||||
|
||||
leChSettingsUnit->setText(QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetUnit()));
|
||||
|
||||
ANSTYPE haha = PHA::CH::AllSettings[cbIndex].GetAnswerType();
|
||||
|
||||
if( PHA::CH::AllSettings[cbIndex].ReadWrite() != RW::ReadOnly && haha != ANSTYPE::NONE ){
|
||||
|
||||
|
@ -2130,7 +2152,7 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
|
|||
leChSettingsWrite->setEnabled(false);
|
||||
leChSettingsWrite->clear();
|
||||
}
|
||||
if( haha == ANSTYPE::STR){
|
||||
if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){
|
||||
cbChAns->clear();
|
||||
cbChAns->setEnabled(false);
|
||||
leChSettingsWrite->setEnabled(true);
|
||||
|
|
Loading…
Reference in New Issue
Block a user