You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3602 lines
124 KiB
3602 lines
124 KiB
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
|
|
QThread* MainWindow::_uiThread;
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
_uiThread = QThread::currentThread();
|
|
|
|
this->setFixedSize(this->width(),this->height());
|
|
|
|
_settings = new QSettings("Hasis", "HwTester");
|
|
|
|
_usd = new UltraSoundDevice();
|
|
|
|
_timeout = new QTimer;
|
|
|
|
_bCtrl = new BoardsCtrlMngt (_usd->device);
|
|
_healStatus = new HealthStatus;
|
|
_supRbValue = new SupervisorRbValue;
|
|
_faultStatus = new MpsFaultStatus;
|
|
_version = new FpgaCodeVersion;
|
|
_vec = new StatusVec;
|
|
_emul = new EmulatorProperties;
|
|
|
|
_colorMap = new QCPColorMap(ui->plot_2->xAxis,ui->plot_2->yAxis);
|
|
|
|
ui->plot_2->setInteractions(QCP::iRangeZoom|QCP::iRangeDrag);
|
|
ui->plot_2->axisRect()->setupFullAxesBox(true);
|
|
ui->plot_2->xAxis->setLabel("Line");
|
|
ui->plot_2->yAxis->setLabel("Point");
|
|
|
|
// ui->prg_adcSim->setVisible(false);
|
|
// ui->prg_scenarioUpload->setVisible(false);
|
|
// ui->prg_txDacUpload->setVisible(false);
|
|
// ui->prg_fpgaProgram->setVisible(false);
|
|
// ui->prg_adcLoggerFileWr->setVisible(false);
|
|
|
|
// ui->tb_scenarioFile->setReadOnly(true);
|
|
// ui->tb_paramFile->setReadOnly(true);
|
|
// ui->tb_txDacFile->setReadOnly(true);
|
|
ui->tb_fpgaBit->setReadOnly(true);
|
|
|
|
// ui->tb_scenarioFile->setText(_settings->value(SCENARIO_FILE_PATH).value<QString>());
|
|
// ui->tb_paramFile->setText(_settings->value(PARAM_FILE_PATH).value<QString>());
|
|
// ui->tb_txDacFile->setText(_settings->value(TX_DAC_FILE_PATH).value<QString>());
|
|
ui->rbtn_reg->setChecked(_settings->value(REG_ACCESS_SEL).value<bool>());
|
|
ui->rbtn_offset->setChecked(!_settings->value(REG_ACCESS_SEL).value<bool>());
|
|
ui->tb_fpgaBit->setText(_settings->value(FPGA_FILE_PATH).value<QString>());
|
|
ui->tb_h5File->setText(_settings->value(SCENARIO_FILE_PATH).value<QString>());
|
|
|
|
// connect(this, &MainWindow::updateBlockProgressValue, this, &MainWindow::newBlockProgressValue);
|
|
// connect(this, &MainWindow::updateFpgaProgressValue, this, &MainWindow::newFpgaProgressValue);
|
|
// connect(this, &MainWindow::updateBlockProgressVisibility, this, &MainWindow::newBlockProgressVisibility);
|
|
// connect(this, &MainWindow::updateFpgaProgressVisibility, this, &MainWindow::newFpgaProgressVisibility);
|
|
|
|
//connect(this, &MainWindow::updateAdcLoggerProgressValue, this, &MainWindow::newAdcLoggerProgressValue);
|
|
//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<void>::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_hvRegulatorConfig->setText(ENABLE);
|
|
ui->btn_pm5RegulatorConfig->setText(ENABLE);
|
|
ui->btn_updateRdbackValue->setText(UPDATE);
|
|
ui->l_detectedProbe->setText("None");
|
|
ui->btn_dmaLogLast->setHidden(true);
|
|
|
|
// uint32_t offsetdbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4};
|
|
// auto value = 0;
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = (_usd->readWord(offsetdbgCmd[i], 0)) & 0xC;
|
|
// if(value != 0)
|
|
// break;
|
|
// }
|
|
// if(value != 0)
|
|
// ui->ch_testMode->setCheckState(Qt::CheckState::Checked);
|
|
|
|
_dmaLog = false;
|
|
_dmaRun = false;
|
|
_dmaShow = false;
|
|
|
|
setAfeConfig();
|
|
|
|
try
|
|
{
|
|
_trx.init();
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
_timeout->start(1000);
|
|
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
|
|
delete _settings;
|
|
|
|
delete _usd;
|
|
|
|
delete _timeout;
|
|
|
|
delete _healStatus;
|
|
|
|
delete _bCtrl;
|
|
|
|
delete _supRbValue;
|
|
|
|
delete _faultStatus;
|
|
|
|
delete _version;
|
|
|
|
delete _vec;
|
|
|
|
delete _emul;
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::binFileUploader(quint32 bar, quint32 offset, QString path, QProgressBar* prg)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if (!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open binary file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// const auto actualSize = file.size();
|
|
// auto readSize = 0;
|
|
// while(readSize < actualSize)
|
|
// {
|
|
// QByteArray chunk = file.read(8);
|
|
// auto value = byteArrayTo64LittleEndian(chunk);
|
|
// try
|
|
// {
|
|
// _usd->writeLong(offset + readSize, bar, value);
|
|
// auto rdValue = _usd->readLong(offset + readSize, bar);
|
|
// if (value != rdValue)
|
|
// {
|
|
// MESSAGE_BOX("Binary File Write Error");
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
|
|
// } catch (myexception e)
|
|
// {
|
|
// MESSAGE_BOX(e.what());
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// readSize += 8;
|
|
|
|
// auto percentage = (readSize * 100 / actualSize);
|
|
// emit updateBlockProgressValue(percentage, prg);
|
|
// }
|
|
|
|
// //MESSAGE_BOX("Binary file upload finished with success");
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::binAdcFileUploader(quint32 bar, QString path, QProgressBar* prg)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if (!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open binary file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// const auto actualSize = file.size();
|
|
// qint64 readSize = 0;
|
|
// quint32 addr = 0;
|
|
// quint32 data = 0;
|
|
// auto syncNum = 0;
|
|
// while((readSize < actualSize) & !_csvReadStopFlag)
|
|
// {
|
|
// QByteArray chunk = file.read(8);
|
|
// auto value = byteArrayTo64LittleEndian(chunk);
|
|
// try
|
|
// {
|
|
// addr = static_cast<quint32>(value >> 32);
|
|
// data = static_cast<quint32>(value & 0xFFFFFFFF);
|
|
|
|
// _usd->writeWord(addr, bar, data);
|
|
// if (addr != 3076)
|
|
// {
|
|
// qDebug() << syncNum << "==> " << addr << "::" << data;
|
|
// syncNum +=1;
|
|
|
|
// }
|
|
|
|
|
|
// } catch (myexception e)
|
|
// {
|
|
// MESSAGE_BOX(e.what());
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// readSize += 8;
|
|
// auto percentage = (readSize * 100 / actualSize);
|
|
// emit updateBlockProgressValue(percentage, prg);
|
|
// }
|
|
|
|
// //MESSAGE_BOX("Binary file upload finished with success");
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
//}
|
|
///*************************************************************************************************/
|
|
//void MainWindow::CsvFileUploader(quint32 bar, QString path, QProgressBar* prg)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if(!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open param file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// QString line;
|
|
// auto size = file.size();
|
|
// qint64 readSize = 0;
|
|
// while((readSize < size) & !_csvReadStopFlag)
|
|
// {
|
|
// line = file.readLine();
|
|
// auto sl = line.split(',');
|
|
// auto address = sl[0].toUInt(Q_NULLPTR, 16);
|
|
// auto value = sl[1].toUInt(Q_NULLPTR, 16);
|
|
// _usd->writeWord(address, bar, value);
|
|
// //qDebug() << _usd->readWord(address, bar);
|
|
// readSize += static_cast<qint64>(line.length());
|
|
// emit updateBlockProgressValue((readSize * 100 / size), prg);
|
|
// //delay(1);
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
//}
|
|
///*************************************************************************************************/
|
|
//void MainWindow::CsvFileChecker(quint32 bar, QString pathBase, QString pathTarget, QProgressBar* prg)
|
|
//{
|
|
// QFile baseFile(pathBase);
|
|
// QFile tragetFile(pathTarget);
|
|
|
|
// if(!baseFile.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open param file, aborting operation");
|
|
// return;
|
|
// }
|
|
// tragetFile.open(QFile::WriteOnly);
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// QString line;
|
|
// auto size = baseFile.size();
|
|
// qint64 readSize = 0;
|
|
// while(readSize < size)
|
|
// {
|
|
// line = baseFile.readLine();
|
|
// auto sl = line.split(',');
|
|
// auto address = sl[0].toUInt(Q_NULLPTR, 16);
|
|
// auto baseValue = sl[1].toUInt(Q_NULLPTR, 16);
|
|
// auto boardValue = _usd->readWord(address, bar);
|
|
// auto res = "NOK";
|
|
// if (boardValue == baseValue)
|
|
// {
|
|
// res = "OK";
|
|
// }
|
|
// auto str = QStringLiteral("%1,%2,%3,%4").arg(address, 8, 16, QLatin1Char('0')).arg(baseValue, 8, 16, QLatin1Char('0'))
|
|
// .arg(boardValue, 8, 16, QLatin1Char('0')).arg(res);
|
|
// tragetFile.write(str.toStdString().c_str(), str.length());
|
|
// tragetFile.write("\r\n", 2);
|
|
|
|
// readSize += static_cast<qint64>(line.length());
|
|
// emit updateBlockProgressValue((readSize * 100 / size), prg);
|
|
// //delay(1);
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// baseFile.close();
|
|
|
|
// tragetFile.close();
|
|
|
|
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//#define NO_AFE_CHANNEL 192
|
|
//#define NO_LOGGER_SMPL_COUNT 2048
|
|
//void MainWindow::AdcLogCsvFileWriter(QString folderPath, QProgressBar* prg)
|
|
//{
|
|
// quint32 bar = 0;
|
|
// quint32 offset = 0x2000;
|
|
// uint32_t offsetDbgTrsfr[3] = {0x140002*4,0x240002*4,0x340002*4};
|
|
// uint32_t offsetDbgTrsfrDone[3] = {0x14000A*4,0x24000A*4,0x34000A*4};
|
|
// _adcLoggerTrnsDone = false;
|
|
|
|
// QTime t = QTime::currentTime();
|
|
// QString path = folderPath + "/adcLog_" + QString("%1_%2_%3.csv").arg(t.hour()).arg(t.minute()).arg(t.second());
|
|
// QFile file(path);
|
|
// file.open(QIODevice::WriteOnly);
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// auto timeOut = 0;
|
|
// quint32 doneFlag = 0;
|
|
// quint32 value = 0;
|
|
// quint32 fpgaNum = 0;
|
|
|
|
// offset = 0x4 * 4;
|
|
// auto gtSndMd = _usd->readWord(offset, bar);
|
|
// qDebug() << "--- SET GT Send Mode :: ADC Raw Logger --- ";
|
|
// _usd->writeWord(offset, bar, 0x2); // set GT Send mode (ADC Raw Logger)
|
|
|
|
// for (auto j = 0; j < 3; j+=1)
|
|
// _usd->writeWord(offsetDbgTrsfr[j], bar,0x0);
|
|
|
|
// for (quint16 i = 0; i < NO_AFE_CHANNEL; i += 1)
|
|
// {
|
|
// fpgaNum = (i / 64);
|
|
|
|
// offset = 0x400*4;// set adc logger stop
|
|
// value = (fpgaNum << 1);
|
|
// _usd->writeWord(offset, bar,value);
|
|
|
|
// value = value | 0x01;// set adc logger fpgaSel and start
|
|
// _usd->writeWord(offset, bar,value);
|
|
|
|
// _usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,0x0);
|
|
// value = i % 64;
|
|
// value = static_cast<quint32>(((static_cast<quint32>(0X01))) | ((static_cast<quint32>(value & 0xFF)) << 8));
|
|
// _usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,value);
|
|
|
|
// timeOut = 0;
|
|
// doneFlag = 0;
|
|
// while (timeOut < 10 && doneFlag == 0 )
|
|
// {
|
|
// doneFlag = ((_usd->readWord(offsetDbgTrsfrDone[fpgaNum], bar)) & 0x100) >> 8; // wait Until transfer done
|
|
// timeOut += 1;
|
|
// delay(2);
|
|
// }
|
|
// if(timeOut == 10)
|
|
// {
|
|
// qDebug() << "Unable to transfer done";
|
|
// //MESSAGE_BOX("Unable to transfer done");
|
|
// //return;
|
|
// }
|
|
|
|
// doneFlag = 0;
|
|
// timeOut = 0;
|
|
// offset = 0x401*4;
|
|
// while (timeOut < 10 && doneFlag == 0 )
|
|
// {
|
|
// doneFlag = (_usd->readWord(offset, bar) & 0x1); // wait until adc logger MemDone Flag true
|
|
// timeOut += 1;
|
|
// delay(2);
|
|
// }
|
|
// if(timeOut == 10)
|
|
// {
|
|
// //MESSAGE_BOX("Unable to reach adc logger memory done");
|
|
// qDebug() << "Unable to reach adc logger memory done :: 0x" << _usd->readWord(offset, bar);
|
|
// //return;
|
|
// }
|
|
|
|
// _usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,0); // Stop Debug transfer
|
|
|
|
// offset = 0x2000;
|
|
// qint16 val = 0;
|
|
// for(auto j = 0; j < NO_LOGGER_SMPL_COUNT; j += 1)
|
|
// {
|
|
// value = _usd->readWord(offset, bar); // Read Adc logger Bram
|
|
|
|
// val = static_cast<qint16>(value & 0x3FFF) << 2;
|
|
// val = val >> 2;
|
|
// auto str = QStringLiteral("%1,").arg(val);
|
|
// file.write(str.toStdString().c_str(), str.length());
|
|
|
|
// offset += 4;
|
|
// }
|
|
// file.write("\r\n", 2);
|
|
|
|
// value = (fpgaNum << 1) | 0x00;// set adc logger fpgaSel and Stop
|
|
// offset = 0x400*4;
|
|
// _usd->writeWord(offset, bar,value);
|
|
|
|
// emit updateBlockProgressValue(i * 100 / NO_AFE_CHANNEL, prg);
|
|
// delay(10);
|
|
|
|
// }
|
|
// offset = 0x400*4;
|
|
// _usd->writeWord(offset, bar,0x0);
|
|
|
|
// qDebug() << "--- SET GT Send Mode :: Previous Mode --- ";
|
|
// offset = 0x4 * 4;
|
|
// _usd->writeWord(offset, bar, gtSndMd); // set GT Send mode
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
// _adcLoggerTrnsDone = true;
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::scenarioFileVerifier(quint32 bar, quint32 offset, QString path)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if (!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open binary file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, ui->prg_scenarioUpload);
|
|
// emit updateBlockProgressValue(0, ui->prg_scenarioUpload);
|
|
|
|
// const auto actualSize = file.size();
|
|
// auto readSize = 0;
|
|
// while(readSize < actualSize)
|
|
// {
|
|
// QByteArray chunk = file.read(8);
|
|
// auto value = byteArrayTo64LittleEndian(chunk);
|
|
// try
|
|
// {
|
|
// auto data = _usd->readLong(offset + readSize, bar);
|
|
// if(data != value)
|
|
// {
|
|
// auto message = QString("Error in data @ offset 0x%1, expected 0x%2 saw 0x%3")
|
|
// .arg(QString::number(offset + readSize))
|
|
// .arg(QString::number(value, 16))
|
|
// .arg(QString::number(data, 16));
|
|
// MESSAGE_BOX(message);
|
|
|
|
// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// }
|
|
// catch (myexception e)
|
|
// {
|
|
// MESSAGE_BOX(e.what());
|
|
|
|
// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// readSize += 8;
|
|
|
|
// auto percentage = (readSize * 100 / actualSize);
|
|
// emit updateBlockProgressValue(percentage, ui->prg_scenarioUpload);
|
|
// }
|
|
|
|
// MESSAGE_BOX("Binary verified with success");
|
|
|
|
// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload);
|
|
|
|
// file.close();
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::fpgaProgrammer(QString path)
|
|
{
|
|
try
|
|
{
|
|
_trx.slaveFpgaProgram(path);
|
|
ui->l_programDone->setText("done");
|
|
changeLabelTextColor(ui->l_programDone, Qt::green);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//quint64 MainWindow::byteArrayTo64LittleEndian(QByteArray data)
|
|
//{
|
|
// quint64 temp = 0;
|
|
|
|
// temp = ((static_cast<quint64>(data[0])) & 0x00000000000000FF) |
|
|
// (((static_cast<quint64>(data[1])) << 8) & 0x000000000000FF00) |
|
|
// (((static_cast<quint64>(data[2])) << 16) & 0x0000000000FF0000) |
|
|
// (((static_cast<quint64>(data[3])) << 24) & 0x00000000FF000000) |
|
|
// (((static_cast<quint64>(data[4])) << 32) & 0x000000FF00000000) |
|
|
// (((static_cast<quint64>(data[5])) << 40) & 0x0000FF0000000000) |
|
|
// (((static_cast<quint64>(data[6])) << 48) & 0x00FF000000000000) |
|
|
// (((static_cast<quint64>(data[7])) << 56) & 0xFF00000000000000);
|
|
|
|
// return temp;
|
|
//}
|
|
/*************************************************************************************************/
|
|
//quint32 MainWindow::byteArrayTo32LittleEndian(QByteArray data)
|
|
//{
|
|
// quint32 temp = 0;
|
|
|
|
// temp = ((static_cast<quint32>(data[0])) & 0x000000FF) |
|
|
// (((static_cast<quint32>(data[1])) << 8) & 0x0000FF00) |
|
|
// (((static_cast<quint32>(data[2])) << 16) & 0x00FF0000) |
|
|
// (((static_cast<quint32>(data[3])) << 24) & 0xFF000000) ;
|
|
|
|
// return temp;
|
|
//}
|
|
///*************************************************************************************************/
|
|
//quint32 MainWindow::byteArrayTo32BigEndian(QByteArray data)
|
|
//{
|
|
// quint32 temp = 0;
|
|
|
|
// temp = (data[3] & 0x000000FF) |
|
|
// ((data[2] << 8) & 0x0000FF00) |
|
|
// ((data[1] << 16) & 0x00FF0000) |
|
|
// ((data[0] << 24) & 0xFF000000);
|
|
|
|
// return temp;
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::timeout()
|
|
{
|
|
auto pcie_pid = _trx.deviceId();
|
|
auto pcie_vid = _trx.vendorId();
|
|
auto pcie_id = (pcie_pid << 16)|pcie_vid;
|
|
ui->l_PCIeID->setText(QString::number(pcie_id, 16));
|
|
delay(10);
|
|
|
|
_trx.getHealthStatus(_healStatus);
|
|
delay(10);
|
|
/******************* System Monitoring *********************/
|
|
|
|
float tempSensor = _healStatus->systemTemperature;
|
|
ui->l_Temp->setText(QString("%1").arg(static_cast<double>(tempSensor)));
|
|
delay(10);
|
|
|
|
auto adcCh1 = _healStatus->adcMon->mon12Vin;
|
|
ui->l_adcCh1->setText(QString("%1").arg(static_cast<double>(adcCh1)));
|
|
delay(10);
|
|
|
|
auto adcCh2 = _healStatus->adcMon->mon5Vin;
|
|
ui->l_adcCh2->setText(QString("%1").arg(static_cast<double>(adcCh2)));
|
|
delay(10);
|
|
|
|
auto adcCh3 = _healStatus->adcMon->prbZeroEncoder;
|
|
ui->l_adcCh3->setText(QString("%1").arg(static_cast<double>(adcCh3)));
|
|
delay(10);
|
|
|
|
auto adcCh4 = _healStatus->adcMon->prbCtrl3P3V;
|
|
ui->l_adcCh4->setText(QString("%1").arg(static_cast<double>(adcCh4)));
|
|
delay(10);
|
|
|
|
auto adcCh5 = _healStatus->adcMon->afeVcntlp;
|
|
ui->l_adcCh5->setText(QString("%1").arg(static_cast<double>(adcCh5)));
|
|
delay(10);
|
|
|
|
auto adcCh6 = _healStatus->adcMon->mon3P3V;
|
|
ui->l_adcCh6->setText(QString("%1").arg(static_cast<double>(adcCh6)));
|
|
delay(10);
|
|
|
|
auto adcCh7 = _healStatus->adcMon->monAfeA1P8V;
|
|
ui->l_adcCh7->setText(QString("%1").arg(static_cast<double>(adcCh7)));
|
|
delay(10);
|
|
|
|
auto adcCh8 = _healStatus->adcMon->monAfeD1P8V;
|
|
ui->l_adcCh8->setText(QString("%1").arg(static_cast<double>(adcCh8)));
|
|
delay(10);
|
|
|
|
/******************* Power Good *********************/
|
|
|
|
auto regAPg = _healStatus->voltsPg->regulatorA;
|
|
ui->l_pgRegA->setText(enum2String(regAPg));
|
|
delay(10);
|
|
|
|
auto regBPg = _healStatus->voltsPg->regulatorB;
|
|
ui->l_pgRegB->setText(enum2String(regBPg));
|
|
delay(10);
|
|
|
|
auto pg12v = _healStatus->voltsPg->mon12Vin;
|
|
ui->l_pg12Vin->setText(enum2String(pg12v));
|
|
delay(10);
|
|
|
|
auto pg5v = _healStatus->voltsPg->mon5Vin;
|
|
ui->l_pg5Vin->setText(enum2String(pg5v));
|
|
delay(10);
|
|
|
|
auto Pg3P3 = _healStatus->voltsPg->mon3P3V;
|
|
ui->l_pg3P3->setText(enum2String(Pg3P3));
|
|
delay(10);
|
|
|
|
auto pgAvdd = _healStatus->voltsPg->monAfeA1P8V;
|
|
ui->l_pg1P8Avdd->setText(enum2String(pgAvdd));
|
|
delay(10);
|
|
|
|
auto pgDvdd = _healStatus->voltsPg->monAfeD1P8V;
|
|
ui->l_pg1P8Dvdd->setText(enum2String(pgDvdd));
|
|
delay(10);
|
|
|
|
auto pgPrbCtrl = _healStatus->voltsPg->prbCtrl3P3V;
|
|
ui->l_pgPrbCtrl3P3->setText(enum2String(pgPrbCtrl));
|
|
delay(10);
|
|
|
|
/******************* Status Vector *********************/
|
|
_trx.getTrxStatus(_vec);
|
|
delay(10);
|
|
|
|
bool pgErr=_vec->pgErr;
|
|
ui->l_pg->setText(QVariant(pgErr).toString());
|
|
auto color = pgErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_pg, color);
|
|
delay(10);
|
|
|
|
bool mpsErr=_vec->mpsErr;
|
|
ui->l_mps->setText(QVariant(mpsErr).toString());
|
|
color = mpsErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_mps, color);
|
|
delay(10);
|
|
|
|
bool fanFault=_vec->fanFault;
|
|
ui->l_fan->setText(QVariant(fanFault).toString());
|
|
color = fanFault ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_fan, color);
|
|
delay(10);
|
|
|
|
bool pulserThd=_vec->pulserThd;
|
|
ui->l_pulserThd->setText(QVariant(pulserThd).toString());
|
|
color = pulserThd ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_pulserThd, color);
|
|
delay(10);
|
|
|
|
bool scenGtErr=_vec->scenGtErr;
|
|
ui->l_scenGt->setText(QVariant(scenGtErr).toString());
|
|
color = scenGtErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_scenGt, color);
|
|
delay(10);
|
|
|
|
bool scenPriErr=_vec->scenPriErr;
|
|
ui->l_scenPri->setText(QVariant(scenPriErr).toString());
|
|
color = scenPriErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_scenPri, color);
|
|
delay(10);
|
|
|
|
bool thermalErr=_vec->thermalErr;
|
|
ui->l_thermal->setText(QVariant(thermalErr).toString());
|
|
color = thermalErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_thermal, color);
|
|
delay(10);
|
|
|
|
bool scenSramErr=_vec->scenSramErr;
|
|
ui->l_scenSram->setText(QVariant(scenSramErr).toString());
|
|
color = scenSramErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_scenSram, color);
|
|
delay(10);
|
|
|
|
bool syncFifoErr=_vec->syncFifoErr;
|
|
ui->l_syncFifo->setText(QVariant(syncFifoErr).toString());
|
|
color = syncFifoErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_syncFifo, color);
|
|
delay(10);
|
|
|
|
bool syncPointErr=_vec->syncPointErr;
|
|
ui->l_syncPoint->setText(QVariant(syncPointErr).toString());
|
|
color = syncPointErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_syncPoint, color);
|
|
delay(10);
|
|
|
|
bool dintrlvFifoErr=_vec->dintrlvFifoErr;
|
|
ui->l_dintrlvFifo->setText(QVariant(dintrlvFifoErr).toString());
|
|
color = dintrlvFifoErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_dintrlvFifo, color);
|
|
delay(10);
|
|
|
|
bool dintrlvPointErr=_vec->dintrlvPointErr;
|
|
ui->l_dintrlvPoint->setText(QVariant(dintrlvPointErr).toString());
|
|
color = dintrlvPointErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_dintrlvPoint, color);
|
|
delay(10);
|
|
|
|
bool sram1ParityErr=_vec->sram1ParityErr;
|
|
ui->l_sram1Parity->setText(QVariant(sram1ParityErr).toString());
|
|
color = sram1ParityErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_sram1Parity, color);
|
|
delay(10);
|
|
|
|
bool sram2ParityErr=_vec->sram2ParityErr;
|
|
ui->l_sram2Parity->setText(QVariant(sram2ParityErr).toString());
|
|
color = sram2ParityErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_sram2Parity, color);
|
|
delay(10);
|
|
|
|
bool dmaCtrlTransferErr=_vec->dmaCtrlTransferErr;
|
|
ui->l_DmaCtrlTrans->setText(QVariant(dmaCtrlTransferErr).toString());
|
|
color = dmaCtrlTransferErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_DmaCtrlTrans, color);
|
|
delay(10);
|
|
|
|
bool emulDmaTransferErr=_vec->emulDmaTransferErr;
|
|
ui->l_emulDmaTrans->setText(QVariant(emulDmaTransferErr).toString());
|
|
color = emulDmaTransferErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_emulDmaTrans, color);
|
|
delay(10);
|
|
|
|
bool probeDisconnectErr=_vec->probeDisconnectErr;
|
|
ui->l_prbDiscon->setText(QVariant(probeDisconnectErr).toString());
|
|
color = probeDisconnectErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_prbDiscon, color);
|
|
delay(10);
|
|
|
|
bool probeDetChanInterrupt=_vec->probeDetChanInterrupt;
|
|
ui->l_prbDetChg->setText(QVariant(probeDetChanInterrupt).toString());
|
|
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");
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::scenarioStart()
|
|
//{
|
|
// auto value = 0x1;
|
|
// _usd->writeWord(0x800, 0, value);
|
|
|
|
// qDebug() << "--- SET GT Send Mode :: BF --- ";
|
|
// _usd->writeWord(0x10, 0, 0x1);
|
|
|
|
// auto bar = 0;
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// uint32_t offsetDbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4};
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value | 0x2);
|
|
// }
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetDbgCmd[i], 0);
|
|
// value &= 0xFFFFFFF0;
|
|
// _usd->writeWord(offsetDbgCmd[i], 0, value);
|
|
// }
|
|
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::scenarioStop()
|
|
//{
|
|
// auto value = 0x0;
|
|
// _usd->writeWord(0x800, 0, value);
|
|
|
|
// auto bar = 0;
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// delay(10);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value & 0x1);
|
|
// }
|
|
//}
|
|
|
|
//bool MainWindow::checkTermalShutdown(quint8 value)
|
|
//{
|
|
// return value == 0x0F;
|
|
//}
|
|
|
|
void MainWindow::changeLabelTextColor(QLabel *label, QColor color)
|
|
{
|
|
auto palette = label->palette();
|
|
palette.setColor(QPalette::Foreground, color);
|
|
label->setAutoFillBackground(true);
|
|
label->setPalette(palette);
|
|
label->update();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_rbtn_reg_toggled(bool checked)
|
|
{
|
|
if(checked)
|
|
{
|
|
_settings->setValue(REG_ACCESS_SEL, true);
|
|
|
|
|
|
|
|
ui->l_regIndicator->setText("Register number: (Hex)");
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_rbtn_offset_toggled(bool checked)
|
|
{
|
|
if(checked)
|
|
{
|
|
_settings->setValue(REG_ACCESS_SEL, false);
|
|
ui->l_regIndicator->setText("Register offset: (Hex)");
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_readReg_clicked()
|
|
{
|
|
auto bar = ui->cb_regBarNum->currentText().toUInt();
|
|
|
|
auto offset = ui->tb_regIndicator->text().toUInt(Q_NULLPTR, 16);
|
|
if(offset == 0 && ui->tb_regIndicator->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for offset");
|
|
return;
|
|
}
|
|
|
|
quint64 value = 0;
|
|
auto width = ui->cb_regWidth->currentIndex();
|
|
switch(width)
|
|
{
|
|
case 0:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 4;
|
|
value = _usd->readWord(offset, bar);
|
|
ui->lcd_regvalue->setDigitCount(8);
|
|
break;
|
|
case 1:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 8;
|
|
value = _usd->readLong(offset, bar);
|
|
ui->lcd_regvalue->setDigitCount(16);
|
|
break;
|
|
}
|
|
|
|
ui->lcd_regvalue->display(QString::number(value, 16));
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_writeReg_clicked()
|
|
{
|
|
auto bar = ui->cb_regBarNum->currentText().toUInt();
|
|
|
|
auto offset = ui->tb_regIndicator->text().toUInt(Q_NULLPTR, 16);
|
|
if(offset == 0 && ui->tb_regIndicator->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for offset");
|
|
return;
|
|
}
|
|
|
|
auto value = ui->tb_regValue->text().toULong(Q_NULLPTR, 16);
|
|
if(value == 0 && ui->tb_regValue->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for write value");
|
|
return;
|
|
}
|
|
|
|
auto width = ui->cb_regWidth->currentIndex();
|
|
switch(width)
|
|
{
|
|
case 0:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 4;
|
|
_usd->writeWord(offset, bar, static_cast<quint32>(value));
|
|
break;
|
|
case 1:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 8;
|
|
_usd->writeLong(offset, bar, value);
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::newBlockProgressValue(int percentage, QProgressBar* prg)
|
|
//{
|
|
// prg->setValue(percentage);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::newFpgaProgressValue(int percentage)
|
|
//{
|
|
// ui->prg_fpgaProgram->setValue(percentage);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::newBlockProgressVisibility(bool show, QProgressBar* prg)
|
|
//{
|
|
// prg->setVisible(show);
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_fpgaBrowse_clicked()
|
|
{
|
|
QFileDialog fileDialog;
|
|
fileDialog.setNameFilters({"FPGA program file (*.bit)"});
|
|
auto result = fileDialog.exec();
|
|
|
|
if(result)
|
|
{
|
|
auto selectedPath = fileDialog.selectedFiles()[0];
|
|
ui->tb_fpgaBit->setText(selectedPath);
|
|
_settings->setValue(FPGA_FILE_PATH, selectedPath);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_fpgaProgram_clicked()
|
|
{
|
|
ui->l_programDone->setText("doing");
|
|
changeLabelTextColor(ui->l_programDone, Qt::red);
|
|
|
|
auto path = ui->tb_fpgaBit->text();
|
|
|
|
QtConcurrent::run(this, &MainWindow::fpgaProgrammer, path);
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::newMessage(QString message)
|
|
{
|
|
QMessageBox msgBox;
|
|
msgBox.setText(message);
|
|
msgBox.exec();
|
|
}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"SRAM binary file (*.bin)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_scenarioFile->setText(selectedPath);
|
|
// _settings->setValue(SCENARIO_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioVerify_clicked()
|
|
//{
|
|
// auto bar = 1;
|
|
|
|
// auto offset = 0;
|
|
|
|
// auto path = ui->tb_scenarioFile->text();
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::scenarioFileVerifier, bar, offset, path);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_ParamBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"Scenario param file (*.csv)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_paramFile->setText(selectedPath);
|
|
// _settings->setValue(PARAM_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioUpload_clicked()
|
|
//{
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// auto bar = 0;
|
|
|
|
// auto scenarioBar = 1;
|
|
// auto paramBar = 0;
|
|
|
|
// auto scenarioOffset = 0;
|
|
|
|
// auto scenarioPath = ui->tb_scenarioFile->text();
|
|
// auto paramPath = ui->tb_paramFile->text();
|
|
|
|
// scenarioStop();
|
|
|
|
// qDebug() << "--- Clear Scen Register Valid Register --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, 0X0);
|
|
// }
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::binFileUploader, scenarioBar, scenarioOffset, scenarioPath, ui->prg_scenarioUpload);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
|
|
// _csvReadStopFlag = false;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// future = QtConcurrent::run(this, &MainWindow::CsvFileUploader, paramBar, paramPath, ui->prg_scenarioUpload);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
|
|
|
|
|
|
// qDebug() << "--- SET Scen Register Valid Register --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, 0X1);
|
|
// }
|
|
|
|
// qDebug() << "--- SET GT Send Mode :: BF --- ";
|
|
// _usd->writeWord(0x4*4, bar, 0X1);
|
|
// delay(20);
|
|
|
|
|
|
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_txDacBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"TxDAC file (*.csv)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_txDacFile->setText(selectedPath);
|
|
// _settings->setValue(TX_DAC_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_txDacUpload_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
|
|
// auto offset = 0xE000;
|
|
|
|
// auto path = ui->tb_txDacFile->text();
|
|
// _csvReadStopFlag = false;
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::CsvFileUploader, bar, path, ui->prg_txDacUpload);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_txDacStartStop_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x10000;
|
|
|
|
// auto interval = ui->tb_txDacInterval->text().toUInt(Q_NULLPTR, 16);
|
|
// if(interval == 0 && ui->tb_txDacInterval->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for interval");
|
|
// return;
|
|
// }
|
|
// uint32_t value = 0;
|
|
// value = ((interval & 0x000000FF) << 8) ;
|
|
// auto str = ui->btn_txDacStartStop->text();
|
|
// if(str == START)
|
|
// {
|
|
// _usd->writeWord(offset, bar, value | 0x1);
|
|
// ui->btn_txDacStartStop->setText(STOP);
|
|
// }
|
|
// else
|
|
// {
|
|
// _usd->writeWord(offset, bar, value);
|
|
// ui->btn_txDacStartStop->setText(START);
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_txDacOnOff_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x10004;
|
|
|
|
// auto str = ui->btn_txDacOnOff->text();
|
|
// if(str == ON)
|
|
// {
|
|
// auto value = 0xf;
|
|
// _usd->writeWord(offset, bar, value);
|
|
// ui->btn_txDacOnOff->setText(OFF);
|
|
// }
|
|
// else
|
|
// {
|
|
// auto value = 0x0;
|
|
// _usd->writeWord(offset, bar, value);
|
|
// ui->btn_txDacOnOff->setText(ON);
|
|
// }
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index)
|
|
{
|
|
auto indx = index;
|
|
|
|
if(indx == 0)
|
|
_trx.selectProbe(prbA);
|
|
|
|
else if(indx == 1)
|
|
_trx.selectProbe(prbB);
|
|
|
|
else if(indx == 2)
|
|
_trx.selectProbe(prbC);
|
|
|
|
else
|
|
_trx.selectProbe(prbD);
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*void MainWindow::on_btn_pllClkSt_clicked()
|
|
{
|
|
|
|
auto bar = 0;
|
|
auto offset = 0x26000;
|
|
|
|
auto str = ui->btn_pllClkSt->text();
|
|
if(str == ON)
|
|
{
|
|
auto temp = ui->tb_pllClkSt->text().toUInt(Q_NULLPTR, 10);
|
|
if(temp == 0 && ui->tb_pllClkSt->text() != "0" || temp < 400 || temp > 2000)
|
|
{
|
|
MESSAGE_BOX("Invalid input format for PLL CLK ST");
|
|
return;
|
|
}
|
|
|
|
float halfPeriod = 50000.0f / temp;
|
|
uint roundHalfPeriod = uint(roundf(halfPeriod)) & 0xFF;
|
|
float t = roundf(50000.0f / roundHalfPeriod);
|
|
ui->tb_pllClkSt->setText(QString::number(t, 'f', 0));
|
|
|
|
|
|
auto value = 0;
|
|
value = roundHalfPeriod | 0x00000300;
|
|
_usd->writeWord(offset, bar, value );
|
|
value = value & 0x000002FF;
|
|
_usd->writeWord(offset, bar, value );
|
|
|
|
ui->btn_pllClkSt->setText(OFF);
|
|
}
|
|
else
|
|
{
|
|
auto value = 0;
|
|
_usd->writeWord(offset, bar, value);
|
|
ui->btn_pllClkSt->setText(ON);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//void MainWindow::on_btn_pllClkTps_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x26004;
|
|
|
|
// auto str = ui->btn_pllClkTps->text();
|
|
// if(str == ON)
|
|
// {
|
|
// auto temp = ui->tb_pllClkTps->text().toUInt(Q_NULLPTR, 10);
|
|
// if(temp == 0 && ui->tb_pllClkTps->text() != "0" || temp < 400 || temp > 2000)
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for PLL CLK TPS");
|
|
// return;
|
|
// }
|
|
|
|
// float halfPeriod = 50000.0f / temp;
|
|
// uint roundHalfPeriod = uint(roundf(halfPeriod)) & 0xFF;
|
|
// float t = roundf(50000.0f / roundHalfPeriod);
|
|
// ui->tb_pllClkTps->setText(QString::number(t, 'f', 0));
|
|
|
|
// auto value =0;
|
|
// value = roundHalfPeriod | 0x00000300;
|
|
// _usd->writeWord(offset, bar, value );
|
|
// value = value & 0x000002FF;
|
|
// _usd->writeWord(offset, bar, value );
|
|
|
|
// ui->btn_pllClkTps->setText(OFF);
|
|
// }
|
|
// else
|
|
// {
|
|
// auto value = 0;
|
|
// _usd->writeWord(offset, bar, value);
|
|
// ui->btn_pllClkTps->setText(ON);
|
|
// }
|
|
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_mulDacTrig_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x86018;
|
|
|
|
// // auto str = ui->btn_mulDacTrig->text();
|
|
// //if(str == TRIG_ON)
|
|
// //{
|
|
// auto temp = ui->tb_mlDac->text().toUInt(Q_NULLPTR, 16);
|
|
// _usd->writeWord(offset, bar, temp );
|
|
// if (ui->chk_usrMulDac->isChecked())
|
|
// {
|
|
// _usd->writeWord(offset, bar, temp|0x3000 );
|
|
// _usd->writeWord(offset, bar, temp|0x2000 );
|
|
// }
|
|
|
|
//// ui->btn_mulDacTrig->setText(TRIG_OFF);
|
|
// //}
|
|
// //else
|
|
// //{
|
|
// // auto value = 0;
|
|
// //_usd->writeWord(offset, bar, value);
|
|
// // ui->btn_mulDacTrig->setText(TRIG_ON);
|
|
// //}
|
|
//}
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_thsdStateUpdate_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x43C37C;
|
|
|
|
// auto thsd_f1_temp = _usd->readWord(offset, bar);
|
|
// auto thsd_f1 = thsd_f1_temp & 0x0000000F;
|
|
// auto color = checkTermalShutdown(thsd_f1) ? Qt::green : Qt::red;
|
|
// changeLabelTextColor(ui->l_thermalShutdownFpga1, color);
|
|
// ui->l_thermalShutdownFpga1->setText(QString::number(thsd_f1, 16));
|
|
// delay (100);
|
|
|
|
// auto thsd_f2_temp = _usd->readWord(offset+0x400000, bar);
|
|
// auto thsd_f2 = thsd_f2_temp&0x0000000F;
|
|
// color = checkTermalShutdown(thsd_f2) ? Qt::green : Qt::red;
|
|
// changeLabelTextColor(ui->l_thermalShutdownFpga2, color);
|
|
// ui->l_thermalShutdownFpga2->setText(QString::number(thsd_f2, 16));
|
|
// delay (100);
|
|
|
|
// auto thsd_f3_temp = _usd->readWord(offset+0x800000, bar);
|
|
// auto thsd_f3 = thsd_f3_temp&0x0000000F;
|
|
// color = checkTermalShutdown(thsd_f3) ? Qt::green : Qt::red;
|
|
// changeLabelTextColor(ui->l_thermalShutdownFpga3, color);
|
|
// ui->l_thermalShutdownFpga3->setText(QString::number(thsd_f3, 16));
|
|
//}*/
|
|
|
|
/********************************************************************/
|
|
void MainWindow::delay(int ms)
|
|
{
|
|
delayTimer.singleShot(ms, &loop, &QEventLoop::quit);
|
|
loop.exec();
|
|
}
|
|
|
|
const QString MainWindow::enum2String(ePg state) const
|
|
{
|
|
QString pg;
|
|
pg = (state) ? "good" : "bad";
|
|
return pg;
|
|
}
|
|
|
|
void MainWindow::restartTimer()
|
|
{
|
|
_timeout->start(1000);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*********************************************DMA*************************************************/
|
|
/*************************************************************************************************/
|
|
void MainWindow::getFramePacket(QByteArray packet)
|
|
{
|
|
_mutex.lock();
|
|
_dmaBuffer.push_back(packet);
|
|
_lastBuffer = packet;
|
|
_mutex.unlock();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_chk_continuousShowing_clicked()
|
|
{
|
|
if(_dmaRun && ui->chk_continuousShowing->isChecked())
|
|
{
|
|
QtConcurrent::run(this, &MainWindow::on_btn_dmaShow_clicked);
|
|
_dmaShow = true;
|
|
}
|
|
else
|
|
_dmaShow = false;
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::fillRam(QString path)
|
|
{
|
|
ui->btn_emulBrowse->setText("Filling RAM...");
|
|
_trx.fillRam(path);
|
|
ui->btn_emulBrowse->setText("Emulator Browse");
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_scenStart_clicked()
|
|
{
|
|
try
|
|
{
|
|
auto str = ui->btn_scenStart->text();
|
|
if(str == "Scenario Start")
|
|
{
|
|
ui->btn_scenStart->setText("Scenario Stop");
|
|
ui->btn_emulator->setText("Emulator Start");
|
|
ui->btn_dmaLogLast->setVisible(true);
|
|
_trx.scenPlayerStart();
|
|
_dmaLog = true;
|
|
_dmaRun = true; // flag
|
|
_dmaBuffer.clear();
|
|
QtConcurrent::run(this, &MainWindow::logPcie);
|
|
}
|
|
else
|
|
{
|
|
ui->btn_scenStart->setText("Scenario Start");
|
|
ui->btn_dmaLogLast->setHidden(true);
|
|
_dmaLog = false;
|
|
_dmaRun = false;
|
|
_trx.scenPlayerStop();
|
|
}
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_emulBrowse_clicked()
|
|
{
|
|
auto name = ui->btn_emulBrowse->text();
|
|
|
|
QFileDialog fileDialog;
|
|
fileDialog.setNameFilters({"*.bin"});
|
|
auto result = fileDialog.exec();
|
|
|
|
if(result)
|
|
{
|
|
_emulFolder = fileDialog.selectedFiles()[0];
|
|
}
|
|
|
|
if (name == "Emulator Browse")
|
|
QtConcurrent::run(this, &MainWindow::fillRam, _emulFolder);
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_emulator_clicked()
|
|
{
|
|
auto name = ui->btn_emulator->text();
|
|
|
|
try
|
|
{
|
|
if (name == "Emulator Start")
|
|
{
|
|
_emul->transferLength = TRANSFER_LENGTH;
|
|
_emul->ramBufAddress = RAM_BUFFER_OFFSET;
|
|
_emul->transferRate = TRANSFER_RATE;
|
|
_emul->emulOption = functionality;
|
|
_emul->emulMode = dynamically;
|
|
_trx.emulatorInit(_emul);
|
|
ui->btn_emulator->setText("Emulator Stop");
|
|
ui->btn_scenStart->setText("Scenario Start");
|
|
ui->btn_dmaLogLast->setVisible(true);
|
|
_trx.emulatorStart();
|
|
_dmaLog = true;
|
|
_dmaRun = true;
|
|
_dmaBuffer.clear();
|
|
QtConcurrent::run(this, &MainWindow::logPcie);
|
|
}
|
|
else
|
|
{
|
|
ui->btn_emulator->setText("Emulator Start");
|
|
ui->btn_dmaLogLast->setHidden(true);
|
|
_dmaLog = false;
|
|
_dmaRun = false;
|
|
_trx.emulatorStop();
|
|
}
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_logBrowse_clicked()
|
|
{
|
|
QFileDialog dialog;
|
|
dialog.setFileMode(QFileDialog::Directory);
|
|
dialog.setOption(QFileDialog::ShowDirsOnly);
|
|
auto result = dialog.exec();
|
|
|
|
if(result)
|
|
{
|
|
_logFolder = dialog.selectedFiles()[0];
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::logPcie()
|
|
{
|
|
ui->btn_dmaLogLast->setText("Logging...");
|
|
|
|
_dmaLogCount = 0;
|
|
|
|
quint32 i(0);
|
|
|
|
QProgressDialog* progress = new QProgressDialog(this);
|
|
progress->show();
|
|
|
|
while(_dmaLog)
|
|
{
|
|
if(_dmaBuffer.size() == 0)
|
|
{
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
|
continue;
|
|
}
|
|
QByteArray temp;
|
|
|
|
_mutex.lock();
|
|
temp = _dmaBuffer.front();
|
|
_dmaBuffer.pop_front();
|
|
_mutex.unlock();
|
|
|
|
_dmaLogCount +=1;
|
|
if (_dmaLogCount == ULTIMATE_LOG_COUNT)
|
|
_dmaLog = false;
|
|
|
|
quint16 batchId = ((static_cast<quint16>(temp[128]))& 0x00FF) |
|
|
(((static_cast<quint16>(temp[129])) << 8) & 0xFF00);
|
|
quint8 subBatchId = (static_cast<quint8>(temp[130]));
|
|
|
|
QString path = _logFolder + QString("/batch(%2)_sbatch(%3)_%1.bin").arg(i++).arg(batchId).arg(subBatchId);
|
|
QFile file(path);
|
|
|
|
file.open(QIODevice::WriteOnly);
|
|
file.write(temp);
|
|
|
|
// for(auto j = 0; j < TRANSFER_LENGTH; j += 8)
|
|
// {
|
|
// auto val = ((static_cast<quint64>(temp[j])) & 0x00000000000000FF) |
|
|
// (((static_cast<quint64>(temp[j + 1])) << 8) & 0x000000000000FF00) |
|
|
// (((static_cast<quint64>(temp[j + 2])) << 16) & 0x0000000000FF0000) |
|
|
// (((static_cast<quint64>(temp[j + 3])) << 24) & 0x00000000FF000000) |
|
|
// (((static_cast<quint64>(temp[j + 4])) << 32) & 0x000000FF00000000) |
|
|
// (((static_cast<quint64>(temp[j + 5])) << 40) & 0x0000FF0000000000) |
|
|
// (((static_cast<quint64>(temp[j + 6])) << 48) & 0x00FF000000000000) |
|
|
// (((static_cast<quint64>(temp[j + 7])) << 56) & 0xFF00000000000000);
|
|
// auto str = QStringLiteral("%1").arg(val, 16, 16, QLatin1Char('0'));
|
|
// file.write(str.toStdString().c_str(), str.length());
|
|
// file.write("\r\n", 2);
|
|
// }
|
|
file.close();
|
|
|
|
emit sendLogCount(_dmaLogCount, progress);
|
|
}
|
|
ui->btn_dmaLogLast->setText("InstantLog");
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_dmaLogLast_clicked()
|
|
{
|
|
if (_dmaRun && (ui->btn_dmaLogLast->text() == "InstantLog"))
|
|
{
|
|
_dmaBuffer.clear();
|
|
_dmaLog = true;
|
|
QtConcurrent::run(this, &MainWindow::logPcie);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_dmaShow_clicked()
|
|
{
|
|
do
|
|
{
|
|
if(ui->chk_2D_3DPlot->isChecked())
|
|
{
|
|
if(QThread::currentThread() == _uiThread)
|
|
show2d();
|
|
else
|
|
emit twoDReady();
|
|
}
|
|
else
|
|
{
|
|
if(QThread::currentThread() == _uiThread)
|
|
show3d();
|
|
else
|
|
emit threeDReady();
|
|
}
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
|
}while (_dmaShow);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::show3d()
|
|
{
|
|
_mutex.lock();
|
|
QByteArray temp = _lastBuffer;
|
|
_mutex.unlock();
|
|
//---------------------------------------------------------------------
|
|
//3D Plot
|
|
//---------------------------------------------------------------------
|
|
ui->plot_2->clearGraphs();
|
|
// qDebug() << "//3D Frame Plot //////////////////";
|
|
// ui->plot_2->setInteractions(QCP::iRangeZoom|QCP::iRangeDrag);
|
|
ui->plot_2->axisRect()->setupFullAxesBox(true);
|
|
ui->plot_2->xAxis->setLabel("Line");
|
|
ui->plot_2->yAxis->setLabel("Point");
|
|
|
|
quint16 batchId = ((static_cast<quint16>(temp[128]))& 0x00FF) |
|
|
(((static_cast<quint16>(temp[129])) << 8) & 0xFF00);
|
|
quint8 subBatchId = (static_cast<quint8>(temp[130]));
|
|
quint8 frmType = (static_cast<quint8>(temp[131]));
|
|
quint8 cri = (static_cast<quint8>(temp[132]));
|
|
|
|
quint16 bLine = ((static_cast<quint16>(temp[136]))& 0x00FF) |
|
|
(((static_cast<quint16>(temp[137])) << 8) & 0xFF00);
|
|
quint16 bPoint = ((static_cast<quint16>(temp[138]))& 0x00FF) |
|
|
(((static_cast<quint16>(temp[139])) << 8) & 0xFF00);
|
|
quint8 mLine = (static_cast<quint8>(temp[140]));
|
|
quint16 mPoint = ((static_cast<quint16>(temp[141]))& 0x00FF) |
|
|
(((static_cast<quint16>(temp[142])) << 8) & 0xFF00);
|
|
if(bLine > 256)
|
|
{
|
|
qDebug() << "ERROR :: (B Line)" << bLine;
|
|
return;
|
|
}
|
|
|
|
if(bPoint > 8192)
|
|
{
|
|
qDebug() << "ERROR :: (B Point)" << bPoint;
|
|
return;
|
|
}
|
|
if(frmType != 0)
|
|
{
|
|
qDebug() << "ERROR :: (Invalid Frame Type)" << frmType;
|
|
return;
|
|
}
|
|
qDebug() << "batchId" << batchId;
|
|
qDebug() << "subBatchId" << subBatchId;
|
|
qDebug() << "bLine" << bLine;
|
|
qDebug() << "bPoint" << bPoint;
|
|
qDebug() << "frmType" << frmType;
|
|
qDebug() << "cri" << cri;
|
|
qDebug() << "mLine" << mLine;
|
|
qDebug() << "mPoint" << mPoint;
|
|
|
|
_colorMap->data()->clear();
|
|
_colorMap->data()->setSize(bLine,bPoint);
|
|
_colorMap->data()->setRange(QCPRange(1,bLine),QCPRange(1,bPoint));
|
|
//double x,y,z;
|
|
//int xIndex = 0;
|
|
//int yIndex = 0;
|
|
quint32 max = 0;
|
|
auto indx = 0;
|
|
for(auto line = 0; line < bLine; line += 1)
|
|
{
|
|
for(auto pnt = 0; pnt < bPoint; pnt += 1)
|
|
{
|
|
indx = (line * bPoint + pnt) * 4 + 160;
|
|
auto val = ((static_cast<quint32>(temp[indx])) & 0x000000FF) |
|
|
(((static_cast<quint32>(temp[indx + 1])) << 8) & 0x0000FF00) |
|
|
(((static_cast<quint32>(temp[indx + 2])) << 16) & 0x00FF0000) |
|
|
(((static_cast<quint32>(temp[indx + 3])) << 24) & 0xFF000000);
|
|
//xIndex = line;
|
|
//yIndex = pnt;
|
|
//z = double(val);
|
|
//colorMap->data()->cellToCoord(xIndex,yIndex,&x,&y);
|
|
if(max<val)
|
|
max = val;
|
|
_colorMap->data()->setCell(line,pnt,double(val));
|
|
}
|
|
|
|
}
|
|
// qDebug() << "indx" << indx;
|
|
// qDebug() << "max" << max;
|
|
qDebug() << ui->plot_2->plotLayout()->hasElement(0,1);
|
|
|
|
if(!ui->plot_2->plotLayout()->hasElement(0,1))
|
|
{
|
|
QCPColorScale *colorScale = new QCPColorScale(ui->plot_2);
|
|
ui->plot_2->plotLayout()->addElement(0,1,colorScale);
|
|
colorScale->setType(QCPAxis::atRight);
|
|
_colorMap->setColorScale(colorScale);
|
|
colorScale->axis()->setLabel("Number");
|
|
_colorMap->setGradient((QCPColorGradient::gpJet));
|
|
//colorMap->rescaleDataRange();
|
|
QCPMarginGroup *marginGroup = new QCPMarginGroup(ui->plot_2);
|
|
ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop,marginGroup);
|
|
colorScale->setMarginGroup(QCP::msBottom|QCP::msTop,marginGroup);
|
|
}
|
|
_colorMap->setGradient((QCPColorGradient::gpJet));
|
|
_colorMap->rescaleDataRange();
|
|
|
|
ui->plot_2->rescaleAxes(true);
|
|
ui->plot_2->replot();
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::show2d()
|
|
{
|
|
_mutex.lock();
|
|
QByteArray temp = _lastBuffer;
|
|
_mutex.unlock();
|
|
|
|
//---------------------------------------------------------------------
|
|
//2D Plot
|
|
//---------------------------------------------------------------------
|
|
ui->plot_2->clearGraphs();
|
|
ui->plot_2->clearItems();
|
|
ui->plot_2->setInteraction(QCP::iRangeZoom);
|
|
ui->plot_2->setInteraction(QCP::iRangeDrag);
|
|
ui->plot_2->setInteraction(QCP::iSelectPlottables);
|
|
ui->plot_2->setSelectionRectMode(QCP::srmZoom);
|
|
|
|
QVector<double> x, y;
|
|
int i = 0;
|
|
for(auto j = 0; j < TRANSFER_LENGTH; j += 8)
|
|
{
|
|
x.push_back(i++);
|
|
auto val = ((static_cast<quint64>(temp[j])) & 0x00000000000000FF) |
|
|
(((static_cast<quint64>(temp[j + 1])) << 8) & 0x000000000000FF00) |
|
|
(((static_cast<quint64>(temp[j + 2])) << 16) & 0x0000000000FF0000) |
|
|
(((static_cast<quint64>(temp[j + 3])) << 24) & 0x00000000FF000000) |
|
|
(((static_cast<quint64>(temp[j + 4])) << 32) & 0x000000FF00000000) |
|
|
(((static_cast<quint64>(temp[j + 5])) << 40) & 0x0000FF0000000000) |
|
|
(((static_cast<quint64>(temp[j + 6])) << 48) & 0x00FF000000000000) |
|
|
(((static_cast<quint64>(temp[j + 7])) << 56) & 0xFF00000000000000);
|
|
|
|
y.push_back(val);
|
|
}
|
|
|
|
ui->plot_2->addGraph();
|
|
ui->plot_2->graph(0)->setData(x, y);
|
|
//give the axes some labels:
|
|
ui->plot_2->xAxis->setLabel("sample no");
|
|
ui->plot_2->yAxis->setLabel("sample value");
|
|
//set axes ranges, so we see all data:
|
|
ui->plot_2->rescaleAxes();
|
|
ui->plot_2->replot();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::catchLogCount(qint32 counter, QProgressDialog* _progress)
|
|
{
|
|
_progress->setMinimumSize(300,100);
|
|
_progress->setLabelText("Please wait...");
|
|
_progress->setWindowTitle("Frame Packets Logging");
|
|
_progress->setRange(0, ULTIMATE_LOG_COUNT);
|
|
_progress->setModal(true);
|
|
|
|
try
|
|
{
|
|
_progress->setValue(counter);
|
|
if (_progress->wasCanceled())
|
|
{
|
|
throw SonoException("Frame Packets Logging is canceled");
|
|
}
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
///*************************************************************************************************/
|
|
///********************************************Power************************************************/
|
|
///*************************************************************************************************/
|
|
|
|
//void MainWindow::on_btn_hvRegulatorConfig_clicked()
|
|
//{
|
|
// auto name=ui->btn_hvRegulatorConfig->text();
|
|
// auto freq=ui->tb_hvFreq->text().toFloat(Q_NULLPTR);
|
|
|
|
// if(name==ENABLE)
|
|
// {
|
|
//// freq<65.00f ? freq=65.00f : freq=freq;
|
|
//// freq>130.00f ? freq=130.00f : freq=freq;
|
|
//// pwr.setHVsRegulator(true, true, freq);
|
|
//// pwr.setHVsRegulator(true, false, freq);
|
|
//// auto real_freq=pwr.getHVsRegulatorFreq();
|
|
//// ui->tb_hvFreq->setText(QString("%1").arg(real_freq));
|
|
//// ui->btn_hvRegulatorConfig->setText(DISABLE);
|
|
// }
|
|
// else
|
|
// {
|
|
//// pwr.setHVsRegulator(false, false, freq);
|
|
//// ui->btn_hvRegulatorConfig->setText(ENABLE);
|
|
// }
|
|
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_pm5RegulatorConfig_clicked()
|
|
//{
|
|
// auto name=ui->btn_pm5RegulatorConfig->text();
|
|
// auto freq=ui->tb_pm5Freq->text().toFloat(Q_NULLPTR);
|
|
|
|
// if(name==ENABLE)
|
|
// {
|
|
//// freq<280.00f ? freq=280.00f : freq=freq;
|
|
//// freq>400.00f ? freq=400.00f : freq=freq;
|
|
//// pwr.setPM5vRegulator(true, true, freq);
|
|
//// pwr.setPM5vRegulator(true, false, freq);
|
|
//// auto real_freq=pwr.getPM5vRegulatorFreq();
|
|
//// ui->tb_pm5Freq->setText(QString("%1").arg(real_freq));
|
|
//// ui->btn_pm5RegulatorConfig->setText(DISABLE);
|
|
// }
|
|
// else
|
|
// {
|
|
//// pwr.setPM5vRegulator(false, false, freq);
|
|
//// ui->btn_pm5RegulatorConfig->setText(ENABLE);
|
|
// }
|
|
//}
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_pwrDacsEnable_clicked()
|
|
//{
|
|
// // bool i2cBusy, i2cDone;
|
|
// auto hvaValue=ui->tb_hvaDacValue->text().toFloat(Q_NULLPTR);
|
|
// auto hvbValue=ui->tb_hvbDacValue->text().toFloat(Q_NULLPTR);
|
|
// auto cwdValue=ui->tb_cwdDacValue->text().toFloat(Q_NULLPTR);
|
|
|
|
//// if (hvaValue>85) {
|
|
//// MESSAGE_BOX("HVA value is greater than determined limits");
|
|
//// hvaValue=85.00f;
|
|
//// }
|
|
//// else if (hvaValue<1.53f){
|
|
//// MESSAGE_BOX("HVA value is less than determined limits");
|
|
//// hvaValue=1.53f;
|
|
//// }
|
|
|
|
//// if (hvaValue<hvbValue){
|
|
//// MESSAGE_BOX("HVA value must be greater or equal than the HVB value");
|
|
//// hvbValue=hvaValue;
|
|
//// }
|
|
//// else if (hvbValue<1.53f){
|
|
//// MESSAGE_BOX("HVB value is less than determined limits");
|
|
//// hvbValue=1.53f;
|
|
//// }
|
|
|
|
//// if (cwdValue>6.90f) {
|
|
//// MESSAGE_BOX("CWD value is greater than determined limits");
|
|
//// cwdValue=6.90f;
|
|
//// }
|
|
//// else if (cwdValue<1.54f){
|
|
//// MESSAGE_BOX("CWD value is less than determined limits");
|
|
//// cwdValue=1.54f;
|
|
//// }
|
|
|
|
//// auto cwdDacsEnable=pwr.getSetupCmdCwdOnOff();
|
|
//// if (cwdDacsEnable){
|
|
//// hvbValue=1.53f;
|
|
//// hvaValue<10.00f ? hvaValue=10.00f : hvaValue=hvaValue;
|
|
//// }
|
|
|
|
//// i2cBusy=pwr.getI2cBusy();
|
|
//// while (i2cBusy==true) {
|
|
//// i2cBusy=pwr.getI2cBusy();
|
|
//// }
|
|
////// delay(100);
|
|
|
|
|
|
//// pwr.setDAcs(true, cwdValue, hvbValue, hvaValue);
|
|
//// pwr.setDAcs(false, cwdValue, hvbValue, hvaValue);
|
|
|
|
//// i2cDone=pwr.getI2cCmdDone();
|
|
//// while (i2cDone==false){
|
|
//// i2cDone=pwr.getI2cCmdDone();
|
|
//// }
|
|
//// auto real_HVaValue=pwr.getHVaDAcs();
|
|
//// auto real_HVbValue=pwr.getHVbDAcs();
|
|
//// auto real_CWdValue=pwr.getCWdDAcs();
|
|
//// ui->tb_hvaDacValue->setText(QString::number(real_HVaValue, 'f', 2));
|
|
//// ui->tb_hvbDacValue->setText(QString::number(real_HVbValue, 'f', 2));
|
|
//// ui->tb_cwdDacValue->setText(QString::number(real_CWdValue, 'f', 2));
|
|
//}
|
|
|
|
void MainWindow::on_btn_setAo_clicked()
|
|
{
|
|
auto hvaValue=ui->tb_hvaDacValue->text().toFloat(Q_NULLPTR);
|
|
auto hvbValue=ui->tb_hvbDacValue->text().toFloat(Q_NULLPTR);
|
|
//auto cwdValue=ui->tb_cwdDacValue->text().toFloat(Q_NULLPTR);
|
|
try
|
|
{
|
|
_trx.mpsSetAo(hvaValue, hvbValue);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_chk_mpsInit_clicked()
|
|
{
|
|
try
|
|
{
|
|
if (ui->chk_mpsInit->isChecked())
|
|
_trx.mpsPwrOn();
|
|
|
|
else
|
|
_trx.mpsPwrOff();
|
|
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
|
|
void MainWindow::on_btn_supJump_clicked()
|
|
{
|
|
try
|
|
{
|
|
_trx.mpsReset(); //jump
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_updateRdbackValue_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
_trx.supervisorRbValue(_supRbValue);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
|
|
auto hvapValue=_supRbValue->hvap;
|
|
ui->l_hvap->setText(QString::number(static_cast<double>(hvapValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto hvbpValue=_supRbValue->hvbp;
|
|
ui->l_hvbp->setText(QString::number(static_cast<double>(hvbpValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto cwdpValue=_supRbValue->cwdp;
|
|
ui->l_cwdp->setText(QString::number(static_cast<double>(cwdpValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto curr24vValue=_supRbValue->curr24V;
|
|
ui->l_curr24v->setText(QString::number(static_cast<double>(curr24vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p24vValue=_supRbValue->p24V;
|
|
ui->l_p24v->setText(QString::number(static_cast<double>(p24vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p12vValue=_supRbValue->p12V;
|
|
ui->l_p12v->setText(QString::number(static_cast<double>(p12vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p5vValue=_supRbValue->p5V;
|
|
ui->l_p5v->setText(QString::number(static_cast<double>(p5vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto m5vValue=_supRbValue->m5V;
|
|
ui->l_m5v->setText(QString::number(static_cast<double>(m5vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto hvStopValue=_supRbValue->hvStop;
|
|
ui->l_hvStop->setText(QString::number(static_cast<double>(hvStopValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p4dValue=_supRbValue->p4D;
|
|
ui->l_p4d->setText(QString::number(static_cast<double>(p4dValue), 'f', 3));
|
|
delay(10);
|
|
|
|
/********************Faults***********************/
|
|
try
|
|
{
|
|
_trx.mpsFaultStatus(_faultStatus);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
|
|
bool hvapFlt=_faultStatus->hvap;
|
|
ui->l_hvapFlt->setText(QVariant(hvapFlt).toString());
|
|
auto colorHvapFlt = hvapFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_hvapFlt, colorHvapFlt);
|
|
delay(10);
|
|
|
|
bool hvbpFlt=_faultStatus->hvbp;
|
|
ui->l_hvbpFlt->setText(QVariant(hvbpFlt).toString());
|
|
auto colorHvbpFlt = hvbpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_hvbpFlt, colorHvbpFlt);
|
|
delay(10);
|
|
|
|
bool cwdpFlt=_faultStatus->cwdp;
|
|
ui->l_cwdFlt->setText(QVariant(cwdpFlt).toString());
|
|
auto colorCwdpFlt = cwdpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_cwdFlt, colorCwdpFlt);
|
|
delay(10);
|
|
|
|
bool cur24vFlt=_faultStatus->curr24V;
|
|
ui->l_curr24vFlt->setText(QVariant(cur24vFlt).toString());
|
|
auto colorCur24vFlt = cur24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_curr24vFlt, colorCur24vFlt);
|
|
delay(10);
|
|
|
|
bool p24vFlt=_faultStatus->p24v;
|
|
ui->l_p24vFlt->setText(QVariant(p24vFlt).toString());
|
|
auto colorP24vFlt = p24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p24vFlt, colorP24vFlt);
|
|
delay(10);
|
|
|
|
bool p12vFlt=_faultStatus->p12v;
|
|
ui->l_p12vFlt->setText(QVariant(p12vFlt).toString());
|
|
auto colorP12vFlt = p12vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p12vFlt, colorP12vFlt);
|
|
delay(10);
|
|
|
|
bool p5vFlt=_faultStatus->p5v;
|
|
ui->l_p5vFlt->setText(QVariant(p5vFlt).toString());
|
|
auto colorP5vFlt = p5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p5vFlt, colorP5vFlt);
|
|
delay(10);
|
|
|
|
bool m5vFlt=_faultStatus->m5v;
|
|
ui->l_m5vFlt->setText(QVariant(m5vFlt).toString());
|
|
auto colorM5vFlt = m5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_m5vFlt, colorM5vFlt);
|
|
delay(10);
|
|
|
|
bool hvFlt=_faultStatus->hvError;
|
|
ui->l_hvFlt->setText(QVariant(hvFlt).toString());
|
|
auto colorHvFlt = hvFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_hvFlt, colorHvFlt);
|
|
delay(10);
|
|
|
|
bool sup4dFlt=_faultStatus->sup4d;
|
|
ui->l_p4dFlt->setText(QVariant(sup4dFlt).toString());
|
|
auto colorP4dFlt = sup4dFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p4dFlt, colorP4dFlt);
|
|
delay(10);
|
|
|
|
/******************Faults_Over*********************/
|
|
bool ovrHvapFlt=_faultStatus->overHvap;
|
|
ui->l_ovrHVapFlt->setText(QVariant(ovrHvapFlt).toString());
|
|
auto colorOvrHvapFlt = ovrHvapFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrHVapFlt, colorOvrHvapFlt);
|
|
delay(10);
|
|
|
|
bool ovrHvbpFlt=_faultStatus->overHvbp;
|
|
ui->l_ovrHVbpFlt->setText(QVariant(ovrHvbpFlt).toString());
|
|
auto colorOvrHvbpFlt = ovrHvbpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrHVbpFlt, colorOvrHvbpFlt);
|
|
delay(10);
|
|
|
|
bool ovrCwdpFlt=_faultStatus->overCwdp;
|
|
ui->l_ovrCWdpFlt->setText(QVariant(ovrCwdpFlt).toString());
|
|
auto colorOvrCwdpFlt = ovrCwdpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrCWdpFlt, colorOvrCwdpFlt);
|
|
delay(10);
|
|
|
|
bool ovrCur24vFlt=_faultStatus->overCurr24V;
|
|
ui->l_ovrCur24vFlt->setText(QVariant(ovrCur24vFlt).toString());
|
|
auto colorOvrCur24vFlt = ovrCur24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrCur24vFlt, colorOvrCur24vFlt);
|
|
delay(10);
|
|
|
|
bool ovrP24vFlt=_faultStatus->overP24v;
|
|
ui->l_ovrP24vFlt->setText(QVariant(ovrP24vFlt).toString());
|
|
auto colorOvrP24vFlt = ovrP24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrP24vFlt, colorOvrP24vFlt);
|
|
delay(10);
|
|
|
|
bool ovrP12vFlt=_faultStatus->overP12v;
|
|
ui->l_ovrP12vFlt->setText(QVariant(ovrP12vFlt).toString());
|
|
auto colorOvrP12vFlt = ovrP12vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrP12vFlt, colorOvrP12vFlt);
|
|
delay(10);
|
|
|
|
bool ovrP5vFlt=_faultStatus->overP5v;
|
|
ui->l_ovrP5vFlt->setText(QVariant(ovrP5vFlt).toString());
|
|
auto colorOvrP5vFlt = ovrP5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrP5vFlt, colorOvrP5vFlt);
|
|
delay(10);
|
|
|
|
bool ovrM5vFlt=_faultStatus->overM5v;
|
|
ui->l_ovrM5vFlt->setText(QVariant(ovrM5vFlt).toString());
|
|
auto colorOvrM5vFlt = ovrM5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrM5vFlt, colorOvrM5vFlt);
|
|
delay(10);
|
|
|
|
bool ovrHvFlt=_faultStatus->overHvError;
|
|
ui->l_ovrHvFlt->setText(QVariant(ovrHvFlt).toString());
|
|
auto colorOvrHvFlt = ovrHvFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrHvFlt, colorOvrHvFlt);
|
|
delay(10);
|
|
|
|
bool ovrSup4dFlt=_faultStatus->overSup4d;
|
|
ui->l_ovr4dFlt->setText(QVariant(ovrSup4dFlt).toString());
|
|
auto colorOvrP4dFlt = ovrSup4dFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovr4dFlt, colorOvrP4dFlt);
|
|
delay(10);
|
|
|
|
/******************Faults_Under*********************/
|
|
bool udrHvapFlt=_faultStatus->underHvap;
|
|
ui->l_udrHVapFlt->setText(QVariant(udrHvapFlt).toString());
|
|
auto colorUdrHvapFlt = udrHvapFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrHVapFlt, colorUdrHvapFlt);
|
|
delay(10);
|
|
|
|
bool udrHvbpFlt=_faultStatus->underHvbp;
|
|
ui->l_udrHVbpFlt->setText(QVariant(udrHvbpFlt).toString());
|
|
auto colorUdrHvbpFlt = udrHvbpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrHVbpFlt, colorUdrHvbpFlt);
|
|
delay(10);
|
|
|
|
bool udrCwdpFlt=_faultStatus->underCwdp;
|
|
ui->l_udrCWdpFlt->setText(QVariant(udrCwdpFlt).toString());
|
|
auto colorUdrCwdpFlt = udrCwdpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrCWdpFlt, colorUdrCwdpFlt);
|
|
delay(10);
|
|
|
|
bool udrCur24vFlt=_faultStatus->underCurr24V;
|
|
ui->l_udrCurr24vFlt->setText(QVariant(udrCur24vFlt).toString());
|
|
auto colorUdrCur24vFlt = udrCur24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrCurr24vFlt, colorUdrCur24vFlt);
|
|
delay(10);
|
|
|
|
bool udrP24vFlt=_faultStatus->underP24v;
|
|
ui->l_udrP24vFlt->setText(QVariant(udrP24vFlt).toString());
|
|
auto colorUdrP24vFlt = udrP24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrP24vFlt, colorUdrP24vFlt);
|
|
delay(10);
|
|
|
|
bool udrP12vFlt=_faultStatus->underP12v;
|
|
ui->l_udrP12vFlt->setText(QVariant(udrP12vFlt).toString());
|
|
auto colorUdrP12vFlt = udrP12vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrP12vFlt, colorUdrP12vFlt);
|
|
delay(10);
|
|
|
|
bool udrP5vFlt=_faultStatus->underP5v;
|
|
ui->l_udrP5vFlt->setText(QVariant(udrP5vFlt).toString());
|
|
auto colorUdrP5vFlt = udrP5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrP5vFlt, colorUdrP5vFlt);
|
|
delay(10);
|
|
|
|
bool udrM5vFlt=_faultStatus->underM5v;
|
|
ui->l_udrM5vFlt->setText(QVariant(udrM5vFlt).toString());
|
|
auto colorUdrM5vFlt = udrM5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrM5vFlt, colorUdrM5vFlt);
|
|
delay(10);
|
|
|
|
bool udrHvFlt=_faultStatus->underHvError;
|
|
ui->l_udrHvFlt->setText(QVariant(udrHvFlt).toString());
|
|
auto colorUdrHvFlt = udrHvFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrHvFlt, colorUdrHvFlt);
|
|
delay(10);
|
|
|
|
bool udrSup4dFlt=_faultStatus->underSup4d;
|
|
ui->l_udr4dFlt->setText(QVariant(udrSup4dFlt).toString());
|
|
auto colorUdrP4dFlt = udrSup4dFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udr4dFlt, colorUdrP4dFlt);
|
|
delay(10);
|
|
}
|
|
|
|
|
|
//void MainWindow::on_chk_usrMulDac_stateChanged(int arg1)
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x86018;
|
|
// auto value = _usd->readWord(offset, bar);
|
|
// if (!ui->chk_usrMulDac->isChecked())
|
|
// _usd->writeWord(offset, bar, value&0xFFF);
|
|
//}
|
|
|
|
//void MainWindow::on_btn_afeProg_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// uint32_t offsetWr[3] = {0x10F0DA*4,0x20F0DA*4,0x30F0DA*4};
|
|
// uint32_t offsetRd[3] = {0x10F0DE*4,0x20F0DE*4,0x30F0DE*4};
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetWr[i], bar, 0xF0);
|
|
// _usd->writeWord(offsetWr[i], bar, 0x0F);
|
|
// }
|
|
// qDebug() << "--- AFE Registers --- ";
|
|
// for (int i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetRd[i], bar);
|
|
// qDebug() << QString::number(offsetRd[i], 16) << QString::number(value, 16);
|
|
// }
|
|
// qDebug() << "--- ------------- --- ";
|
|
//}
|
|
|
|
//void MainWindow::on_btn_gtReg_clicked()
|
|
//{
|
|
// auto result = "OK";
|
|
// auto bar = 0;
|
|
// uint32_t offsetRd[24] = {0x14008*4,0x114008*4,0x214008*4,0x314008*4,
|
|
// 0x1400B*4,0x11400B*4,0x21400B*4,0x31400B*4,
|
|
// 0x1400C*4,0x11400C*4,0x21400C*4,0x31400C*4,
|
|
// 0x1400D*4,0x11400D*4,0x21400D*4,0x31400D*4,
|
|
// 0x14010*4,0x114010*4,0x214010*4,0x314010*4,
|
|
// 0x14011*4,0x114011*4,0x214011*4,0x314011*4};
|
|
// uint32_t correctVal[24] = {0x0,0xFF43,0xFF43,0xFF43,
|
|
// 0x0,0xFFFF,0xFFFF,0xFFFF,
|
|
// 0x0,0xF0F,0xF0F,0xF0F,
|
|
// 0xFF43,0xF04F,0xFF43,0xFF43,
|
|
// 0xFFFF,0xFF00,0xFFFF,0xFFFF,
|
|
// 0xF0F,0xF00,0xF0F,0xF0F};
|
|
// qDebug() << "--- GT Status Registers --- ";
|
|
// for (auto i=0 ; i<20;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetRd[i], bar);
|
|
// if (value == correctVal[i])
|
|
// result = "OK";
|
|
// else
|
|
// result = "NOK";
|
|
// qDebug() << QString::number(offsetRd[i]/4, 16) << QString::number(value, 16) << result;
|
|
// }
|
|
// qDebug() << "--- ------------------- --- ";
|
|
//}
|
|
|
|
//void MainWindow::on_btn_browse_clicked()
|
|
//{
|
|
// QFileDialog dialog;
|
|
// dialog.setFileMode(QFileDialog::Directory);
|
|
// dialog.setOption(QFileDialog::ShowDirsOnly);
|
|
// auto result = dialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// //_adcloggerFolder = dialog.selectedFiles()[0];
|
|
|
|
// ui->tb_adcLoggerPath->setText(dialog.selectedFiles()[0]);
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::on_btn_dbgTransferStrt_clicked()
|
|
//{
|
|
// ui->btn_dbgTransferStrt->setText("Trans...");
|
|
// auto path = ui->tb_adcLoggerPath->text();
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::AdcLogCsvFileWriter, path, ui->prg_adcLoggerFileWr);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// ui->btn_dbgTransferStrt->setText(START);
|
|
//}
|
|
|
|
//void MainWindow::on_btn_adcLoggerStrt_clicked()
|
|
//{
|
|
// ui->btn_adcLoggerStrt->setText("Log...");
|
|
// uint32_t bar = 0;
|
|
// uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4};
|
|
|
|
// qDebug() << "--- ADC Logger Start --- ";
|
|
|
|
// auto temp = ui->tb_dbgSmplCnt->text().toUInt(Q_NULLPTR, 16);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x1); //reset Logger
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x0); //reset done
|
|
|
|
// auto value = temp<<8;
|
|
// value |= 0x4;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Start ADC Logger and set Counter
|
|
// }
|
|
// QtConcurrent::run(this, &MainWindow::adcLoggerStatusCheck);
|
|
//}
|
|
|
|
//void MainWindow::on_prg_adcLoggerFileWr_valueChanged(int value)
|
|
//{
|
|
|
|
//}
|
|
|
|
|
|
//void MainWindow::adcLoggerStatusCheck()
|
|
//{
|
|
// uint32_t offsetTrnsStatus[3] = {0x14000A*4,0x24000A*4,0x34000A*4};
|
|
// uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4};
|
|
// _adcLoggerDone = false;
|
|
// auto timeOut = 0;
|
|
// auto doneFlag = 0;
|
|
// while (timeOut < 1000 && doneFlag < 3 )
|
|
// {
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// doneFlag += (_usd->readWord(offsetTrnsStatus[i], 0) & 0X1);
|
|
// }
|
|
// timeOut += 1;
|
|
// delay(10);
|
|
// }
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetTrnsfrCmdLen[i], 0);
|
|
// value &= 0xFFFFFFF0;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], 0, value);
|
|
// }
|
|
|
|
// ui->btn_adcLoggerStrt->setText(START);
|
|
// _adcLoggerDone = true;
|
|
// if(timeOut == 1000)
|
|
// {
|
|
// MESSAGE_BOX("Logger incomplete");
|
|
// return;
|
|
// }
|
|
// else
|
|
// qDebug() << "--- ADC Logger done --- ";
|
|
//}
|
|
|
|
|
|
//void MainWindow::on_btn_adcSimBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"ADC Sim Scenario file (*.bin)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_adcSimPath->setText(selectedPath);
|
|
// _settings->setValue(ADC_SIM_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::on_btn_adcSimStart_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// //auto offset = 0;
|
|
// uint32_t offsetDbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4};
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// auto startIndex = ui->tb_adcSimStartIndex->text().toUInt(Q_NULLPTR, 16);
|
|
// if(startIndex == 0 && ui->tb_adcSimStartIndex->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for start index");
|
|
// return;
|
|
// }
|
|
|
|
// auto stopIndex = ui->tb_adcSimStopIndex->text().toUInt(Q_NULLPTR, 16);
|
|
// if(stopIndex == 0 && ui->tb_adcSimStopIndex->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for stop index");
|
|
// return;
|
|
// }
|
|
|
|
// if((stopIndex < startIndex) || (stopIndex>131071) || (startIndex>131071))
|
|
// {
|
|
// MESSAGE_BOX("Stop index should be greater than or equal to start index");
|
|
// return;
|
|
// }
|
|
|
|
// _usd->writeWord(0x804, bar, startIndex);
|
|
// _usd->writeWord(0x808, bar, stopIndex);
|
|
// auto value = 0;
|
|
// auto str = ui->btn_adcSimStart->text();
|
|
// if(str == START)
|
|
// {
|
|
// qDebug() << "--- SET GT Send Mode :: BF --- ";
|
|
// _usd->writeWord(0x10, 0, 0x1);
|
|
// _csvReadStopFlag = false;
|
|
// ui->btn_adcSimStart->setText(STOP);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetDbgCmd[i], 0);
|
|
// value |= 0x1;
|
|
// _usd->writeWord(offsetDbgCmd[i], 0, value);
|
|
// }
|
|
|
|
// delay(100);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value | 0x2);
|
|
// }
|
|
// auto path = ui->tb_adcSimPath->text();
|
|
// auto future = QtConcurrent::run(this, &MainWindow::binAdcFileUploader, 0, path , ui->prg_adcSim);
|
|
// }
|
|
// else
|
|
// {
|
|
// _csvReadStopFlag = true;
|
|
// ui->btn_adcSimStart->setText(START);
|
|
// _usd->writeWord(0x800, bar, 0);
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetDbgCmd[i], 0);
|
|
// value &= 0xFFFFFFF0;
|
|
// _usd->writeWord(offsetDbgCmd[i], 0, value);
|
|
// }
|
|
// delay(100);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value & 0x1);
|
|
// }
|
|
|
|
// //scenarioStop();
|
|
// }
|
|
|
|
//}
|
|
|
|
//void MainWindow::on_btn_adcLoggerAutoCount_clicked()
|
|
//{
|
|
// uint32_t bar = 0;
|
|
// uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4};
|
|
|
|
// auto logCount = ui->tb_dbgAutoLogCount->text().toUInt();
|
|
// if(logCount == 0 && ui->tb_dbgAutoLogCount->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for logCount");
|
|
// return;
|
|
// }
|
|
|
|
// ui->btn_adcLoggerAutoCount->setText("Log...");
|
|
// uint32_t offsetAfePwrDn[3] = {0x10F0C5*4,0x20F0C5*4,0x30F0C5*4};
|
|
// uint32_t offsetAfeLpf[3] = {0x10F0C4*4,0x20F0C4*4,0x30F0C4*4};
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x0);
|
|
// _usd->writeWord(offsetAfeLpf[i], bar, 0x0100);
|
|
// }
|
|
// qDebug() << "--- AFE Registers --- ";
|
|
// delay(1);
|
|
|
|
|
|
// for (auto j = 0 ; j < logCount ; j++)
|
|
// {
|
|
|
|
// qDebug() << "--- ADC Auto Logger Start --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x1); //reset Logger
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x0); //reset done
|
|
|
|
// auto value = 1<<8;
|
|
// value |= 0x4;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Start ADC Logger and set Counter
|
|
|
|
// value |= 0x8;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Set Manual Trig
|
|
|
|
// value &= 0xF7;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Set Manual Trig
|
|
|
|
// }
|
|
// QtConcurrent::run(this, &MainWindow::adcLoggerStatusCheck);
|
|
// delay(10);
|
|
// while (!_adcLoggerDone);
|
|
|
|
// auto path = ui->tb_adcLoggerPath->text();
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::AdcLogCsvFileWriter, path, ui->prg_adcLoggerFileWr);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// ui->btn_dbgTransferStrt->setText(START);
|
|
|
|
// delay(10);
|
|
// while (!_adcLoggerTrnsDone);
|
|
// }
|
|
// ui->btn_adcLoggerAutoCount->setText(START);
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x8000);
|
|
// }
|
|
// qDebug() << "--- AFE Registers Power Down --- ";
|
|
//}
|
|
|
|
|
|
//void MainWindow::on_btn_scenRead_clicked()
|
|
//{
|
|
// auto paramPath = ui->tb_paramFile->text();
|
|
// auto paramBar = 0;
|
|
// auto boardParamPath = "/home/hasis/Desktop/TrxBoardFile/_log/readBack.csv";
|
|
// QtConcurrent::run(this, &MainWindow::CsvFileChecker,paramBar, paramPath , boardParamPath , ui->prg_scenarioUpload);
|
|
|
|
//}
|
|
|
|
void MainWindow::on_btn_getFpgaVersion_clicked()
|
|
{
|
|
_trx.getFpgasCodeVersion(_version);
|
|
auto value = _version->masterCode;
|
|
ui->l_masterVersion->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
value = _version->slave0Code;
|
|
ui->l_slave0Version->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
value = _version->slave1Code;
|
|
ui->l_slave1Version->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
value = _version->slave2Code;
|
|
ui->l_slave2Version->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
}
|
|
|
|
//void MainWindow::on_btn_txTrig_clicked()
|
|
//{
|
|
|
|
// auto bar = 0;
|
|
// uint32_t offsetAfeAdc2[3] = {0x10F002*4,0x20F002*4,0x30F002*4};
|
|
|
|
//// qDebug() << "--- SET AFE Ramp Count Mode --- ";
|
|
//// for (auto i=0 ; i<3;i++)
|
|
//// {
|
|
//// _usd->writeWord(offsetAfeAdc2[i], bar, 0x1380);
|
|
//// }
|
|
// delay(20);
|
|
|
|
|
|
// uint32_t offsetAfePwrDn[3] = {0x10F0C5*4,0x20F0C5*4,0x30F0C5*4};
|
|
// //uint32_t offsetAfeLpf[3] = {0x10F0C4*4,0x20F0C4*4,0x30F0C4*4};
|
|
|
|
// qDebug() << "--- SET AFE Power On Mode --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x0);
|
|
// //_usd->writeWord(offsetAfeLpf[i], bar, 0x0100);
|
|
// }
|
|
// delay(100);
|
|
|
|
|
|
// qDebug() << "--- Set TX Trig --- ";
|
|
|
|
// auto offset = 0x5*4;
|
|
// auto value = 0x1;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// value = 0x5;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// value = 0x1;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// delay(100);
|
|
// value = 0x0;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// qDebug() << "--- TX Trig Done--- ";
|
|
|
|
// delay(10);
|
|
//// qDebug() << "--- SET AFE Normal Mode --- ";
|
|
//// for (auto i=0 ; i<3;i++)
|
|
//// {
|
|
//// _usd->writeWord(offsetAfeAdc2[i], bar, 0x1000);
|
|
//// }
|
|
// qDebug() << "--- SET AFE Power On Mode --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x8000);
|
|
// //_usd->writeWord(offsetAfeLpf[i], bar, 0x0100);
|
|
// }
|
|
// delay(1);
|
|
// delay(20);
|
|
|
|
//}
|
|
/*************************************************************************************************/
|
|
/************************************* Scenario Setting ******************************************/
|
|
/*************************************************************************************************/
|
|
|
|
template<class T>
|
|
void MainWindow::datasetBranch(const string &branchPath, T datasetValue[MAX_ARRAY_DEPTH])
|
|
{
|
|
const H5std_string datasetPath(branchPath);
|
|
DataSet datasetType = _file.openDataSet(datasetPath);
|
|
|
|
datasetType.read(datasetValue, PredType::NATIVE_FLOAT, H5S_ALL, H5S_ALL);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::setScenario(const string &h5Path)
|
|
{
|
|
|
|
const H5std_string filePath(h5Path);
|
|
H5File file (filePath, H5F_ACC_RDONLY);
|
|
_file = file;
|
|
|
|
try
|
|
{
|
|
/****************** /sramParameters/frameType ******************/
|
|
datasetBranch <float_t>("/sramParameters/frameType", floatArray);
|
|
scenParams.frameType = static_cast<quint8>(floatArray[0]);
|
|
|
|
/****************** /sramParameters/totalTxShotNo ******************/
|
|
datasetBranch <float_t>("/sramParameters/totalTxShotNo", floatArray);
|
|
scenParams.totalTxShotNumber = static_cast<quint32>(floatArray[0]);
|
|
|
|
/******************* /sramParameters/focusTypeNo *******************/
|
|
datasetBranch <float_t>("/sramParameters/focusTypeNo", floatArray);
|
|
scenParams.focusTypeNumber = static_cast<quint32>(floatArray[0]);
|
|
|
|
/******************* /sramParameters/rxBeamformerNo *******************/
|
|
datasetBranch <float_t>("/sramParameters/rxBeamformerNo", floatArray);
|
|
scenParams.rxBeamFormerNumber.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxBeamFormerNumber.push_back(static_cast<quint8>(floatArray[var]));
|
|
|
|
// for(auto j=0; j<scenParams.focusTypeNumber; j++)
|
|
// {
|
|
// qDebug() << scenParams.rxBeamFormerNumber[j];
|
|
// }
|
|
|
|
/**************** /sramParameters/pulseInterval ********************/
|
|
datasetBranch <float_t>("/sramParameters/pulseInterval", floatArray);
|
|
scenParams.pulseInterval.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.pulseInterval.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/indexParameters/shotPropertiesIndex ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/shotPropertiesIndex", floatArray);
|
|
scenParams.indexParams.shotPropertiesIndex.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.shotPropertiesIndex.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/indexParameters/pulsePropertiesIndex ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/pulsePropertiesIndex", floatArray);
|
|
scenParams.indexParams.pulsePropertiesIndex.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.pulsePropertiesIndex.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/indexParameters/receiverConfigurationIndex ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/receiverConfigurationIndex", floatArray);
|
|
scenParams.indexParams.receiverConfigurationIndex.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.receiverConfigurationIndex.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/indexParameters/firstLineInFrame ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/firstLineInFrame", floatArray);
|
|
scenParams.indexParams.firstLineInFrame.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.firstLineInFrame.push_back(static_cast<bool>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/indexParameters/lastLineInFrame ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/lastLineInFrame", floatArray);
|
|
scenParams.indexParams.lastLineInFrame.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.lastLineInFrame.push_back(static_cast<bool>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/indexParameters/dLineNum ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/dLineNum", floatArray);
|
|
scenParams.indexParams.dLineNum.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.dLineNum.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/indexParameters/dEnsembleNum ********************/
|
|
datasetBranch <float_t>("/sramParameters/indexParameters/dEnsembleNum", floatArray);
|
|
scenParams.indexParams.dEnsembleNum.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.indexParams.dEnsembleNum.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/txParameters/txFocusXPos ********************/
|
|
datasetBranch <float_t>("/sramParameters/txParameters/txFocusXPos", floatArray);
|
|
scenParams.txParams.txFocusXPos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.txParams.txFocusXPos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/txParameters/txFocusYPos ********************/
|
|
datasetBranch <float_t>("/sramParameters/txParameters/txFocusYPos", floatArray);
|
|
scenParams.txParams.txFocusYPos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.txParams.txFocusYPos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/txParameters/txFocusZPos ********************/
|
|
datasetBranch <float_t>("/sramParameters/txParameters/txFocusZPos", floatArray);
|
|
scenParams.txParams.txFocusZPos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.txParams.txFocusZPos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/txParameters/txStartActiveElementNo ********************/
|
|
datasetBranch <float_t>("/sramParameters/txParameters/txStartActiveElementNo", floatArray);
|
|
scenParams.txParams.txStartActiveElementNumber.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.txParams.txStartActiveElementNumber.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/txParameters/txActiveElementNo ********************/
|
|
datasetBranch <float_t>("/sramParameters/txParameters/txActiveElementNo", floatArray);
|
|
scenParams.txParams.txActiveElementNumber.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.txParams.txActiveElementNumber.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/txParameters/maxDelayQ ********************/
|
|
datasetBranch <float_t>("/sramParameters/txParameters/maxDelayQ", floatArray);
|
|
scenParams.txParams.maxDelayQ.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.txParams.maxDelayQ.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/rxR0CenterActiveElementNo ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/rxR0CenterActiveElementNo", floatArray);
|
|
scenParams.rxParams.rxR0CenterActiveElementNumber.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.rxR0CenterActiveElementNumber.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/rxR0ActiveElementNo ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/rxR0ActiveElementNo", floatArray);
|
|
scenParams.rxParams.rxR0ActiveElementNumber.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.rxR0ActiveElementNumber.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/rxActiveElementStep ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/rxActiveElementStep", floatArray);
|
|
scenParams.rxParams.rxActiveElementStep.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.rxActiveElementStep.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/interceptPointFiringTime ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/interceptPointFiringTime", floatArray);
|
|
scenParams.rxParams.interceptPointFiringTime.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.interceptPointFiringTime.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/rxFocusPointNo ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/rxFocusPointNo", floatArray);
|
|
scenParams.rxParams.rxFocusPointNumber.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.rxFocusPointNumber.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/r0Position ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/r0Position", floatArray);
|
|
scenParams.rxParams.r0Position.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.r0Position.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/thetaCos ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/thetaCos", floatArray);
|
|
scenParams.rxParams.thetaCos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.thetaCos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/thetaSin ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/thetaSin", floatArray);
|
|
scenParams.rxParams.thetaSin.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.thetaSin.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/phiCos ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/phiCos", floatArray);
|
|
scenParams.rxParams.phiCos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.phiCos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/phiSin ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/phiSin", floatArray);
|
|
scenParams.rxParams.phiSin.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.phiSin.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/interceptXPos ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/interceptXPos", floatArray);
|
|
scenParams.rxParams.interceptXPos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.interceptXPos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/interceptYPos ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/interceptYPos", floatArray);
|
|
scenParams.rxParams.interceptYPos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.interceptYPos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/interceptZPos ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/interceptZPos", floatArray);
|
|
scenParams.rxParams.interceptZPos.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.interceptZPos.push_back(floatArray[var]);
|
|
|
|
/**************** /sramParameters/rxParameters/txR0MinDelayQ ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/txR0MinDelayQ", floatArray);
|
|
scenParams.rxParams.txR0MinDelayQ.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.txR0MinDelayQ.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/rxR0MinDelayQ ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/rxR0MinDelayQ", floatArray);
|
|
scenParams.rxParams.rxR0MinDelayQ.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.rxR0MinDelayQ.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /sramParameters/rxParameters/rxR0MaxDelayQ ********************/
|
|
datasetBranch <float_t>("/sramParameters/rxParameters/rxR0MaxDelayQ", floatArray);
|
|
scenParams.rxParams.rxR0MaxDelayQ.clear();
|
|
for (quint32 var = 0; var < scenParams.focusTypeNumber; var++)
|
|
scenParams.rxParams.rxR0MaxDelayQ.push_back(static_cast<quint32>(floatArray[var]));
|
|
|
|
/**************** /registerParameters/pulseTypeNo ********************/
|
|
datasetBranch <float_t>("/registerParameters/pulseTypeNo", floatArray);
|
|
scenParams.hwRegister.pulseTypeNumber = static_cast<quint8>(floatArray[0]);
|
|
|
|
/**************** /registerParameters/rxBeamformerTypeNo ********************/
|
|
datasetBranch <float_t>("/registerParameters/rxBeamformerTypeNo", floatArray);
|
|
scenParams.hwRegister.rxBeamFormerTypeNumber = static_cast<quint8>(floatArray[0]);
|
|
|
|
/**************** /registerParameters/receiverConfigTypeNo ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigTypeNo", floatArray);
|
|
scenParams.hwRegister.receiverConfigTypeNumber = static_cast<quint8>(floatArray[0]);
|
|
|
|
/**************** /registerParameters/blendWeight ********************/
|
|
datasetBranch <float_t>("/registerParameters/blendWeight", floatArray);
|
|
scenParams.hwRegister.blendWeight.clear();
|
|
QVector <float> tempBlendWeight;
|
|
|
|
for (quint32 i = 0; i < 4; i++)
|
|
{
|
|
tempBlendWeight.clear();
|
|
for (quint32 j = 0; j < 512; j++)
|
|
{
|
|
tempBlendWeight.push_back(floatArray[j + i * 512]);
|
|
}
|
|
scenParams.hwRegister.blendWeight.push_back(tempBlendWeight);
|
|
}
|
|
|
|
/**************** /registerParameters/freqLut ********************/
|
|
datasetBranch <float_t>("/registerParameters/freqLut", floatArray);
|
|
scenParams.hwRegister.freqLut.clear();
|
|
for (quint32 var = 0; var < 8; var++)
|
|
scenParams.hwRegister.freqLut.push_back(floatArray[var]);
|
|
|
|
/**************** /registerParameters/dTgcLut ********************/
|
|
datasetBranch <float_t>("/registerParameters/dTgcLut", floatArray);
|
|
scenParams.hwRegister.dtgcLut.clear();
|
|
for (quint32 var = 0; var < 1024; var++)
|
|
scenParams.hwRegister.dtgcLut.push_back(floatArray[var]);
|
|
|
|
/**************** /registerParameters/elementXPositions ********************/
|
|
datasetBranch <float_t>("/registerParameters/elementXPositions", floatArray);
|
|
scenParams.hwRegister.elementXPosition.clear();
|
|
for (quint32 var = 0; var < 192; var++)
|
|
scenParams.hwRegister.elementXPosition.push_back(floatArray[var]);
|
|
|
|
/**************** /registerParameters/elementYPositions ********************/
|
|
datasetBranch <float_t>("/registerParameters/elementYPositions", floatArray);
|
|
scenParams.hwRegister.elementYPosition.clear();
|
|
for (quint32 var = 0; var < 192; var++)
|
|
scenParams.hwRegister.elementYPosition.push_back(floatArray[var]);
|
|
|
|
/**************** /registerParameters/elementZPositions ********************/
|
|
datasetBranch <float_t>("/registerParameters/elementZPositions", floatArray);
|
|
scenParams.hwRegister.elementZPosition.clear();
|
|
for (quint32 var = 0; var < 192; var++)
|
|
scenParams.hwRegister.elementZPosition.push_back(floatArray[var]);
|
|
|
|
/**************** /registerParameters/scenarioStartIndex ********************/
|
|
datasetBranch <float_t>("/registerParameters/scenarioStartIndex", floatArray);
|
|
scenParams.hwRegister.scenarioStartIndex = static_cast<quint32>(floatArray[0]);
|
|
|
|
/**************** /registerParameters/scenarioEndIndex ********************/
|
|
datasetBranch <float_t>("/registerParameters/scenarioEndIndex", floatArray);
|
|
scenParams.hwRegister.scenarioEndIndex = static_cast<quint32>(floatArray[0]);
|
|
|
|
/**************** /registerParameters/apodizationLut ********************/
|
|
datasetBranch <float_t>("/registerParameters/apodizationLut", floatArray);
|
|
scenParams.hwRegister.apodizationLut.clear();
|
|
QVector <quint32> tempApodization;
|
|
|
|
for (quint32 i = 0; i < 4; i++)
|
|
{
|
|
tempApodization.clear();
|
|
for (quint32 j = 0; j < 3057; j++)
|
|
{
|
|
tempApodization.push_back(static_cast<quint32>(floatArray[j + i * 3057]));
|
|
}
|
|
scenParams.hwRegister.apodizationLut.push_back(tempApodization);
|
|
}
|
|
|
|
/**************** /registerParameters/aTgcLut ********************/
|
|
datasetBranch <float_t>("/registerParameters/aTgcLut", floatArray);
|
|
scenParams.hwRegister.atgcLut.clear();
|
|
QVector <quint32> tempAtgc;
|
|
|
|
for (quint32 i = 0; i < 4; i++)
|
|
{
|
|
tempAtgc.clear();
|
|
for (quint32 j = 0; j < 128; j++)
|
|
{
|
|
tempAtgc.push_back(static_cast<quint32>(floatArray[j + i * 128]));
|
|
}
|
|
scenParams.hwRegister.atgcLut.push_back(tempAtgc);
|
|
}
|
|
|
|
/**************** /registerParameters/lpfLut ********************/
|
|
datasetBranch <float_t>("/registerParameters/lpfLut", floatArray);
|
|
scenParams.hwRegister.lpfLut.clear();
|
|
QVector <quint32> tempLpf;
|
|
|
|
for (quint32 i = 0; i < 4; i++)
|
|
{
|
|
tempLpf.clear();
|
|
for (quint32 j = 0; j < 48; j++)
|
|
{
|
|
tempLpf.push_back(static_cast<quint32>(floatArray[j + i * 48]));
|
|
}
|
|
scenParams.hwRegister.lpfLut.push_back(tempLpf);
|
|
}
|
|
|
|
/**************** /registerParameters/pulseProperties/halfPeriod ********************/
|
|
datasetBranch <float_t>("/registerParameters/pulseProperties/halfPeriod", floatArray);
|
|
QList<quint32> halfPeriod;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++)
|
|
{
|
|
halfPeriod.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
|
|
/**************** /registerParameters/pulseProperties/halfCycleNo ********************/
|
|
datasetBranch <float_t>("/registerParameters/pulseProperties/halfCycleNo", floatArray);
|
|
QList<quint32> halfCycleNo;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++)
|
|
{
|
|
halfCycleNo.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/pulseProperties/pulseVoltSel ********************/
|
|
datasetBranch <float_t>("/registerParameters/pulseProperties/pulseVoltSel", floatArray);
|
|
QList<bool> pulseVoltSel;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++)
|
|
{
|
|
pulseVoltSel.push_back(static_cast<bool>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/pulseProperties/startPhase ********************/
|
|
datasetBranch <float_t>("/registerParameters/pulseProperties/startPhase", floatArray);
|
|
QList<bool> startPhase;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++)
|
|
{
|
|
startPhase.push_back(static_cast<bool>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/pulseProperties/dampingPulseWidth ********************/
|
|
datasetBranch <float_t>("/registerParameters/pulseProperties/dampingPulseWidth", floatArray);
|
|
QList<quint32> dampingPulseWidth;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.pulseTypeNumber; j++)
|
|
{
|
|
dampingPulseWidth.push_back(static_cast<quint32>(floatArray[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 <float_t>("/registerParameters/rxBeamformerProperties/mla", floatArray);
|
|
QList<quint32> mla;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++)
|
|
{
|
|
mla.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/rxBeamformerProperties/lag ********************/
|
|
datasetBranch <float_t>("/registerParameters/rxBeamformerProperties/lag", floatArray);
|
|
QList<quint32> lag;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++)
|
|
{
|
|
lag.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/rxBeamformerProperties/apodizationSel ********************/
|
|
datasetBranch <float_t>("/registerParameters/rxBeamformerProperties/apodizationSel", floatArray);
|
|
QList<quint32> apodizationSel;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.rxBeamFormerTypeNumber; j++)
|
|
{
|
|
apodizationSel.push_back(static_cast<quint32>(floatArray[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 <float_t>("/registerParameters/receiverConfigProperties/mla", floatArray);
|
|
QList<quint32> receiverCfgMla;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
receiverCfgMla.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/lineMode ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/lineMode", floatArray);
|
|
QList<quint32> lineMode;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
lineMode.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/aTgcSel ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/aTgcSel", floatArray);
|
|
QList<quint32> aTgcSel;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
aTgcSel.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/stbEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/stbEn", floatArray);
|
|
QList<quint32> stbEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
stbEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/stb ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/stb", floatArray);
|
|
QList<quint32> stb;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
stb.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/subtractFilterEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/subtractFilterEn", floatArray);
|
|
QList<quint32> subtractFilterEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
subtractFilterEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/dcCancelEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/dcCancelEn", floatArray);
|
|
QList<quint32> dcCancelEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
dcCancelEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/ncoFreqSel ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/ncoFreqSel", floatArray);
|
|
QList<quint32> ncoFreqSel;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
ncoFreqSel.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/lpfSel ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/lpfSel", floatArray);
|
|
QList<quint32> lpfSel;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
lpfSel.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/absEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/absEn", floatArray);
|
|
QList<quint32> absEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
absEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/focusNo ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/focusNo", floatArray);
|
|
QList<quint32> focusNo;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
focusNo.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/lineFilterEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/lineFilterEn", floatArray);
|
|
QList<quint32> lineFilterEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
lineFilterEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/dpeEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/dpeEn", floatArray);
|
|
QList<quint32> dpeEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
dpeEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/ddcEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/ddcEn", floatArray);
|
|
QList<quint32> ddcEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
ddcEn.push_back(static_cast<quint32>(floatArray[j]));
|
|
}
|
|
|
|
/**************** /registerParameters/receiverConfigProperties/wmfEn ********************/
|
|
datasetBranch <float_t>("/registerParameters/receiverConfigProperties/wmfEn", floatArray);
|
|
QList<quint32> wmfEn;
|
|
|
|
for (quint32 j = 0; j < scenParams.hwRegister.receiverConfigTypeNumber; j++)
|
|
{
|
|
wmfEn.push_back(static_cast<quint32>(floatArray[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 = ddcEn.at(j);
|
|
receiverCfgObj.absEn = absEn.at(j);
|
|
receiverCfgObj.dpeEn = dpeEn.at(j);
|
|
receiverCfgObj.stbEn = stbEn.at(j);
|
|
receiverCfgObj.wmfEn = wmfEn.at(j);
|
|
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);
|
|
}
|
|
|
|
|
|
|
|
_trx.setScenario(scenParams);
|
|
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
|
|
//QString saveFile = QFileDialog::getSaveFileName(this, "Save");
|
|
QString saveFile = "/home/hasis/Desktop/Develop_HardwareTest/saveSram.bin";
|
|
|
|
QFile sramFile(saveFile);
|
|
|
|
if (!sramFile.open(QIODevice::WriteOnly)){
|
|
QMessageBox::warning(this, "Warning", "Cann't save the file: " + sramFile.errorString());
|
|
return;
|
|
}
|
|
|
|
quint32 num(0);
|
|
quint64 value(0);
|
|
while (num < SRAM_SIZE/4)
|
|
{
|
|
value = _usd->device->device.readLong(BAR_SRAM, static_cast<quint32>(num));
|
|
sramFile.write(Uint2ByteArray<quint64>(value));
|
|
num += sizeof (quint64);
|
|
}
|
|
|
|
sramFile.flush();
|
|
sramFile.close();
|
|
|
|
ui->l_scenFillingDone->setText("done");
|
|
changeLabelTextColor(ui->l_scenFillingDone, Qt::green);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_h5Browse_clicked()
|
|
{
|
|
QFileDialog fileDialog;
|
|
fileDialog.setNameFilters({"Scenario file (*.h5)"});
|
|
auto result = fileDialog.exec();
|
|
|
|
if(result)
|
|
{
|
|
auto selectedPath = fileDialog.selectedFiles()[0];
|
|
ui->tb_h5File->setText(selectedPath);
|
|
_settings->setValue(SCENARIO_FILE_PATH, selectedPath);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_setScenario_clicked()
|
|
{
|
|
_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()
|
|
{
|
|
auto aTgcMode = ui->cb_aTgcMode->currentIndex();
|
|
auto aTgcValue = ui->tb_aTgcValue->text().toUInt();
|
|
|
|
if (aTgcMode == 0)
|
|
_trx.setAtgcMode(Auto, 0);
|
|
|
|
else
|
|
_trx.setAtgcMode(Manual, static_cast<quint16>(aTgcValue));
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
template<class T>
|
|
QByteArray MainWindow::Uint2ByteArray(T data)
|
|
{
|
|
QByteArray byte;
|
|
QDataStream out (&byte, QIODevice::WriteOnly);
|
|
out.setByteOrder(QDataStream::LittleEndian);
|
|
out << data;
|
|
|
|
return byte;
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/**************************************** 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<qint8>(((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<quint8>(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()
|
|
{
|
|
|
|
QString txtStr = ui->tb_trxRomWrite->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(txtStr);
|
|
trxEepromWrite(sendingArray, 0, _bCtrl);
|
|
|
|
}
|
|
catch (const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_trxRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
quint32 id = _trx.trxId();
|
|
ui->tb_trxRomIdRead->setText(uint2IdString(id));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_trxRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
QByteArray receivingArray = _trx.trxInfo();
|
|
ui->tb_trxRomInfoRead->setText(byteArray2InfoString(receivingArray));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_mpsRomWrite_clicked()
|
|
{
|
|
|
|
QString txtStr = ui->tb_mpsRomWrite->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(txtStr);
|
|
mpsEepromWrite(sendingArray, 0, _bCtrl);
|
|
|
|
}
|
|
catch (const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_mpsRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
quint32 id = _trx.mpsId();
|
|
ui->tb_mpsRomIdRead->setText(uint2IdString(id));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_mpsRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
QByteArray receivingArray = _trx.mpsInfo();
|
|
ui->tb_mpsRomInfoRead->setText(byteArray2InfoString(receivingArray));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_prbCtrlRomWrite_clicked()
|
|
{
|
|
|
|
QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(txtStr);
|
|
prbCtrlEepromWrite(sendingArray, 0, _bCtrl);
|
|
|
|
}
|
|
catch (const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbCtrlRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
quint32 id = _trx.prbCtrlId();
|
|
ui->tb_prbCtrlRomIdRead->setText(uint2IdString(id));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbCtrlRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
QByteArray receivingArray = _trx.prbCtrlInfo();
|
|
ui->tb_prbCtrlRomInfoRead->setText(byteArray2InfoString(receivingArray));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_prbRomWrite_clicked()
|
|
{
|
|
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
QString txtStr = ui->tb_prbRomWrite->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(txtStr);
|
|
prbEepromWrite(sendingArray, 0, static_cast<quint8>(sel), _bCtrl);
|
|
|
|
}
|
|
catch (const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbRomIdRead_clicked()
|
|
{
|
|
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
quint32 id(0);
|
|
try
|
|
{
|
|
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));
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
QByteArray receivingArray = _trx.prbInfo(static_cast<quint8>(sel));
|
|
ui->tb_prbRomInfoRead->setText(byteArray2InfoString(receivingArray));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*********************************** AFE Configuration *******************************************/
|
|
/*************************************************************************************************/
|
|
|
|
|
|
//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);
|
|
// }
|
|
|
|
// 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;
|
|
|
|
// try
|
|
// {
|
|
// _trx.setScenario(_scenParams);
|
|
// }
|
|
|
|
// catch(SonoException& e)
|
|
// {
|
|
// qDebug() << e.what();
|
|
// }
|
|
|
|
// ui->l_scenParams->setText("done");
|
|
// changeLabelTextColor(ui->l_scenParams, Qt::green);
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_afeRead_clicked()
|
|
{
|
|
auto sel = ui->cb_afeSlaveSelect->currentIndex();
|
|
auto offset = ui->tb_afeRegAddr->text().toUInt(nullptr, 16);
|
|
QList<quint32> afeArray;
|
|
afeArray.clear();
|
|
ui->tb_afeRegsValueArray->clear();
|
|
|
|
switch (sel)
|
|
{
|
|
case 0: afeArray = _trx.getAfeReg(slave0, offset); break;
|
|
case 1: afeArray = _trx.getAfeReg(slave1, offset); break;
|
|
case 2: afeArray = _trx.getAfeReg(slave2, offset); break;
|
|
}
|
|
|
|
for (quint8 i = 0; i < afeArray.size(); i++)
|
|
ui->tb_afeRegsValueArray->appendPlainText(QString::number((afeArray.at(i)), 16));
|
|
|
|
|
|
}
|
|
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::setAfeConfig()
|
|
{
|
|
_afeConfig.lowNf = lowNfDisable;
|
|
_afeConfig.lnaHpf = lnaHpfEnable;
|
|
_afeConfig.pgaHpf = pgaHpfEnable;
|
|
_afeConfig.lpfProg = LpfProg10MHz;
|
|
_afeConfig.pgaGain = pgaGain30db;
|
|
_afeConfig.pgaClamp = pgaClampDisable;
|
|
_afeConfig.powModes = lowNoise;
|
|
_afeConfig.actTermEn = actTermEnable;
|
|
_afeConfig.lnaGainGbl = lnaGainGbl24db;
|
|
_afeConfig.lnaHpfProg = lnaHpfProg200Khz;
|
|
_afeConfig.gblActiveTerm = gblActiveTerm50;
|
|
_afeConfig.pgaClampLevel = minus2dbfs;
|
|
_afeConfig.activeTermIndRes = actTermIndRes0;
|
|
_afeConfig.activeTermIndResEn = actTermIndResDisable;
|
|
_afeConfig.inputClampLevel = inputClampLvlAuto;
|
|
}
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_afeConfig_clicked()
|
|
{
|
|
_trx.setAfeConfig(_afeConfig);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|