diff --git a/developHw.pro.user b/developHw.pro.user index 44cf04d..70729e8 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/include/model/hardware/core/TrxBoard.h b/include/model/hardware/core/TrxBoard.h index c383b30..26a24e8 100644 --- a/include/model/hardware/core/TrxBoard.h +++ b/include/model/hardware/core/TrxBoard.h @@ -31,13 +31,13 @@ #define SLAVE_ELEMENT_SEGMENT 64U #define TOTAL_SCEN_LUT_SRAM 5U -#define SLAVE_FPGA_NUMBER 3U +#define MOUNTED_SLAVE_FPGA 7U #define CLOCK_DIVISION 0x55 #define EEPROM_ID_BYTE_BEGIN 19U #define EEPROM_ID_BYTE_NUMBER 2U #define EEPROM_INFO_BYTE_BEGIN 0U -#define EEPROM_INFO_BYTE_NUMBER 19U +#define EEPROM_INFO_BYTE_NUMBER 21U template @@ -160,7 +160,6 @@ public: void setScenario(ScenGenHardwareOutput_t scenGenHw); void setAfeConfig(AfeConfig afe); - void setAfePwrdnMode(eAfePwrdnMode cmd) const; QList getAfeReg(eSlaveSelect sel, quint32 afeRegAddr); void scenPlayerStart(void); @@ -186,12 +185,12 @@ public: quint32 trxId(void) const; quint32 mpsId(void) const; quint32 prbCtrlId(void) const; - quint32 prbId(quint8 prbSel) const; + quint32 prbId(eSelectProbe prbSel) const; void getConnectedPrbId(ConnectedPrbId* prbId) const; - QString trxInfo(void) const; - QString mpsInfo(void) const; - QString prbCtrlInfo(void) const; + QByteArray trxInfo(void) const; + QByteArray mpsInfo(void) const; + QByteArray prbCtrlInfo(void) const; QByteArray prbInfo(quint8 prbSel) const; void getConnectedPrbInfo(ConnectedPrbInfo* prbInfo) const; diff --git a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h index ba1c2ec..6f2adfa 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h +++ b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h @@ -247,6 +247,7 @@ public: void mpsDeInit(void) const; void setMpsReset(void) const; void mpsDacsOff(void) const; + void mpsDacsOn(void) const; void mpsHvSet(float& hva, float& hvb) const; QByteArray trxEepromRead(quint32 address, quint32 length); diff --git a/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h b/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h index 0278c4f..4f0b5a8 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h @@ -10,7 +10,7 @@ #define BAR 0 #define OFFSET 0x85000 -#define LENGTH 256U +#define LENGTH 128U class AtgcLut : public Register { diff --git a/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h b/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h index 4f844a7..b74d1ec 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h @@ -21,7 +21,8 @@ private: void prepareData(quint32 index) override { lineFilterLutEven->setValue(_lineFilterLut.at(static_cast(index*2))); - lineFilterLutOdd ->setValue(_lineFilterLut.at(static_cast(index*2 + 1))); + if (index == 0) + lineFilterLutOdd ->setValue(_lineFilterLut.at(static_cast(index*2 + 1))); } public: diff --git a/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h index 80711ec..160b8a2 100644 --- a/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h +++ b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h @@ -10,7 +10,7 @@ #define PAUSE_MASK 0x00000004 #define BAR 0U -#define OFFSET 0 +#define OFFSET 0x800 class ScenPlayerCtrl : public Register { diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/ReceiverConfig.h b/include/model/scenarioGenerator/core/scenario/type/misc/ReceiverConfig.h index b6c6ac4..d345a6f 100644 --- a/include/model/scenarioGenerator/core/scenario/type/misc/ReceiverConfig.h +++ b/include/model/scenarioGenerator/core/scenario/type/misc/ReceiverConfig.h @@ -16,7 +16,7 @@ struct ReceiverConfig_t { quint32 absEn; quint32 focusNo; quint32 lineFilterEn; - quint32 ddcEn; + quint32 ddcn; quint32 wmfEn; quint32 dpeEn; }; diff --git a/include/model/scenarioGenerator/dto/hardware/HardwareOutput.h b/include/model/scenarioGenerator/dto/hardware/HardwareOutput.h index 124a610..8511445 100644 --- a/include/model/scenarioGenerator/dto/hardware/HardwareOutput.h +++ b/include/model/scenarioGenerator/dto/hardware/HardwareOutput.h @@ -13,6 +13,7 @@ struct ScenGenHardwareOutput_t { quint32 totalTxShotNumber; QVector rxBeamFormerNumber; QVector pulseInterval; + quint8 frameType; HwRegister_t hwRegister; SramIndex_t indexParams; diff --git a/include/model/scenarioGenerator/dto/hardware/SramIndex.h b/include/model/scenarioGenerator/dto/hardware/SramIndex.h index d6ef17c..4cedc9a 100644 --- a/include/model/scenarioGenerator/dto/hardware/SramIndex.h +++ b/include/model/scenarioGenerator/dto/hardware/SramIndex.h @@ -11,7 +11,6 @@ struct SramIndex_t { QVector lastLineInFrame; QVector dLineNum; QVector dEnsembleNum; - quint8 frameType; }; #endif //SRAMINDEX_H diff --git a/mainwindow.cpp b/mainwindow.cpp index 958a810..38c11ea 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,8 +3,6 @@ QThread* MainWindow::_uiThread; -//using namespace H5; - MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) @@ -53,6 +51,7 @@ MainWindow::MainWindow(QWidget *parent) ui->rbtn_reg->setChecked(_settings->value(REG_ACCESS_SEL).value()); ui->rbtn_offset->setChecked(!_settings->value(REG_ACCESS_SEL).value()); ui->tb_fpgaBit->setText(_settings->value(FPGA_FILE_PATH).value()); + ui->tb_h5File->setText(_settings->value(SCENARIO_FILE_PATH).value()); // connect(this, &MainWindow::updateBlockProgressValue, this, &MainWindow::newBlockProgressValue); // connect(this, &MainWindow::updateFpgaProgressValue, this, &MainWindow::newFpgaProgressValue); @@ -63,15 +62,15 @@ MainWindow::MainWindow(QWidget *parent) //connect(this, &MainWindow::updateAdcLoggerProgressVisibility, this, &MainWindow::newAdcLoggerProgressVisibility); connect(this, &MainWindow::showMessage, this, &MainWindow::newMessage); + connect(this, &MainWindow::connectedPrbChange, this, &MainWindow::getPrbChange); connect(_timeout, &QTimer::timeout, this, &MainWindow::timeout); + connect(&scenEndWather, &QFutureWatcher::finished, this, &MainWindow::restartTimer); //////////////////////// DMA Packet Connections ////////////////////////////// connect(&_trx, &TrxBoard::sendFramePacket, this, &MainWindow::getFramePacket); connect(this, &MainWindow::sendLogCount, this, &MainWindow::catchLogCount); connect(this, &MainWindow::twoDReady, this, &MainWindow::show2d, Qt::BlockingQueuedConnection); connect(this, &MainWindow::threeDReady, this, &MainWindow::show3d, Qt::BlockingQueuedConnection); - ui->btn_pllClkSt->setText(ON); - ui->btn_pllClkTps->setText(ON); ui->btn_hvRegulatorConfig->setText(ENABLE); ui->btn_pm5RegulatorConfig->setText(ENABLE); ui->btn_updateRdbackValue->setText(UPDATE); @@ -93,6 +92,8 @@ MainWindow::MainWindow(QWidget *parent) _dmaRun = false; _dmaShow = false; + setAfeConfig(); + try { _trx.init(); @@ -104,20 +105,6 @@ MainWindow::MainWindow(QWidget *parent) _timeout->start(1000); - // setReceiverConfiguration(); - // setBlendWeight(); - // setLineFilter(); - // setStbCoeff(); - // setFreqLut(); - // setDTgc(); - // setATgc(); - // setLpf(); - - // setRxBeamformerPrp(); - // setPulseProperties(); - setAfeConfig(); - // setProbeElement(); - // setApodization(); } MainWindow::~MainWindow() @@ -586,29 +573,6 @@ void MainWindow::timeout() ui->l_PCIeID->setText(QString::number(pcie_id, 16)); delay(10); - bool probeADetected=_bCtrl->getConnectedPrb().at(0); - bool probeBDetected=_bCtrl->getConnectedPrb().at(1); - bool probeCDetected=_bCtrl->getConnectedPrb().at(2); - bool probeDDetected=_bCtrl->getConnectedPrb().at(3); - - if(probeDDetected == true){ - ui->l_detectedProbe->setText("D"); - } - else if (probeCDetected == true) { - ui->l_detectedProbe->setText("C"); - } - else if (probeBDetected == true) { - ui->l_detectedProbe->setText("B"); - } - else if (probeADetected == true) { - ui->l_detectedProbe->setText("A"); - } - else{ - ui->l_detectedProbe->setText("None"); - } - - delay(10); - _trx.getHealthStatus(_healStatus); delay(10); /******************* System Monitoring *********************/ @@ -794,6 +758,34 @@ void MainWindow::timeout() color = probeDetChanInterrupt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_prbDetChg, color); + if (probeDetChanInterrupt) + emit connectedPrbChange(); + +} + +/*************************************************************************************************/ +void MainWindow::getPrbChange() +{ + bool probeADetected=_bCtrl->getConnectedPrb().at(0); + bool probeBDetected=_bCtrl->getConnectedPrb().at(1); + bool probeCDetected=_bCtrl->getConnectedPrb().at(2); + bool probeDDetected=_bCtrl->getConnectedPrb().at(3); + + if(probeDDetected == true){ + ui->l_detectedProbe->setText("D"); + } + else if (probeCDetected == true) { + ui->l_detectedProbe->setText("C"); + } + else if (probeBDetected == true) { + ui->l_detectedProbe->setText("B"); + } + else if (probeADetected == true) { + ui->l_detectedProbe->setText("A"); + } + else{ + ui->l_detectedProbe->setText("None"); + } } /*************************************************************************************************/ @@ -1340,6 +1332,11 @@ const QString MainWindow::enum2String(ePg state) const return pg; } +void MainWindow::restartTimer() +{ + _timeout->start(1000); +} + /*************************************************************************************************/ /*********************************************DMA*************************************************/ /*************************************************************************************************/ @@ -1538,6 +1535,7 @@ void MainWindow::logPcie() ui->btn_dmaLogLast->setText("InstantLog"); } + void MainWindow::on_btn_dmaLogLast_clicked() { if (_dmaRun && (ui->btn_dmaLogLast->text() == "InstantLog")) @@ -2543,175 +2541,649 @@ void MainWindow::on_btn_getFpgaVersion_clicked() //} /*************************************************************************************************/ -/**************************************** DSP ****************************************************/ +/************************************* Scenario Setting ******************************************/ /*************************************************************************************************/ -void MainWindow::setReceiverConfiguration() -{ - // _scenParams.hwRegister.->mla.clear(); - // _scenParams->hwRegister->configLut->stb.clear(); - // _scenParams->hwRegister->configLut->lpfSel.clear(); - // _scenParams->hwRegister->configLut->aTgcSel.clear(); - // _scenParams->hwRegister->configLut->focusNo.clear(); - // _scenParams->hwRegister->configLut->lineMode.clear(); - // _scenParams->hwRegister->configLut->ncoFreqSel.clear(); - // _scenParams->hwRegister->configLut->absEn.clear(); - // _scenParams->hwRegister->configLut->ddcEn.clear(); - // _scenParams->hwRegister->configLut->dpeEn.clear(); - // _scenParams->hwRegister->configLut->stbEn.clear(); - // _scenParams->hwRegister->configLut->wmfEn.clear(); - // _scenParams->hwRegister->configLut->dcCancelerEn.clear(); - // _scenParams->hwRegister->configLut->lineFilterEn.clear(); - // _scenParams->hwRegister->configLut->subtractFilterEn.clear(); - - // for (quint8 i = 0; i < 8; i++){ - // _scenParams.hwRegister.receiverConfigProps.append(); - // _scenParams.hwRegister->configLut->stb.append((i*2) % 3); - // _scenParams.hwRegister->configLut->lpfSel.append((i*3) % 3); - // _scenParams.hwRegister->configLut->aTgcSel.append((i*4) % 3); - // _scenParams.hwRegister->configLut->focusNo.append((i*5) % 3); - // _scenParams.hwRegister->configLut->lineMode.append((i*6) % 15); - // _scenParams.hwRegister->configLut->ncoFreqSel.append((i*7) % 7); - // _scenParams.hwRegister->configLut->absEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->ddcEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->dpeEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->stbEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->wmfEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->dcCancelerEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->lineFilterEn.append((i % 2)!=0); - // _scenParams.hwRegister->configLut->subtractFilterEn.append((i % 2)!=0); - // } -} - -void MainWindow::setLineFilter() -{ - _lineFilter.clear(); - for (auto i = 0; i < 4; i++) - { - _lineFilter.append(i); - } -} - -void MainWindow::on_btn_lineFilter_clicked() +template +void MainWindow::datasetBranch(const string &branchPath, T datasetValue[][3057]) { + const H5std_string datasetPath(branchPath); + DataSet datasetType = _file.openDataSet(datasetPath); - ui->l_lineFilter->setText("doing"); - changeLabelTextColor(ui->l_lineFilter, Qt::red); - - _trx.setLineFilterCoefficient(_lineFilter); - - ui->l_lineFilter->setText("done"); - changeLabelTextColor(ui->l_lineFilter, Qt::green); - + datasetType.read(datasetValue, PredType::NATIVE_FLOAT, H5S_ALL, H5S_ALL); } - -void MainWindow::setFreqLut() +/*************************************************************************************************/ +void MainWindow::setScenario(const string &h5Path) { - _scenParams.hwRegister.freqLut.clear(); - for (quint8 i = 0; i < 8; i++) - { - _scenParams.hwRegister.freqLut.append(i*10); - } -} + const H5std_string filePath(h5Path); + H5File file (filePath, H5F_ACC_RDONLY); + _file = file; -void MainWindow::setStbCoeff() -{ - _stb.clear(); - for (quint8 i = 0; i < 8; i++) + try { - _stb.append(i); - } -} - -void MainWindow::on_btn_stbCoeff_clicked() -{ + /****************** /sramParameters/frameType ******************/ + datasetBranch ("/sramParameters/frameType", floatArray); + scenParams.frameType = static_cast(floatArray[0][0]); + + /****************** /sramParameters/totalTxShotNo ******************/ + datasetBranch ("/sramParameters/totalTxShotNo", floatArray); + scenParams.totalTxShotNumber = static_cast(floatArray[0][0]); + + /******************* /sramParameters/focusTypeNo *******************/ + datasetBranch ("/sramParameters/focusTypeNo", floatArray); + scenParams.focusTypeNumber = static_cast(floatArray[0][0]); + + /******************* /sramParameters/rxBeamformerNo *******************/ + datasetBranch ("/sramParameters/rxBeamformerNo", floatArray); + scenParams.rxBeamFormerNumber.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxBeamFormerNumber.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/pulseInterval ********************/ + datasetBranch ("/sramParameters/pulseInterval", floatArray); + scenParams.pulseInterval.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.pulseInterval.push_back(floatArray[0][var]); + + /**************** /sramParameters/indexParameters/shotPropertiesIndex ********************/ + datasetBranch ("/sramParameters/indexParameters/shotPropertiesIndex", floatArray); + scenParams.indexParams.shotPropertiesIndex.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.shotPropertiesIndex.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/indexParameters/pulsePropertiesIndex ********************/ + datasetBranch ("/sramParameters/indexParameters/pulsePropertiesIndex", floatArray); + scenParams.indexParams.pulsePropertiesIndex.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.pulsePropertiesIndex.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/indexParameters/receiverConfigurationIndex ********************/ + datasetBranch ("/sramParameters/indexParameters/receiverConfigurationIndex", floatArray); + scenParams.indexParams.receiverConfigurationIndex.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.receiverConfigurationIndex.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/indexParameters/firstLineInFrame ********************/ + datasetBranch ("/sramParameters/indexParameters/firstLineInFrame", floatArray); + scenParams.indexParams.firstLineInFrame.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.firstLineInFrame.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/indexParameters/lastLineInFrame ********************/ + datasetBranch ("/sramParameters/indexParameters/lastLineInFrame", floatArray); + scenParams.indexParams.lastLineInFrame.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.lastLineInFrame.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/indexParameters/dLineNum ********************/ + datasetBranch ("/sramParameters/indexParameters/dLineNum", floatArray); + scenParams.indexParams.dLineNum.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.dLineNum.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/indexParameters/dEnsembleNum ********************/ + datasetBranch ("/sramParameters/indexParameters/dEnsembleNum", floatArray); + scenParams.indexParams.dEnsembleNum.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.indexParams.dEnsembleNum.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/txParameters/txFocusXPos ********************/ + datasetBranch ("/sramParameters/txParameters/txFocusXPos", floatArray); + scenParams.txParams.txFocusXPos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.txParams.txFocusXPos.push_back(floatArray[0][var]); + + /**************** /sramParameters/txParameters/txFocusYPos ********************/ + datasetBranch ("/sramParameters/txParameters/txFocusYPos", floatArray); + scenParams.txParams.txFocusYPos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.txParams.txFocusYPos.push_back(floatArray[0][var]); + + /**************** /sramParameters/txParameters/txFocusZPos ********************/ + datasetBranch ("/sramParameters/txParameters/txFocusZPos", floatArray); + scenParams.txParams.txFocusZPos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.txParams.txFocusZPos.push_back(floatArray[0][var]); + + /**************** /sramParameters/txParameters/txStartActiveElementNo ********************/ + datasetBranch ("/sramParameters/txParameters/txStartActiveElementNo", floatArray); + scenParams.txParams.txStartActiveElementNumber.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.txParams.txStartActiveElementNumber.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/txParameters/txActiveElementNo ********************/ + datasetBranch ("/sramParameters/txParameters/txActiveElementNo", floatArray); + scenParams.txParams.txActiveElementNumber.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.txParams.txActiveElementNumber.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/txParameters/maxDelayQ ********************/ + datasetBranch ("/sramParameters/txParameters/maxDelayQ", floatArray); + scenParams.txParams.maxDelayQ.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.txParams.maxDelayQ.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/rxR0CenterActiveElementNo ********************/ + datasetBranch ("/sramParameters/rxParameters/rxR0CenterActiveElementNo", floatArray); + scenParams.rxParams.rxR0CenterActiveElementNumber.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.rxR0CenterActiveElementNumber.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/rxR0ActiveElementNo ********************/ + datasetBranch ("/sramParameters/rxParameters/rxR0ActiveElementNo", floatArray); + scenParams.rxParams.rxR0ActiveElementNumber.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.rxR0ActiveElementNumber.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/rxActiveElementStep ********************/ + datasetBranch ("/sramParameters/rxParameters/rxActiveElementStep", floatArray); + scenParams.rxParams.rxActiveElementStep.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.rxActiveElementStep.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/interceptPointFiringTime ********************/ + datasetBranch ("/sramParameters/rxParameters/interceptPointFiringTime", floatArray); + scenParams.rxParams.interceptPointFiringTime.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.interceptPointFiringTime.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/rxFocusPointNo ********************/ + datasetBranch ("/sramParameters/rxParameters/rxFocusPointNo", floatArray); + scenParams.rxParams.rxFocusPointNumber.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.rxFocusPointNumber.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/r0Position ********************/ + datasetBranch ("/sramParameters/rxParameters/r0Position", floatArray); + scenParams.rxParams.r0Position.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.r0Position.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/thetaCos ********************/ + datasetBranch ("/sramParameters/rxParameters/thetaCos", floatArray); + scenParams.rxParams.thetaCos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.thetaCos.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/thetaSin ********************/ + datasetBranch ("/sramParameters/rxParameters/thetaSin", floatArray); + scenParams.rxParams.thetaSin.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.thetaSin.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/phiCos ********************/ + datasetBranch ("/sramParameters/rxParameters/phiCos", floatArray); + scenParams.rxParams.phiCos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.phiCos.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/phiSin ********************/ + datasetBranch ("/sramParameters/rxParameters/phiSin", floatArray); + scenParams.rxParams.phiSin.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.phiSin.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/interceptXPos ********************/ + datasetBranch ("/sramParameters/rxParameters/interceptXPos", floatArray); + scenParams.rxParams.interceptXPos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.interceptXPos.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/interceptYPos ********************/ + datasetBranch ("/sramParameters/rxParameters/interceptYPos", floatArray); + scenParams.rxParams.interceptYPos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.interceptYPos.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/interceptZPos ********************/ + datasetBranch ("/sramParameters/rxParameters/interceptZPos", floatArray); + scenParams.rxParams.interceptZPos.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.interceptZPos.push_back(floatArray[0][var]); + + /**************** /sramParameters/rxParameters/txR0MinDelayQ ********************/ + datasetBranch ("/sramParameters/rxParameters/txR0MinDelayQ", floatArray); + scenParams.rxParams.txR0MinDelayQ.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.txR0MinDelayQ.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/rxR0MinDelayQ ********************/ + datasetBranch ("/sramParameters/rxParameters/rxR0MinDelayQ", floatArray); + scenParams.rxParams.rxR0MinDelayQ.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.rxR0MinDelayQ.push_back(static_cast(floatArray[0][var])); + + /**************** /sramParameters/rxParameters/rxR0MaxDelayQ ********************/ + datasetBranch ("/sramParameters/rxParameters/rxR0MaxDelayQ", floatArray); + scenParams.rxParams.rxR0MaxDelayQ.clear(); + for (quint32 var = 0; var < scenParams.focusTypeNumber; var++) + scenParams.rxParams.rxR0MaxDelayQ.push_back(static_cast(floatArray[0][var])); + + /**************** /registerParameters/pulseTypeNo ********************/ + datasetBranch ("/registerParameters/pulseTypeNo", floatArray); + scenParams.hwRegister.pulseTypeNumber = static_cast(floatArray[0][0]); + + /**************** /registerParameters/rxBeamformerTypeNo ********************/ + datasetBranch ("/registerParameters/rxBeamformerTypeNo", floatArray); + scenParams.hwRegister.rxBeamFormerTypeNumber = static_cast(floatArray[0][0]); + + /**************** /registerParameters/receiverConfigTypeNo ********************/ + datasetBranch ("/registerParameters/receiverConfigTypeNo", floatArray); + scenParams.hwRegister.receiverConfigTypeNumber = static_cast(floatArray[0][0]); + + /**************** /registerParameters/blendWeight ********************/ + datasetBranch ("/registerParameters/blendWeight", floatArray); + scenParams.hwRegister.blendWeight.clear(); + QVector tempBlendWeight; + + for (quint32 i = 0; i < 4; i++) + { + tempBlendWeight.clear(); + for (quint32 j = 0; j < 512; j++) + { + tempBlendWeight.push_back(floatArray[i][j]); + } + scenParams.hwRegister.blendWeight.push_back(tempBlendWeight); + } - ui->l_stbCoeff->setText("doing"); - changeLabelTextColor(ui->l_stbCoeff, Qt::red); + /**************** /registerParameters/freqLut ********************/ + datasetBranch ("/registerParameters/freqLut", floatArray); + scenParams.hwRegister.freqLut.clear(); + for (quint32 var = 0; var < 8; var++) + scenParams.hwRegister.freqLut.push_back(floatArray[0][var]); + + /**************** /registerParameters/dTgcLut ********************/ + datasetBranch ("/registerParameters/dTgcLut", floatArray); + scenParams.hwRegister.dtgcLut.clear(); + for (quint32 var = 0; var < 1024; var++) + scenParams.hwRegister.dtgcLut.push_back(floatArray[0][var]); + + /**************** /registerParameters/elementXPositions ********************/ + datasetBranch ("/registerParameters/elementXPositions", floatArray); + scenParams.hwRegister.elementXPosition.clear(); + for (quint32 var = 0; var < 192; var++) + scenParams.hwRegister.elementXPosition.push_back(floatArray[0][var]); + + /**************** /registerParameters/elementYPositions ********************/ + datasetBranch ("/registerParameters/elementYPositions", floatArray); + scenParams.hwRegister.elementYPosition.clear(); + for (quint32 var = 0; var < 192; var++) + scenParams.hwRegister.elementYPosition.push_back(floatArray[0][var]); + + /**************** /registerParameters/elementZPositions ********************/ + datasetBranch ("/registerParameters/elementZPositions", floatArray); + scenParams.hwRegister.elementZPosition.clear(); + for (quint32 var = 0; var < 192; var++) + scenParams.hwRegister.elementZPosition.push_back(floatArray[0][var]); + + /**************** /registerParameters/scenarioStartIndex ********************/ + datasetBranch ("/registerParameters/scenarioStartIndex", floatArray); + scenParams.hwRegister.scenarioStartIndex = static_cast(floatArray[0][0]); + + /**************** /registerParameters/scenarioEndIndex ********************/ + datasetBranch ("/registerParameters/scenarioEndIndex", floatArray); + scenParams.hwRegister.scenarioEndIndex = static_cast(floatArray[0][0]); + + /**************** /registerParameters/apodizationLut ********************/ + datasetBranch ("/registerParameters/apodizationLut", floatArray); + scenParams.hwRegister.apodizationLut.clear(); + QVector tempApodization; + + for (quint32 i = 0; i < 4; i++) + { + tempApodization.clear(); + for (quint32 j = 0; j < 3057; j++) + { + tempApodization.push_back(static_cast(floatArray[i][j])); + } + scenParams.hwRegister.apodizationLut.push_back(tempApodization); + } - _trx.setStbCoefficient(_stb); + /**************** /registerParameters/aTgcLut ********************/ + datasetBranch ("/registerParameters/aTgcLut", floatArray); + scenParams.hwRegister.atgcLut.clear(); + QVector tempAtgc; - ui->l_stbCoeff->setText("done"); - changeLabelTextColor(ui->l_stbCoeff, Qt::green); + for (quint32 i = 0; i < 4; i++) + { + tempAtgc.clear(); + for (quint32 j = 0; j < 128; j++) + { + tempAtgc.push_back(static_cast(floatArray[i][j])); + } + scenParams.hwRegister.atgcLut.push_back(tempAtgc); + } -} + /**************** /registerParameters/lpfLut ********************/ + datasetBranch ("/registerParameters/lpfLut", floatArray); + scenParams.hwRegister.lpfLut.clear(); + QVector tempLpf; + for (quint32 i = 0; i < 4; i++) + { + tempLpf.clear(); + for (quint32 j = 0; j < 48; j++) + { + tempLpf.push_back(static_cast(floatArray[i][j])); + } + scenParams.hwRegister.lpfLut.push_back(tempLpf); + } -void MainWindow::setATgc() -{ - // QVector temp; - // _scenParams.hwRegister.atgcLut.clear(); - - // for (quint8 i = 0; i < 4; i++) - // { - // temp.clear(); - // for (quint16 j = 0; j < 256; j++) - // { - // temp.append(j); - // } - // _scenParams.hwRegister.atgcLut.append(temp); - // } -} + /**************** /registerParameters/pulseProperties/halfPeriod ********************/ + datasetBranch ("/registerParameters/pulseProperties/halfPeriod", floatArray); + QList halfPeriod; + for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++) + { + halfPeriod.push_back(static_cast(floatArray[0][j])); + } -void MainWindow::setDTgc() -{ - _dTgc.clear(); - for (quint16 i = 0; i < 1024; i++) - { - _dTgc.append(i); - } -} -void MainWindow::on_btn_dtgc_clicked() -{ + /**************** /registerParameters/pulseProperties/halfCycleNo ********************/ + datasetBranch ("/registerParameters/pulseProperties/halfCycleNo", floatArray); + QList halfCycleNo; - ui->l_dtgc->setText("doing"); - changeLabelTextColor(ui->l_dtgc, Qt::red); + for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++) + { + halfCycleNo.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/pulseProperties/pulseVoltSel ********************/ + datasetBranch ("/registerParameters/pulseProperties/pulseVoltSel", floatArray); + QList pulseVoltSel; + + for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++) + { + pulseVoltSel.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/pulseProperties/startPhase ********************/ + datasetBranch ("/registerParameters/pulseProperties/startPhase", floatArray); + QList startPhase; + + for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++) + { + startPhase.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/pulseProperties/dampingPulseWidth ********************/ + datasetBranch ("/registerParameters/pulseProperties/dampingPulseWidth", floatArray); + QList dampingPulseWidth; + + for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++) + { + dampingPulseWidth.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/pulseProperties ********************/ + Pulse_t pulseObj; + scenParams.hwRegister.pulseProps.clear(); + + for (qint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++) + { + pulseObj.halfPeriod = halfPeriod.at(j); + pulseObj.startPhase = startPhase.at(j); + pulseObj.halfCycleNo = halfCycleNo.at(j); + pulseObj.pulseVoltSel = pulseVoltSel.at(j); + pulseObj.dampingPulseWidth = dampingPulseWidth.at(j); + + scenParams.hwRegister.pulseProps.push_back(pulseObj); + } + + + /**************** /registerParameters/rxBeamformerProperties/mla ********************/ + datasetBranch ("/registerParameters/rxBeamformerProperties/mla", floatArray); + QList mla; + + for (quint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++) + { + mla.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/rxBeamformerProperties/lag ********************/ + datasetBranch ("/registerParameters/rxBeamformerProperties/lag", floatArray); + QList lag; + + for (quint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++) + { + lag.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/rxBeamformerProperties/apodizationSel ********************/ + datasetBranch ("/registerParameters/rxBeamformerProperties/apodizationSel", floatArray); + QList apodizationSel; + + for (quint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++) + { + apodizationSel.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/rxBeamformerProperties ********************/ + RxBeamFormer_t rxBeamformerObj; + scenParams.hwRegister.rxBeamFormerProps.clear(); + + for (qint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++) + { + rxBeamformerObj.mla = mla.at(j); + rxBeamformerObj.lag = lag.at(j); + rxBeamformerObj.apodizationSel = apodizationSel.at(j); + + scenParams.hwRegister.rxBeamFormerProps.push_back(rxBeamformerObj); + } + + + /**************** /registerParameters/receiverConfigProperties/mla ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/mla", floatArray); + QList receiverCfgMla; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + receiverCfgMla.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/lineMode ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/lineMode", floatArray); + QList lineMode; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + lineMode.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/aTgcSel ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/aTgcSel", floatArray); + QList aTgcSel; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + aTgcSel.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/stbEn ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/stbEn", floatArray); + QList stbEn; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + stbEn.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/stb ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/stb", floatArray); + QList stb; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + stb.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/subtractFilterEn ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/subtractFilterEn", floatArray); + QList subtractFilterEn; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + subtractFilterEn.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/dcCancelEn ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/dcCancelEn", floatArray); + QList dcCancelEn; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + dcCancelEn.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/ncoFreqSel ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/ncoFreqSel", floatArray); + QList ncoFreqSel; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + ncoFreqSel.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/lpfSel ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/lpfSel", floatArray); + QList lpfSel; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + lpfSel.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/absEn ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/absEn", floatArray); + QList absEn; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + absEn.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/focusNo ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/focusNo", floatArray); + QList focusNo; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + focusNo.push_back(static_cast(floatArray[0][j])); + } + + /**************** /registerParameters/receiverConfigProperties/lineFilterEn ********************/ + datasetBranch ("/registerParameters/receiverConfigProperties/lineFilterEn", floatArray); + QList lineFilterEn; + + for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + lineFilterEn.push_back(static_cast(floatArray[0][j])); + } + +// /**************** /registerParameters/receiverConfigProperties/dpeEn ********************/ +// datasetBranch ("/registerParameters/receiverConfigProperties/dpeEn", floatArray); +// QList dpeEn; + +// for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) +// { +// dpeEn.push_back(static_cast(floatArray[0][j])); +// } + +// /**************** /registerParameters/receiverConfigProperties/ddcEn ********************/ +// datasetBranch ("/registerParameters/receiverConfigProperties/ddcEn", floatArray); +// QList ddcEn; + +// for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) +// { +// ddcEn.push_back(static_cast(floatArray[0][j])); +// } + +// /**************** /registerParameters/receiverConfigProperties/wmfEn ********************/ +// datasetBranch ("/registerParameters/receiverConfigProperties/wmfEn", floatArray); +// QList wmfEn; + +// for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) +// { +// wmfEn.push_back(static_cast(floatArray[0][j])); +// } + + /**************** /registerParameters/receiverConfigProperties ********************/ + ReceiverConfig_t receiverCfgObj; + scenParams.hwRegister.receiverConfigProps.clear(); + + for (qint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++) + { + receiverCfgObj.mla = receiverCfgMla.at(j); + receiverCfgObj.stb = stb.at(j); + receiverCfgObj.ddcn = 1; + receiverCfgObj.absEn = absEn.at(j); + receiverCfgObj.dpeEn = 0; + receiverCfgObj.stbEn = stbEn.at(j); + receiverCfgObj.wmfEn = 0; + receiverCfgObj.lpfSel = lpfSel.at(j); + receiverCfgObj.aTgcSel = aTgcSel.at(j); + receiverCfgObj.focusNo = focusNo.at(j); + receiverCfgObj.lineMode = lineMode.at(j); + receiverCfgObj.dcCancelEn = dcCancelEn.at(j); + receiverCfgObj.ncoFreqSel = ncoFreqSel.at(j); + receiverCfgObj.lineFilterEn = lineFilterEn.at(j); + receiverCfgObj.subtractFilterEn = subtractFilterEn.at(j); + + scenParams.hwRegister.receiverConfigProps.push_back(receiverCfgObj); + } + +// for (auto i=0; i<1; i++) +// { +// for(auto j=0; j<20; j++) +// { +// qDebug() << scenParams.hwRegister.atgcLut[3][j]; +// } +// } - _trx.setDtgcLut(_dTgc); + _trx.setScenario(scenParams); - ui->l_dtgc->setText("done"); - changeLabelTextColor(ui->l_dtgc, Qt::green); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + ui->l_scenFillingDone->setText("done"); + changeLabelTextColor(ui->l_scenFillingDone, Qt::green); } - -void MainWindow::setBlendWeight() +/*************************************************************************************************/ +void MainWindow::on_btn_h5Browse_clicked() { - QVector temp; - _scenParams.hwRegister.blendWeight.clear(); + QFileDialog fileDialog; + fileDialog.setNameFilters({"Scenario file (*.h5)"}); + auto result = fileDialog.exec(); - for (quint8 i = 0; i < 4; i++) + if(result) { - temp.clear(); - for (quint16 j = 0; j < 512; j++) - { - temp.append(j); - } - _scenParams.hwRegister.blendWeight.append(temp); + auto selectedPath = fileDialog.selectedFiles()[0]; + ui->tb_h5File->setText(selectedPath); + _settings->setValue(SCENARIO_FILE_PATH, selectedPath); } } - -void MainWindow::setLpf() +/*************************************************************************************************/ +void MainWindow::on_btn_setScenario_clicked() { - // QVector temp; - // _scenParams->hwRegister->lpfLut.clear(); - - // for (quint8 i = 0; i < 4; i++) - // { - // temp.clear(); - // for (quint8 j = 0; j < 48; j++) - // { - // temp.append(j); - // } - // _scenParams->hwRegister->lpfLut.append(temp); - // } + _timeout->stop(); + ui->l_scenFillingDone->setText("doing"); + changeLabelTextColor(ui->l_scenFillingDone, Qt::red); + + QString h5Path = ui->tb_h5File->text(); + + auto scenFuture = QtConcurrent::run(this, &MainWindow::setScenario, h5Path.toStdString()); + scenEndWather.setFuture(scenFuture); } +/*************************************************************************************************/ + void MainWindow::on_btn_setAtgcMode_clicked() { @@ -2728,19 +3200,70 @@ void MainWindow::on_btn_setAtgcMode_clicked() /*************************************************************************************************/ /**************************************** EEPROM *************************************************/ /*************************************************************************************************/ + +QByteArray MainWindow::str2ByteArray (QString& str) +{ + QByteArray finalArray; + QByteArray temp; + qint8 value; + + auto asciiArray = str.toUpper().toUtf8(); + + foreach(auto i, asciiArray) + { + if (i <= 0x39 && i >= 0x30) + temp.push_back(i - 0x30); + else if (i <= 0x46 && i >= 0x41) + temp.push_back(i - 0x37); + else + { + throw "Out of range"; + } + } + for (quint8 k = 0; k < temp.size()/2; k++) + { + value = static_cast(((temp.at(2*k) << 4) & 0xF0)+((temp.at(2*k + 1)) & 0xF)); + finalArray.push_back(value); + } + return finalArray; +} + +QString MainWindow::uint2IdString (quint32& id) +{ + QString idStr = QString::number(id, 16); + return idStr; +} + +QString MainWindow::byteArray2InfoString (QByteArray& arr) +{ + QString infoStr; + foreach(auto j, arr) + { + quint8 l = static_cast(j); + if (l <= 15) + infoStr = infoStr + "0" + QString::number(l, 16); + else + infoStr = infoStr + QString::number(l, 16); + } + return infoStr; +} + + void MainWindow::on_btn_trxRomWrite_clicked() { - QByteArray arr; - arr.clear(); QString txtStr = ui->tb_trxRomWrite->toPlainText(); try { - foreach (auto i, txtStr){ - arr.append(i.toLatin1()); - } - trxEepromWrite(arr, 0, _bCtrl); + QByteArray sendingArray = str2ByteArray(txtStr); + trxEepromWrite(sendingArray, 0, _bCtrl); + + } + catch (const char* exception) + { + qDebug() << exception; } + catch (SonoException& e) { qDebug() << e.what(); @@ -2754,7 +3277,7 @@ void MainWindow::on_btn_trxRomIdRead_clicked() try { quint32 id = _trx.trxId(); - ui->tb_trxRomIdRead->setText(QString::number(id, 16)); + ui->tb_trxRomIdRead->setText(uint2IdString(id)); } catch (SonoException& e) { @@ -2768,8 +3291,8 @@ void MainWindow::on_btn_trxRomInfoRead_clicked() try { - QString infoStr = _trx.trxInfo(); - ui->tb_trxRomInfoRead->setText(infoStr); + QByteArray receivingArray = _trx.trxInfo(); + ui->tb_trxRomInfoRead->setText(byteArray2InfoString(receivingArray)); } catch (SonoException& e) { @@ -2782,16 +3305,18 @@ void MainWindow::on_btn_trxRomInfoRead_clicked() void MainWindow::on_btn_mpsRomWrite_clicked() { - QByteArray arr; - arr.clear(); QString txtStr = ui->tb_mpsRomWrite->toPlainText(); try { - foreach (auto i, txtStr){ - arr.append(i.toLatin1()); - } - mpsEepromWrite(arr, 0, _bCtrl); + QByteArray sendingArray = str2ByteArray(txtStr); + mpsEepromWrite(sendingArray, 0, _bCtrl); + } + catch (const char* exception) + { + qDebug() << exception; + } + catch (SonoException& e) { qDebug() << e.what(); @@ -2805,7 +3330,7 @@ void MainWindow::on_btn_mpsRomIdRead_clicked() try { quint32 id = _trx.mpsId(); - ui->tb_mpsRomIdRead->setText(QString::number(id, 16)); + ui->tb_mpsRomIdRead->setText(uint2IdString(id)); } catch (SonoException& e) { @@ -2819,8 +3344,8 @@ void MainWindow::on_btn_mpsRomInfoRead_clicked() try { - QString infoStr = _trx.mpsInfo(); - ui->tb_mpsRomInfoRead->setText(infoStr); + QByteArray receivingArray = _trx.mpsInfo(); + ui->tb_mpsRomInfoRead->setText(byteArray2InfoString(receivingArray)); } catch (SonoException& e) { @@ -2833,16 +3358,18 @@ void MainWindow::on_btn_mpsRomInfoRead_clicked() void MainWindow::on_btn_prbCtrlRomWrite_clicked() { - QByteArray arr; - arr.clear(); QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText(); try { - foreach (auto i, txtStr){ - arr.append(i.toLatin1()); - } - prbCtrlEepromWrite(arr, 0, _bCtrl); + QByteArray sendingArray = str2ByteArray(txtStr); + prbCtrlEepromWrite(sendingArray, 0, _bCtrl); + + } + catch (const char* exception) + { + qDebug() << exception; } + catch (SonoException& e) { qDebug() << e.what(); @@ -2856,7 +3383,7 @@ void MainWindow::on_btn_prbCtrlRomIdRead_clicked() try { quint32 id = _trx.prbCtrlId(); - ui->tb_prbCtrlRomIdRead->setText(QString::number(id, 16)); + ui->tb_prbCtrlRomIdRead->setText(uint2IdString(id)); } catch (SonoException& e) { @@ -2870,8 +3397,8 @@ void MainWindow::on_btn_prbCtrlRomInfoRead_clicked() try { - QString infoStr = _trx.prbCtrlInfo(); - ui->tb_prbCtrlRomInfoRead->setText(infoStr); + QByteArray receivingArray = _trx.prbCtrlInfo(); + ui->tb_prbCtrlRomInfoRead->setText(byteArray2InfoString(receivingArray)); } catch (SonoException& e) { @@ -2884,17 +3411,19 @@ void MainWindow::on_btn_prbCtrlRomInfoRead_clicked() void MainWindow::on_btn_prbRomWrite_clicked() { - QByteArray arr; - arr.clear(); auto sel = ui->cb_prbSelRom->currentIndex(); QString txtStr = ui->tb_prbRomWrite->toPlainText(); try { - foreach (auto i, txtStr){ - arr.append(i.toLatin1()); - } - prbEepromWrite(arr, 0, static_cast(sel), _bCtrl); + QByteArray sendingArray = str2ByteArray(txtStr); + prbEepromWrite(sendingArray, 0, static_cast(sel), _bCtrl); + + } + catch (const char* exception) + { + qDebug() << exception; } + catch (SonoException& e) { qDebug() << e.what(); @@ -2905,16 +3434,24 @@ void MainWindow::on_btn_prbRomWrite_clicked() void MainWindow::on_btn_prbRomIdRead_clicked() { + auto sel = ui->cb_prbSelRom->currentIndex(); + quint32 id(0); try { - auto sel = ui->cb_prbSelRom->currentIndex(); - quint32 id = _trx.prbId(static_cast(sel)); - ui->tb_prbRomIdRead->setText(QString::number(id, 16)); + switch (sel) + { + case 0: id = _trx.prbId(prbA); break; + case 1: id = _trx.prbId(prbB); break; + case 2: id = _trx.prbId(prbC); break; + case 3: id = _trx.prbId(prbD); break; + } + } catch (SonoException& e) { qDebug() << e.what(); } + ui->tb_prbRomIdRead->setText(uint2IdString(id)); } @@ -2924,8 +3461,8 @@ void MainWindow::on_btn_prbRomInfoRead_clicked() try { auto sel = ui->cb_prbSelRom->currentIndex(); - QByteArray arr = _trx.prbInfo(static_cast(sel)); - ui->tb_prbRomInfoRead->setText(QString(arr)); + QByteArray receivingArray = _trx.prbInfo(static_cast(sel)); + ui->tb_prbRomInfoRead->setText(byteArray2InfoString(receivingArray)); } catch (SonoException& e) { @@ -2935,147 +3472,51 @@ void MainWindow::on_btn_prbRomInfoRead_clicked() } /*************************************************************************************************/ -/************************************** BeamFormer ***********************************************/ +/*********************************** AFE Configuration *******************************************/ /*************************************************************************************************/ -void MainWindow::setRxBeamformerPrp() -{ - // _scenParams->hwRegister->rxBeamformer->lag.clear(); - // _scenParams->hwRegister->rxBeamformer->mla.clear(); - // _scenParams->hwRegister->rxBeamformer->apodization.clear(); - - // for (quint8 i = 0; i < 8; i++){ - // _scenParams->hwRegister->rxBeamformer->lag.append(i); - // _scenParams->hwRegister->rxBeamformer->mla.append((i*2) % 7); - // _scenParams->hwRegister->rxBeamformer->apodization.append((i*3) % 3); - // } -} - -void MainWindow::setProbeElement() -{ - _scenParams.hwRegister.elementXPosition.clear(); - _scenParams.hwRegister.elementYPosition.clear(); - _scenParams.hwRegister.elementZPosition.clear(); - - for (quint8 i = 0; i < 192; i++){ - _scenParams.hwRegister.elementXPosition.append(i); - _scenParams.hwRegister.elementYPosition.append(i*2); - _scenParams.hwRegister.elementZPosition.append(i*3); - } -} - -void MainWindow::setApodization() -{ - // QVector temp; - // _scenParams->hwRegister->apodization.clear(); - - // for (quint8 i = 0; i < 4; i++) - // { - // temp.clear(); - // for (quint16 j = 0; j < 3057; j++) - // { - // temp.append(j); - // } - // _scenParams->hwRegister->apodization.append(temp); - // } -} - -void MainWindow::setPulseProperties() -{ - // _scenParams->hwRegister->pulse->halfPeriod.clear(); - // _scenParams->hwRegister->pulse->halfCycleNo.clear(); - // _scenParams->hwRegister->pulse->startPhase.clear(); - // _scenParams->hwRegister->pulse->pulseVoltSel.clear(); - // _scenParams->hwRegister->pulse->dampingPulseWidth.clear(); - - - // for (quint8 i = 0; i < 8; i++){ - - // _scenParams->hwRegister->pulse->halfPeriod.append(i); - // _scenParams->hwRegister->pulse->halfCycleNo.append(i*2); - // _scenParams->hwRegister->pulse->startPhase.append((i % 2)==0); - // _scenParams->hwRegister->pulse->pulseVoltSel.append((i % 2)==0); - // _scenParams->hwRegister->pulse->dampingPulseWidth.append(i*3); - // } -} -//void MainWindow::setAfeProperties() +//void MainWindow::on_btn_scenParams_clicked() //{ -// _scenParams->afe->lpfProg.clear(); -// _scenParams->afe->pgaHpfDis.clear(); -// _scenParams->afe->pgaClampDis.clear(); -// _scenParams->afe->pgaGain.clear(); -// _scenParams->afe->gblActiveTerm.clear(); -// _scenParams->afe->actTermEn.clear(); -// _scenParams->afe->inputClampLvl.clear(); -// _scenParams->afe->lnaHpfDis.clear(); -// _scenParams->afe->lnaGainGbl.clear(); -// _scenParams->afe->lowNf.clear(); -// _scenParams->afe->powModes.clear(); -// _scenParams->afe->gblPdwn.clear(); -// _scenParams->afe->lnaHpfProg.clear(); - -// for (quint8 i = 0; i < 8; i++){ - -// _scenParams->afe->lpfProg.append(i); -// _scenParams->afe->pgaHpfDis.append((i % 2)==0); -// _scenParams->afe->pgaClampDis.append((i % 2)==0); -// _scenParams->afe->pgaGain.append((i % 2)==0); -// _scenParams->afe->gblActiveTerm.append((i*2) % 3); -// _scenParams->afe->actTermEn.append((i % 2)==0); -// _scenParams->afe->inputClampLvl.append((i*3) % 7); -// _scenParams->afe->lnaHpfDis.append((i % 2)==0); -// _scenParams->afe->lnaGainGbl.append((i*4) % 3); -// _scenParams->afe->lowNf.append((i % 2)==0); -// _scenParams->afe->powModes.append((i*5) % 3); -// _scenParams->afe->gblPdwn.append((i % 2)==0); -// _scenParams->afe->lnaHpfProg.append((i*6) % 3); - -// } -//} +// ui->l_scenParams->setText("doing"); +// changeLabelTextColor(ui->l_scenParams, Qt::red); +// _scenParams.focusTypeNumber = 100; +// _scenParams.totalTxShotNumber = 100; -void MainWindow::on_btn_scenParams_clicked() -{ - ui->l_scenParams->setText("doing"); - changeLabelTextColor(ui->l_scenParams, Qt::red); - - _scenParams.focusTypeNumber = 100; - _scenParams.totalTxShotNumber = 100; - - for (int var = 0; var < 100; var++) { - _scenParams.rxBeamFormerNumber.append(5); - } +// for (int var = 0; var < 100; var++) { +// _scenParams.rxBeamFormerNumber.append(5); +// } - auto startIndex = ui->tb_startIdx->text().toUInt(Q_NULLPTR, 16); - if(startIndex == 0 && ui->tb_startIdx->text() != "0") - { - MESSAGE_BOX("Invalid input format for start index"); - return; - } +// auto startIndex = ui->tb_startIdx->text().toUInt(Q_NULLPTR, 16); +// if(startIndex == 0 && ui->tb_startIdx->text() != "0") +// { +// MESSAGE_BOX("Invalid input format for start index"); +// return; +// } - auto endIndex = ui->tb_endIdx->text().toUInt(Q_NULLPTR, 16); - if(endIndex == 0 && ui->tb_endIdx->text() != "0") - { - MESSAGE_BOX("Invalid input format for stop index"); - return; - } - _scenParams.hwRegister.scenarioStartIndex = startIndex; - _scenParams.hwRegister.scenarioEndIndex = endIndex; +// auto endIndex = ui->tb_endIdx->text().toUInt(Q_NULLPTR, 16); +// if(endIndex == 0 && ui->tb_endIdx->text() != "0") +// { +// MESSAGE_BOX("Invalid input format for stop index"); +// return; +// } +// _scenParams.hwRegister.scenarioStartIndex = startIndex; +// _scenParams.hwRegister.scenarioEndIndex = endIndex; - try - { - _trx.setScenario(_scenParams); - } +// try +// { +// _trx.setScenario(_scenParams); +// } - catch(SonoException& e) - { - qDebug() << e.what(); - } +// catch(SonoException& e) +// { +// qDebug() << e.what(); +// } - ui->l_scenParams->setText("done"); - changeLabelTextColor(ui->l_scenParams, Qt::green); -} +// ui->l_scenParams->setText("done"); +// changeLabelTextColor(ui->l_scenParams, Qt::green); +//} /*************************************************************************************************/ void MainWindow::on_btn_afeRead_clicked() @@ -3099,21 +3540,6 @@ void MainWindow::on_btn_afeRead_clicked() } -/*************************************************************************************************/ -void MainWindow::on_btn_afeGblPwrdn_clicked() -{ - auto name = ui->btn_afeGblPwrdn->text(); - if (name == "Pwrdn Enable") - { - _trx.setAfePwrdnMode(afePwrdnEnable); - ui->btn_afeGblPwrdn->setText("Pwrdn Disable"); - } - else - { - _trx.setAfePwrdnMode(afePwrdnDisable); - ui->btn_afeGblPwrdn->setText("Pwrdn Enable"); - } -} /*************************************************************************************************/ void MainWindow::setAfeConfig() @@ -3138,26 +3564,7 @@ void MainWindow::setAfeConfig() void MainWindow::on_btn_afeConfig_clicked() { _trx.setAfeConfig(_afeConfig); +} - int32_t temp[192]; - -// char filePath[] = "/home/hasis/Desktop/Develop_HardwareTest/h5_scenario/scenario.h5"; -// hid_t H5_hid = H5Fcreate (filePath, H5F_ACC_RDONLY, H5P_DEFAULT, H5P_DEFAULT); -// hid_t H5_open = H5Dopen1(H5_hid, "sramParameters/focusTypeNo"); -// status = H5Dread(H5_open, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, temp); - -// const H5std_string filePath("/home/hasis/Desktop/Develop_HardwareTest/h5_scenario/scenario.h5"); -// H5File file(filePath, H5F_ACC_RDONLY); - -// //const H5std_string dataset_type("sramParameters/focusTypeNo"); -// const H5std_string dataset_type("/registerParameters/elementXPositionsQ"); -// DataSet H5_focus = file.openDataSet(dataset_type); - -// H5_focus.read(temp, PredType::NATIVE_INT, H5S_ALL, H5S_ALL); - -// for(auto var: temp) -// { -// qDebug() << var; -// } +/*************************************************************************************************/ -} diff --git a/mainwindow.h b/mainwindow.h index b6dab91..700c501 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -15,13 +15,17 @@ #include #include #include +#include +#include +#include +#include #include "qcustomplot.h" #include "include/model/hardware/core/TrxBoard.h" #include "api.h" -//#include "H5Cpp.h" -//#include "hdf5.h" -//#include "H5File.h" +#include "H5Cpp.h" +#include "hdf5.h" +#include "H5File.h" #define MESSAGE_BOX(M) \ emit showMessage(M) @@ -60,10 +64,16 @@ #define ULTIMATE_LOG_COUNT 50 +#define MAX_ARRAY_LENGTH 3057U +#define MAX_ARRAY_DEPTH 4U + QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE +using namespace H5; +using namespace std; + class MainWindow : public QMainWindow { Q_OBJECT @@ -73,6 +83,7 @@ public: ~MainWindow(); private: + Ui::MainWindow *ui; TrxBoard _trx; @@ -107,28 +118,21 @@ private: StatusVec* _vec; - ScenGenHardwareOutput_t _scenParams; - AfeConfig _afeConfig; - void setReceiverConfiguration (void); - - QVector _lineFilter; - void setLineFilter (void); - - void setFreqLut (void); + ScenGenHardwareOutput_t scenParams; - QVector _stb; - void setStbCoeff (void); + QFutureWatcher scenEndWather; - QVector _dTgc; - void setDTgc (void); + H5File _file; - void setATgc (void); + int32_t intArray [MAX_ARRAY_DEPTH][MAX_ARRAY_LENGTH]; + float_t floatArray[MAX_ARRAY_DEPTH][MAX_ARRAY_LENGTH]; - void setBlendWeight (void); + template + void datasetBranch(const string& branchPath, T datasetValue[][3057]); - void setLpf (void); + void setScenario(const string& h5Path); void fpgaProgrammer(QString path); @@ -140,22 +144,20 @@ private: void changeLabelTextColor(QLabel* label, QColor color); - void setRxBeamformerPrp (void); - void setAfeConfig (void); - void setPulseProperties (void); - - void setProbeElement (void); - - void setApodization (void); - void fillRam(QString path); void logPcie(); void continuousFrameRepresent(void); + QByteArray str2ByteArray (QString& str); + + QString uint2IdString (quint32& id); + + QString byteArray2InfoString (QByteArray& arr); + QString _logFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/"; QString _emulFolder = "/home/hasis/Desktop/Develop_HardwareTest/developHw/sram_frame.bin"; @@ -173,8 +175,12 @@ private: private slots: + void getPrbChange(); + void getFramePacket (QByteArray packet); + void restartTimer(); + void on_rbtn_reg_toggled(bool checked); void on_rbtn_offset_toggled(bool checked); @@ -286,13 +292,6 @@ private slots: // bool checkTermalShutdown(quint8 value); - void on_btn_lineFilter_clicked(); - - - void on_btn_dtgc_clicked(); - - void on_btn_stbCoeff_clicked(); - void on_btn_setAtgcMode_clicked(); @@ -323,8 +322,6 @@ private slots: void on_btn_scenStart_clicked(); - void on_btn_scenParams_clicked(); - void on_btn_emulator_clicked(); void on_btn_dmaShow_clicked(); @@ -347,10 +344,12 @@ private slots: void on_chk_mpsInit_clicked(); - void on_btn_afeGblPwrdn_clicked(); - void on_btn_afeConfig_clicked(); + void on_btn_h5Browse_clicked(); + + void on_btn_setScenario_clicked(); + signals: // void updateBlockProgressValue(int percentage, QProgressBar* prg); // void updateFpgaProgressValue(int percentage); @@ -362,6 +361,7 @@ signals: void threeDReady(); void twoDReady(); void sendLogCount(qint32 counter, QProgressDialog* _progress); + void connectedPrbChange(); }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index cadca56..3a9ae2f 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -20,7 +20,7 @@ 0 9 811 - 311 + 341 @@ -359,7 +359,7 @@ - 60 + 10 70 128 17 @@ -401,202 +401,11 @@ Scen Player - - - - 20 - 10 - 190 - 58 - - - - - - - - - Start Idx: - - - - - - - - - - - - - - End Idx: - - - - - - - - - - - - - - 270 - 10 - 160 - 51 - - - - - - - - - Filling: - - - - - - - doing - - - - - - - - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Write Scenario Parameters</span></p></body></html> - - - Scenario Parameters - - - - - - - - - 500 - 10 - 106 - 51 - - - - - - - - - Filling: - - - - - - - doing - - - - - - - - - Line Filter Coeff - - - - - - - - - 620 - 10 - 84 - 51 - - - - - - - - - Filling: - - - - - - - doing - - - - - - - - - DTgc - - - - - - - - - 710 - 10 - 84 - 48 - - - - - - - - - Filling: - - - - - - - doing - - - - - - - - - Stb Coeff - - - - - 0 - 210 + 230 370 71 @@ -678,7 +487,7 @@ 0 - 90 + 120 481 111 @@ -759,30 +568,123 @@ - + 380 - 30 - 94 + 50 + 91 23 - Pwrdn Disable + Config - + + + + + 0 + 10 + 741 + 105 + + + + + 0 + 0 + + + + + 0 + 105 + + + + + 16777215 + 105 + + + + + 50 + false + false + + + + Scenario Parameters + + - 380 + 10 + 30 + 721 + 27 + + + + + + + HDF5 file: + + + + + + + + + + Browse... + + + + + + + + + 10 70 - 91 + 82 + 17 + + + + + + + Filling: + + + + + + + doing + + + + + + + + + 633 + 70 + 101 23 - Config + Set Scenario @@ -1316,7 +1218,7 @@ 10 - 210 + 230 791 71 @@ -1481,90 +1383,19 @@ 0 - 330 + 350 811 - 181 + 161 TRX Board - - - - 380 - 20 - 371 - 27 - - - - - - - PLLCLK TPS Regulator(KHz): - - - - - - - - - - PushButton - - - - - - - - - 0 - 20 - 371 - 27 - - - - - - - PLLCLK ST Regulator(KHz): - - - - - - - - - - PushButton - - - - - - - - - 0 - 40 - 751 - 20 - - - - Qt::Horizontal - - 300 - 50 + 30 16 111 @@ -1573,39 +1404,13 @@ Qt::Vertical - - - - 540 - 160 - 163 - 17 - - - - - - - On Board Temp: - - - - - - - Unknown - - - - - - 10 - 60 + 0 + 30 126 - 19 + 21 @@ -1629,7 +1434,7 @@ 310 - 50 + 30 126 17 @@ -1655,7 +1460,7 @@ 310 - 70 + 50 119 17 @@ -1681,7 +1486,7 @@ 310 - 90 + 70 121 17 @@ -1707,7 +1512,7 @@ 310 - 110 + 90 151 17 @@ -1733,7 +1538,7 @@ 310 - 130 + 110 152 17 @@ -1759,8 +1564,8 @@ 540 - 50 - 169 + 30 + 147 17 @@ -1785,7 +1590,7 @@ 310 - 150 + 130 143 17 @@ -1811,8 +1616,8 @@ 540 - 70 - 165 + 50 + 164 17 @@ -1833,88 +1638,11 @@ - - - - 710 - 60 - 91 - 23 - - - - FPGA Version - - - - - - 720 - 90 - 81 - 17 - - - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Master Code</span></p></body></html> - - - TextLabel - - - - - - 720 - 110 - 81 - 17 - - - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave0 Code</span></p></body></html> - - - TextLabel - - - - - - 720 - 130 - 81 - 17 - - - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave1 Code</span></p></body></html> - - - TextLabel - - - - - - 720 - 150 - 81 - 17 - - - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave2 Code</span></p></body></html> - - - TextLabel - - 470 - 50 + 30 62 122 @@ -1987,8 +1715,8 @@ 540 90 - 149 - 63 + 145 + 62 @@ -2034,20 +1762,13 @@ - - - - - - - - 10 - 90 + 0 + 60 285 67 @@ -2258,6 +1979,91 @@ + + + + 140 + 30 + 163 + 21 + + + + + + + On Board Temp: + + + + + + + Unknown + + + + + + + + + 710 + 40 + 101 + 111 + + + + + + + FPGA Version + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Master Code</span></p></body></html> + + + TextLabel + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave0 Code</span></p></body></html> + + + TextLabel + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave1 Code</span></p></body></html> + + + TextLabel + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave2 Code</span></p></body></html> + + + TextLabel + + + + + @@ -2326,7 +2132,7 @@ - TextLabel + None diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index 2347981..852e19e 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -36,7 +36,7 @@ void TrxBoard::readData() auto temp = QByteArray::fromRawData(_device.getBufferPtr(_swCounter), BUFFER_SIZE); packetEngine.newData(temp); - emit sendFramePacket(temp); + //emit sendFramePacket(temp); _swCounter++; if(_swCounter >= SW_BUFFER_NUM) @@ -212,48 +212,48 @@ void TrxBoard::setScenario(ScenGenHardwareOutput_t scenGenHw) scenParams->focusTypeNumber = scenGenHw.focusTypeNumber; scenParams->totalTxShotNumber = scenGenHw.totalTxShotNumber; scenParams->rxBeamFormerNumber = scenGenHw.rxBeamFormerNumber; - scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex; - scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex; + scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex; + scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex; scenParams->hwRegister->lpfLut = scenGenHw.hwRegister.lpfLut; scenParams->hwRegister->atgcLut=scenGenHw.hwRegister.atgcLut; scenParams->hwRegister->apodization=scenGenHw.hwRegister.apodizationLut; - scenParams->hwRegister->blendWeight = scenGenHw.hwRegister.blendWeight; - scenParams->hwRegister->elementPosition->xPosition = scenGenHw.hwRegister.elementXPosition; - scenParams->hwRegister->elementPosition->yPosition = scenGenHw.hwRegister.elementYPosition; - scenParams->hwRegister->elementPosition->zPosition = scenGenHw.hwRegister.elementZPosition; - scenParams->hwRegister->freqLut = scenGenHw.hwRegister.freqLut; + scenParams->hwRegister->blendWeight = scenGenHw.hwRegister.blendWeight; + scenParams->hwRegister->elementPosition->xPosition = scenGenHw.hwRegister.elementXPosition; + scenParams->hwRegister->elementPosition->yPosition = scenGenHw.hwRegister.elementYPosition; + scenParams->hwRegister->elementPosition->zPosition = scenGenHw.hwRegister.elementZPosition; + scenParams->hwRegister->freqLut = scenGenHw.hwRegister.freqLut; scenParams->hwRegister->dtgcLut = scenGenHw.hwRegister.dtgcLut; scenParams->hwRegister->pulseTypeNumber = scenGenHw.hwRegister.pulseTypeNumber; - scenParams->hwRegister->rxBeamFormerTypeNumber = scenGenHw.hwRegister.rxBeamFormerTypeNumber; - scenParams->hwRegister->receiverConfigTypeNumber = - scenGenHw.hwRegister.receiverConfigTypeNumber; + scenParams->hwRegister->rxBeamFormerTypeNumber = scenGenHw.hwRegister.rxBeamFormerTypeNumber; + scenParams->hwRegister->receiverConfigTypeNumber = + scenGenHw.hwRegister.receiverConfigTypeNumber; - scenParams->hwRegister->pulse->clear(); - foreach(auto i, scenGenHw.hwRegister.pulseProps) - { - scenParams->hwRegister->pulse->halfPeriod.append(i.halfPeriod); - scenParams->hwRegister->pulse->startPhase.append(i.startPhase); - scenParams->hwRegister->pulse->halfCycleNo.append(i.halfCycleNo); - scenParams->hwRegister->pulse->pulseVoltSel.append(i.pulseVoltSel); - scenParams->hwRegister->pulse->dampingPulseWidth.append(i.dampingPulseWidth); - } + scenParams->hwRegister->pulse->clear(); + foreach(auto i, scenGenHw.hwRegister.pulseProps) + { + scenParams->hwRegister->pulse->halfPeriod.append(i.halfPeriod); + scenParams->hwRegister->pulse->startPhase.append(i.startPhase); + scenParams->hwRegister->pulse->halfCycleNo.append(i.halfCycleNo); + scenParams->hwRegister->pulse->pulseVoltSel.append(i.pulseVoltSel); + scenParams->hwRegister->pulse->dampingPulseWidth.append(i.dampingPulseWidth); + } - scenParams->hwRegister->rxBeamformer->clear(); - foreach(auto j, scenGenHw.hwRegister.rxBeamFormerProps) - { - scenParams->hwRegister->rxBeamformer->lag.append(j.lag); - scenParams->hwRegister->rxBeamformer->mla.append(j.mla); - scenParams->hwRegister->rxBeamformer->apodization.append(j.apodizationSel); - } + scenParams->hwRegister->rxBeamformer->clear(); + foreach(auto j, scenGenHw.hwRegister.rxBeamFormerProps) + { + scenParams->hwRegister->rxBeamformer->lag.append(j.lag); + scenParams->hwRegister->rxBeamformer->mla.append(j.mla); + scenParams->hwRegister->rxBeamformer->apodization.append(j.apodizationSel); + } - scenParams->hwRegister->configLut->clear(); + scenParams->hwRegister->configLut->clear(); foreach (auto k, scenGenHw.hwRegister.receiverConfigProps) { scenParams->hwRegister->configLut->mla.append(k.mla); scenParams->hwRegister->configLut->stb.append(k.stb); scenParams->hwRegister->configLut->absEn.append(k.absEn); - scenParams->hwRegister->configLut->ddcEn.append(k.ddcEn); + scenParams->hwRegister->configLut->ddcEn.append(k.ddcn); scenParams->hwRegister->configLut->dpeEn.append(k.dpeEn); scenParams->hwRegister->configLut->stbEn.append(k.stbEn); scenParams->hwRegister->configLut->wmfEn.append(k.wmfEn); @@ -268,7 +268,7 @@ void TrxBoard::setScenario(ScenGenHardwareOutput_t scenGenHw) } scenParams->indexParams->dLineNum = scenGenHw.indexParams.dLineNum; - scenParams->indexParams->frameType=scenGenHw.indexParams.frameType; + scenParams->indexParams->frameType=scenGenHw.frameType; scenParams->indexParams->dEnsembleNum = scenGenHw.indexParams.dEnsembleNum; scenParams->indexParams->lastLineInFrame = scenGenHw.indexParams.lastLineInFrame; scenParams->indexParams->firstLineInFrame = scenGenHw.indexParams.firstLineInFrame; @@ -310,146 +310,146 @@ void TrxBoard::setScenario(ScenGenHardwareOutput_t scenGenHw) void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) { ///////////////////////////////// BeamFormer setting /////////////////////////////// - QList > elementPosition; - QList x; - QList y; - QList z; + QList > elementPosition; + QList x; + QList y; + QList z; //_signedQntzrVec.clear(); _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->xPosition, - 1, - 18, - 0, - 0, - true, - true, - true); + 1, + 18, + 0, + 0, + true, + true, + true); QList xPosQ = _unsignedQntzrVec.toList(); //QList xPosQ = signedVector2unsignedList(_signedQntzrVec); _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->yPosition, - 1, - 18, - 0, - 0, - true, - true, - true); + 1, + 18, + 0, + 0, + true, + true, + true); QList yPosQ = _unsignedQntzrVec.toList(); _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->zPosition, - 0, - 17, - 0, - 0, - true, - true, - true); + 0, + 17, + 0, + 0, + true, + true, + true); QList zPosQ = _unsignedQntzrVec.toList(); - for(quint8 i = 0; i < 3; i++) - { - for(quint8 j = 0; j < SLAVE_ELEMENT_SEGMENT; j++) - { - x.append(xPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); - y.append(yPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); - z.append(zPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); - } - - elementPosition.append(x); - elementPosition.append(y); - elementPosition.append(z); - - switch(i) - { - case 0: - this->_beamFormerSlave0->probeElementPosition(elementPosition); - break; + for(quint8 i = 0; i < 3; i++) + { + for(quint8 j = 0; j < SLAVE_ELEMENT_SEGMENT; j++) + { + x.append(xPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); + y.append(yPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); + z.append(zPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); + } - case 1: - this->_beamFormerSlave1->probeElementPosition(elementPosition); - break; + elementPosition.append(x); + elementPosition.append(y); + elementPosition.append(z); - case 2: - this->_beamFormerSlave2->probeElementPosition(elementPosition); - break; - } + switch(i) + { + case 0: + this->_beamFormerSlave0->probeElementPosition(elementPosition); + break; - x.clear(); - y.clear(); - z.clear(); - elementPosition.clear(); - } - scenParamsFilling(set); + case 1: + this->_beamFormerSlave1->probeElementPosition(elementPosition); + break; - this->_beamFormerSlave0->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber, - scenParams->hwRegister->rxBeamformer); - this->_beamFormerSlave1->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber, - scenParams->hwRegister->rxBeamformer); - this->_beamFormerSlave2->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber, - scenParams->hwRegister->rxBeamformer); - scenParamsFilling(set); - - this->_beamFormerSlave0->pulseProperties(scenParams->hwRegister->pulseTypeNumber, - scenParams->hwRegister->pulse); - this->_beamFormerSlave1->pulseProperties(scenParams->hwRegister->pulseTypeNumber, - scenParams->hwRegister->pulse); - this->_beamFormerSlave2->pulseProperties(scenParams->hwRegister->pulseTypeNumber, - scenParams->hwRegister->pulse); - scenParamsFilling(set); + case 2: + this->_beamFormerSlave2->probeElementPosition(elementPosition); + break; + } - QList > apodizationQ; - foreach(auto vec, scenParams->hwRegister->apodization) - { - apodizationQ.push_back(vec.toList()); - } - this->_beamFormerSlave0->apodizationLut(apodizationQ); - this->_beamFormerSlave1->apodizationLut(apodizationQ); - this->_beamFormerSlave2->apodizationLut(apodizationQ); - scenParamsFilling(set); + x.clear(); + y.clear(); + z.clear(); + elementPosition.clear(); + } + scenParamsFilling(set); + + this->_beamFormerSlave0->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber, + scenParams->hwRegister->rxBeamformer); + this->_beamFormerSlave1->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber, + scenParams->hwRegister->rxBeamformer); + this->_beamFormerSlave2->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber, + scenParams->hwRegister->rxBeamformer); + scenParamsFilling(set); + + this->_beamFormerSlave0->pulseProperties(scenParams->hwRegister->pulseTypeNumber, + scenParams->hwRegister->pulse); + this->_beamFormerSlave1->pulseProperties(scenParams->hwRegister->pulseTypeNumber, + scenParams->hwRegister->pulse); + this->_beamFormerSlave2->pulseProperties(scenParams->hwRegister->pulseTypeNumber, + scenParams->hwRegister->pulse); + scenParamsFilling(set); + + QList > apodizationQ; + foreach(auto vec, scenParams->hwRegister->apodization) + { + apodizationQ.push_back(vec.toList()); + } + this->_beamFormerSlave0->apodizationLut(apodizationQ); + this->_beamFormerSlave1->apodizationLut(apodizationQ); + this->_beamFormerSlave2->apodizationLut(apodizationQ); + scenParamsFilling(set); -//this->_beamFormerSlave0->afeLut(scenParams->hwRegister->afe); -//this->_beamFormerSlave1->afeLut(scenParams->hwRegister->afe); -//this->_beamFormerSlave2->afeLut(scenParams->hwRegister->afe); -//scenParamsFilling(set); +////this->_beamFormerSlave0->afeLut(scenParams->hwRegister->afe); +////this->_beamFormerSlave1->afeLut(scenParams->hwRegister->afe); +////this->_beamFormerSlave2->afeLut(scenParams->hwRegister->afe); +////scenParamsFilling(set); ///////////////////////////////// DSP setting /////////////////////////////// - this->_dsp->receiverConfigurationLut(scenParams->hwRegister->receiverConfigTypeNumber, - scenParams->hwRegister->configLut); + this->_dsp->receiverConfigurationLut(scenParams->hwRegister->receiverConfigTypeNumber, + scenParams->hwRegister->configLut); _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->freqLut, 0, 24, 0, 0, true); QList freqLutQ = _unsignedQntzrVec.toList(); - this->_dsp->frequencyLut(freqLutQ); + this->_dsp->frequencyLut(freqLutQ); _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false); QList dtgcLutQ = _unsignedQntzrVec.toList(); this->_dsp->dtgcLut(dtgcLutQ); - QList temp; - QList > blendWeightQ; + QList temp; + QList > blendWeightQ; //_signedQntzrVec.clear(); - foreach(auto vec, scenParams->hwRegister->blendWeight) - { - temp.clear(); + foreach(auto vec, scenParams->hwRegister->blendWeight) + { + temp.clear(); _unsignedQntzrVec = Calculation::qntzr(vec, 0, 9, 8, 0, true, false, true); temp = _unsignedQntzrVec.toList(); - blendWeightQ.push_back(temp); - } - this->_dsp->blendWeight(blendWeightQ); + blendWeightQ.push_back(temp); + } + this->_dsp->blendWeight(blendWeightQ); - QList > atgcLutQ; - foreach(auto vec, scenParams->hwRegister->atgcLut) - { - atgcLutQ.push_back(vec.toList()); - } - this->_dsp->atgcLut(atgcLutQ); + QList > atgcLutQ; + foreach(auto vec, scenParams->hwRegister->atgcLut) + { + atgcLutQ.push_back(vec.toList()); + } + this->_dsp->atgcLut(atgcLutQ); - QList > lpfLutQ; - foreach(auto vec, scenParams->hwRegister->lpfLut) - { - lpfLutQ.push_back(vec.toList()); - } - this->_dsp->lpfLut(lpfLutQ); + QList > lpfLutQ; + foreach(auto vec, scenParams->hwRegister->lpfLut) + { + lpfLutQ.push_back(vec.toList()); + } + this->_dsp->lpfLut(lpfLutQ); ///////////////////////////////// Sram setting /////////////////////////////// this->_sram->setSramIndex(scenParams->totalTxShotNumber, scenParams->indexParams); @@ -462,15 +462,15 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) scenParamsFilling(set); ////////////////////////////// Scen Index setting //////////////////////////// - if(scenParams->scenarioEndIndex >= scenParams->scenarioStartIndex) - { - this->_scenPlayer->setStartIndex(scenParams->scenarioStartIndex); - this->_scenPlayer->setEndIndex(scenParams->scenarioEndIndex); - } - else - { - throw SonoException( - "The scenario end index must be greater than or equal to the scenario start index"); + if(scenParams->scenarioEndIndex >= scenParams->scenarioStartIndex) + { + this->_scenPlayer->setStartIndex(scenParams->scenarioStartIndex); + this->_scenPlayer->setEndIndex(scenParams->scenarioEndIndex); + } + else + { + throw SonoException( + "The scenario end index must be greater than or equal to the scenario start index"); } } @@ -492,6 +492,13 @@ void TrxBoard::setAtgcMode(eAtgcMode mode, quint16 value) const this->_dsp->atgcMode(mode, value); } +void TrxBoard::setDtgcLut(QVector& dtgcLut) +{ + _unsignedQntzrVec = Calculation::qntzr(dtgcLut, 0, 12, 8, 0, true, false); + QList dtgcLutQ = _unsignedQntzrVec.toList(); + this->_dsp->dtgcLut(dtgcLutQ); +} + void TrxBoard::setMetaData(const QByteArray metaData) const { QList data; @@ -512,20 +519,6 @@ void TrxBoard::setMetaData(const QByteArray metaData) const this->_sram->setSramMetaData(data); } -void TrxBoard::setDtgcLut(QVector& dtgcLut) -{ - _unsignedQntzrVec = Calculation::qntzr(dtgcLut, 0, 12, 8, 0, true, false); - QList dtgcLutQ = _unsignedQntzrVec.toList(); - this->_dsp->dtgcLut(dtgcLutQ); -} - -void TrxBoard::setAfePwrdnMode(eAfePwrdnMode cmd) const -{ - this->_afeSlave0->setAfeGblPwr(cmd); - this->_afeSlave1->setAfeGblPwr(cmd); - this->_afeSlave2->setAfeGblPwr(cmd); -} - QList TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr) { QList afeRegValue; @@ -577,6 +570,14 @@ void TrxBoard::setAfeConfig(AfeConfig afe) void TrxBoard::slaveFpgaProgram(QString path) { + + scenParamsFilling(clear); + + if(MOUNTED_SLAVE_FPGA <= 0 || MOUNTED_SLAVE_FPGA >= 8) + { + throw SonoException("Wrong mounted slave fpga is selected"); + } + QByteArray bitFileData; QFile bitFile(path); bitFileData.clear(); @@ -594,9 +595,9 @@ void TrxBoard::slaveFpgaProgram(QString path) bitFileData = bitFile.readAll(); bitFile.close(); - this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER); + this->_fpgaProgram->program(bitFileData, MOUNTED_SLAVE_FPGA); + - scenParamsFilling(clear); } void TrxBoard::setBeamFormerMode(eClkMode mode) const @@ -623,6 +624,12 @@ void TrxBoard::scenPlayerStart(void) this->_device.startDma(); + this->_bCtrlMngt->mpsDacsOn(); + + this->_afeSlave0->setAfeGblPwr(afePwrdnDisable); + this->_afeSlave1->setAfeGblPwr(afePwrdnDisable); + this->_afeSlave2->setAfeGblPwr(afePwrdnDisable); + this->_scenPlayer->control.command(true); _run = true; @@ -633,7 +640,6 @@ void TrxBoard::scenPlayerStart(void) { throw SonoException("Total scenario luts and sram parameters are not written compeletely"); } - } void TrxBoard::scenPlayerStop(void) @@ -644,6 +650,10 @@ void TrxBoard::scenPlayerStop(void) this->_scenPlayer->control.command(false); + this->_afeSlave0->setAfeGblPwr(afePwrdnEnable); + this->_afeSlave1->setAfeGblPwr(afePwrdnEnable); + this->_afeSlave2->setAfeGblPwr(afePwrdnEnable); + this->_bCtrlMngt->mpsDacsOff(); } @@ -734,33 +744,32 @@ quint32 TrxBoard::vendorId() const quint32 TrxBoard::trxId() const { - QByteArray id = this->_bCtrlMngt->trxEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); + QByteArray id = this->_bCtrlMngt->trxEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); - return byteArray2UintBigEndian (id); + return byteArray2UintBigEndian (id); } quint32 TrxBoard::mpsId() const { - QByteArray id = this->_bCtrlMngt->mpsEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); + QByteArray id = this->_bCtrlMngt->mpsEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); - return byteArray2UintBigEndian (id); + return byteArray2UintBigEndian (id); } quint32 TrxBoard::prbCtrlId() const { - QByteArray id = - this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); + QByteArray id = this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); - return byteArray2UintBigEndian (id); + return byteArray2UintBigEndian (id); } -quint32 TrxBoard::prbId(quint8 prbSel) const +quint32 TrxBoard::prbId(eSelectProbe prbSel) const { - QByteArray id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN, + QByteArray id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER, - prbSel); + prbSel-1); - return byteArray2UintBigEndian (id); + return byteArray2UintBigEndian (id); } void TrxBoard::getConnectedPrbId(ConnectedPrbId* prbId) const @@ -772,7 +781,7 @@ void TrxBoard::getConnectedPrbId(ConnectedPrbId* prbId) const vec = this->_bCtrlMngt->getConnectedPrb(); - for(quint8 i = 0; i < vec.size(); i++) + for(quint8 i(0); i < vec.size(); i++) { if(vec.at(i)) { @@ -780,53 +789,45 @@ void TrxBoard::getConnectedPrbId(ConnectedPrbId* prbId) const } else { - id.append(nullptr); + id.append(nullptr); + id.append(nullptr); } switch(i) { case 0: - prbId->prbA = byteArray2UintBigEndian (id); + prbId->prbA = byteArray2UintBigEndian (id); break; case 1: - prbId->prbB = byteArray2UintBigEndian (id); + prbId->prbB = byteArray2UintBigEndian (id); break; case 2: - prbId->prbC = byteArray2UintBigEndian (id); + prbId->prbC = byteArray2UintBigEndian (id); break; case 3: - prbId->prbD = byteArray2UintBigEndian (id); + prbId->prbD = byteArray2UintBigEndian (id); break; } + id.clear(); } } -QString TrxBoard::trxInfo() const +QByteArray TrxBoard::trxInfo() const { - QString str = - QString(this->_bCtrlMngt->trxEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER)); - - return str; + return this->_bCtrlMngt->trxEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER); } -QString TrxBoard::mpsInfo() const +QByteArray TrxBoard::mpsInfo() const { - QString str = - QString(this->_bCtrlMngt->mpsEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER)); - - return str; + return this->_bCtrlMngt->mpsEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER); } -QString TrxBoard::prbCtrlInfo() const +QByteArray TrxBoard::prbCtrlInfo() const { - QString str = - QString(this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_INFO_BYTE_BEGIN, - EEPROM_INFO_BYTE_NUMBER)); - - return str; + return this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER); } QByteArray TrxBoard::prbInfo(quint8 prbSel) const @@ -874,6 +875,7 @@ void TrxBoard::getConnectedPrbInfo(ConnectedPrbInfo* prbInfo) const prbInfo->prbD = info; break; } + info.clear(); } } @@ -984,5 +986,7 @@ void TrxBoard::getFpgasCodeVersion(FpgaCodeVersion* version) const void TrxBoard::sramParityClear() { - this->_device.device.writeLong(BAR_SRAM, 0, 0); + quint64 val; + val = this->_device.device.readLong(BAR_SRAM, 0); + this->_device.device.writeLong(BAR_SRAM, 0, val); } diff --git a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp index 3c8ee11..5f8d907 100644 --- a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp +++ b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp @@ -624,6 +624,13 @@ void BoardsCtrlMngt::mpsDacsOff() const getSupervisorI2cDone(); } +void BoardsCtrlMngt::mpsDacsOn() const +{ + getSupervisorI2cTimeout(); + setSetupCmdDacsOnOff(false, true, true); + getSupervisorI2cDone(); +} + void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const { if (hva > hvb && hva <= HVA_MAX_VALUE) @@ -635,10 +642,6 @@ void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const getSupervisorI2cTimeout(); setMpsDacsValue (_mpsDacs); getSupervisorI2cDone(); - - getSupervisorI2cTimeout(); - setSetupCmdDacsOnOff(false, true, true); - getSupervisorI2cDone(); } else throw SonoException("A and B voltage are out of range");