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.
3112 lines
93 KiB
3112 lines
93 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;
|
|
_prb = new PrbCase;
|
|
|
|
movie = new QMovie("/home/hasis/Desktop/Develop_HardwareTest/gifs/Glass lines.gif");
|
|
ui->l_programming->hide();
|
|
|
|
_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_scenFilesPath->setText(_settings->value(SCENARIO_FILE_PATH).value<QString>());
|
|
|
|
ui->tb_trxRomId->setPlaceholderText("id(hex)");
|
|
ui->tb_trxRomInfo->setPlaceholderText("info");
|
|
ui->tb_mpsRomId->setPlaceholderText("id(hex)");
|
|
ui->tb_mpsRomInfo->setPlaceholderText("info");
|
|
ui->tb_prbCtrlRomId->setPlaceholderText("id(hex)");
|
|
ui->tb_prbCtrlRomInfo->setPlaceholderText("info");
|
|
ui->tb_prbRomIdRead->setPlaceholderText("id(hex)");
|
|
ui->tb_prbRomImpulseRead->setPlaceholderText("impulse");
|
|
|
|
//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(ui->action_Exit, &QAction::triggered, this, &MainWindow::exitApp);
|
|
connect(this, &MainWindow::showMessage, this, &MainWindow::newMessage);
|
|
connect(this, &MainWindow::connectedPrbChange, this, &MainWindow::getPrbChange);
|
|
connect(this, &MainWindow::frameLostCall, this, &MainWindow::getFrameLost);
|
|
connect(_timeout, &QTimer::timeout, this, &MainWindow::timeout);
|
|
connect(this, &MainWindow::scenarioReady, this, &MainWindow::setScenario);
|
|
connect(this, &MainWindow::labelState, this, &MainWindow::getLabelState);
|
|
connect(this, &MainWindow::fpgaProgrammer, this, &MainWindow::getFpgaProgrammer);
|
|
connect(this, &MainWindow::programmingGif, this, &MainWindow::getProgrammingGif);
|
|
|
|
//////////////////////// 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);
|
|
|
|
/////////////////// Scenario Verification Connections /////////////////////////
|
|
connect(&_trx, &TrxBoard::sramBinaryCreateFlag, this, &MainWindow::getSramBinaryCreateFlag);
|
|
connect(&_trx, &TrxBoard::registerCsvCompareFlag, this, &MainWindow::getRegisterCsvCompareFlag);
|
|
connect(&_trx, &TrxBoard::sramVerifyMessage, this, &MainWindow::getSramVerifyMessage);
|
|
|
|
ui->btn_updateRdbackValue->setText(UPDATE);
|
|
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);
|
|
|
|
//////////////////////////// First Time Probe Detection //////////////////////////////
|
|
#ifdef MPS_BOARD
|
|
emit connectedPrbChange();
|
|
#endif
|
|
|
|
QFont fontTitle;
|
|
fontTitle.setBold(true);
|
|
fontTitle.setItalic(true);
|
|
|
|
ui->table_probe->verticalHeaderItem(0)->setFont(fontTitle);
|
|
ui->table_probe->horizontalHeaderItem(0)->setFont(fontTitle);
|
|
ui->table_probe->horizontalHeaderItem(1)->setFont(fontTitle);
|
|
ui->table_probe->horizontalHeaderItem(2)->setFont(fontTitle);
|
|
ui->table_probe->horizontalHeaderItem(3)->setFont(fontTitle);
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
|
|
delete _settings;
|
|
|
|
delete _usd;
|
|
|
|
delete _timeout;
|
|
|
|
delete _healStatus;
|
|
|
|
delete _bCtrl;
|
|
|
|
delete _supRbValue;
|
|
|
|
delete _faultStatus;
|
|
|
|
delete _version;
|
|
|
|
delete _vec;
|
|
|
|
delete _emul;
|
|
|
|
delete movie;
|
|
}
|
|
|
|
///*************************************************************************************************/
|
|
//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();
|
|
//}
|
|
///*************************************************************************************************/
|
|
//#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::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 frameLost = _vec->frameLost;
|
|
ui->l_frameLost->setText(QVariant(frameLost).toString());
|
|
color = frameLost ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_frameLost, 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();
|
|
}
|
|
|
|
if(frameLost)
|
|
{
|
|
emit frameLostCall();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getPrbChange()
|
|
{
|
|
const quint32 id9L_D = 0x212;
|
|
const quint32 idC1_5_D = 0x225;
|
|
|
|
try
|
|
{
|
|
_trx.prbState(_prb);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
try
|
|
{
|
|
if(_prb->prbA.ConnectionMode == connected)
|
|
{
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::green, 0);
|
|
switch(_prb->prbA.id)
|
|
{
|
|
case id9L_D:
|
|
ui->table_probe->setItem(0, 0, new QTableWidgetItem("9L-D"));
|
|
break;
|
|
|
|
case idC1_5_D:
|
|
ui->table_probe->setItem(0, 0, new QTableWidgetItem("C1-5-D"));
|
|
break;
|
|
|
|
default:
|
|
ui->table_probe->setItem(0, 0, new QTableWidgetItem("Unknown"));
|
|
}
|
|
if(_prb->prbA.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe A eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ui->table_probe->setItem(0, 0, new QTableWidgetItem("Disconnected"));
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 0);
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
try
|
|
{
|
|
if(_prb->prbB.ConnectionMode == connected)
|
|
{
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::green, 1);
|
|
switch(_prb->prbB.id)
|
|
{
|
|
case id9L_D:
|
|
ui->table_probe->setItem(0, 1, new QTableWidgetItem("9L-D"));
|
|
break;
|
|
|
|
case idC1_5_D:
|
|
ui->table_probe->setItem(0, 1, new QTableWidgetItem("C1-5-D"));
|
|
break;
|
|
|
|
default:
|
|
ui->table_probe->setItem(0, 1, new QTableWidgetItem("Unknown"));
|
|
}
|
|
if(_prb->prbB.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe B eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ui->table_probe->setItem(0, 1, new QTableWidgetItem("Disconnected"));
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 1);
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
try
|
|
{
|
|
if(_prb->prbC.ConnectionMode == connected)
|
|
{
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::green, 2);
|
|
switch(_prb->prbC.id)
|
|
{
|
|
case id9L_D:
|
|
ui->table_probe->setItem(0, 2, new QTableWidgetItem("9L-D"));
|
|
break;
|
|
|
|
case idC1_5_D:
|
|
ui->table_probe->setItem(0, 2, new QTableWidgetItem("C1-5-D"));
|
|
break;
|
|
|
|
default:
|
|
ui->table_probe->setItem(0, 2, new QTableWidgetItem("Unknown"));
|
|
}
|
|
if(_prb->prbC.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe C eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ui->table_probe->setItem(0, 2, new QTableWidgetItem("Disconnected"));
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 2);
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
|
|
try
|
|
{
|
|
if(_prb->prbD.ConnectionMode == connected)
|
|
{
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::green, 3);
|
|
switch(_prb->prbD.id)
|
|
{
|
|
case id9L_D:
|
|
ui->table_probe->setItem(0, 3, new QTableWidgetItem("9L-D"));
|
|
break;
|
|
|
|
case idC1_5_D:
|
|
ui->table_probe->setItem(0, 3, new QTableWidgetItem("C1-5-D"));
|
|
break;
|
|
|
|
default:
|
|
ui->table_probe->setItem(0, 3, new QTableWidgetItem("Unknown"));
|
|
}
|
|
if(_prb->prbD.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe D eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ui->table_probe->setItem(0, 3, new QTableWidgetItem("Disconnected"));
|
|
QtConcurrent::run(this, &MainWindow::getProbeColor, Qt::red, 3);
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getFrameLost()
|
|
{
|
|
MESSAGE_BOX(QString::number(_trx.getFrameLostCounter(), 10));
|
|
//qDebug() << _trx.getFrameLostCounter();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getProbeColor(const QBrush brush, const int item)
|
|
{
|
|
ui->table_probe->item(0, item)->setBackground(brush);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//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::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::getFpgaProgrammer(QString path)
|
|
{
|
|
try
|
|
{
|
|
_trx.slaveFpgaProgram(path);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getProgrammingGif()
|
|
{
|
|
movie->setSpeed(100);
|
|
ui->l_programming->setMovie(movie);
|
|
ui->l_programming->show();
|
|
movie->start();
|
|
//ui->l_programming->update();
|
|
//qApp->processEvents();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getLabelState(QLabel *label, QString str, QColor color)
|
|
{
|
|
label->setText(str);
|
|
changeLabelTextColor(label, color);
|
|
label->repaint();
|
|
qApp->processEvents();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_fpgaProgram_clicked()
|
|
{
|
|
auto path = ui->tb_fpgaBit->text();
|
|
|
|
//emit programmingGif();
|
|
|
|
QString str = "doing";
|
|
QColor color = Qt::red;
|
|
emit labelState(ui->l_programDone, str, color);
|
|
|
|
emit fpgaProgrammer(path);
|
|
|
|
str = "done";
|
|
color = Qt::green;
|
|
emit labelState(ui->l_programDone, str, color);
|
|
|
|
//ui->l_programming->hide();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::newMessage(QString message)
|
|
{
|
|
QMessageBox msgBox;
|
|
msgBox.setText(message);
|
|
msgBox.exec();
|
|
}
|
|
|
|
///*************************************************************************************************/
|
|
//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::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;
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*********************************************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;
|
|
ui->btn_dmaShow->hide();
|
|
}
|
|
else
|
|
{
|
|
_dmaShow = false;
|
|
ui->btn_dmaShow->show();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
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->chk_continuousShowing->setChecked(false);
|
|
on_chk_continuousShowing_clicked();
|
|
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()
|
|
{
|
|
try
|
|
{
|
|
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);
|
|
file.close();
|
|
|
|
emit sendLogCount(_dmaLogCount, progress);
|
|
}
|
|
ui->btn_dmaLogLast->setText("InstantLog");
|
|
|
|
delete progress;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
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
|
|
ui->chk_mpsInit->setChecked(false);
|
|
}
|
|
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);
|
|
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
QString MainWindow::releaseCodeVersion(quint32& value)
|
|
{
|
|
QString str = QString::number(value, 10);
|
|
QList<QString> strList;
|
|
foreach(auto ch, str)
|
|
{
|
|
strList.push_back(ch);
|
|
}
|
|
str.clear();
|
|
str = strList[0] + strList[1] + "/" +
|
|
strList[2] + strList[3] + "/" +
|
|
strList[4] + strList[5] + " " +
|
|
strList[6] + strList[7] + ":" +
|
|
strList[8] + strList[9];
|
|
|
|
return str;
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_getFpgaVersion_clicked()
|
|
{
|
|
_trx.getFpgasCodeVersion(_version);
|
|
|
|
auto value = _version->masterCode;
|
|
ui->l_masterVersion->setText(releaseCodeVersion(value));
|
|
|
|
value = _version->slave0Code;
|
|
ui->l_slave0Version->setText(releaseCodeVersion(value));
|
|
|
|
value = _version->slave1Code;
|
|
ui->l_slave1Version->setText(releaseCodeVersion(value));
|
|
|
|
value = _version->slave2Code;
|
|
ui->l_slave2Version->setText(releaseCodeVersion(value));
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//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 ******************************************/
|
|
/*************************************************************************************************/
|
|
void MainWindow::setScenario(const string& h5Path)
|
|
{
|
|
Hdf5 hdf;
|
|
ScenGenHardwareOutput_t scenParams;
|
|
ScenPrbDepHardwareParam prbDepParams;
|
|
QVector<float> lineFilterLut;
|
|
QVector<quint32> stbLut;
|
|
|
|
hdf.hdf5Path(h5Path);
|
|
|
|
hdf.scenarioRead(scenParams);
|
|
hdf.prbDependParamsRead(prbDepParams);
|
|
prbDepParams.afeCfg = _afeConfig;
|
|
|
|
stbLut = hdf.stbRead();
|
|
lineFilterLut = hdf.lineFilterRead();
|
|
|
|
try
|
|
{
|
|
_trx.setScenario(scenParams);
|
|
_trx.setProbeDependParams(prbDepParams);
|
|
_trx.setLineFilterCoefficient(lineFilterLut);
|
|
_trx.setStbCoefficient(stbLut);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
ui->btn_scenStart->setText("Scenario Start");
|
|
ui->btn_emulator->setText("Emulator Start");
|
|
|
|
auto startIdx = _usd->readWord(0x804, 0);
|
|
auto endIdx = _usd->readWord(0x808, 0);
|
|
|
|
ui->tb_startIdx->setText(QString::number(startIdx, 16));
|
|
ui->tb_endIdx->setText(QString::number(endIdx, 16));
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_setScenario_clicked()
|
|
{
|
|
QString str = "doing";
|
|
QColor color = Qt::red;
|
|
emit labelState(ui->l_scenFillingDone, str, color);
|
|
|
|
QString sramScenario = "/scenGenOutput/scenario.h5";
|
|
QString h5Path = ui->tb_scenFilesPath->text() + sramScenario;
|
|
|
|
emit scenarioReady(h5Path.toStdString());
|
|
|
|
str = "done";
|
|
color = Qt::green;
|
|
emit labelState(ui->l_scenFillingDone, str, color);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getSramBinaryCreateFlag()
|
|
{
|
|
ui->l_createSramBinary->setText("done");
|
|
changeLabelTextColor(ui->l_createSramBinary, Qt::green);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getRegisterCsvCompareFlag()
|
|
{
|
|
ui->l_verifyRegisterParams->setText("done");
|
|
changeLabelTextColor(ui->l_verifyRegisterParams, Qt::green);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::getSramVerifyMessage(QString message)
|
|
{
|
|
ui->l_verifySramParams->setText("done");
|
|
changeLabelTextColor(ui->l_verifySramParams, Qt::green);
|
|
|
|
MESSAGE_BOX(message);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::setScenarioCompare(const QString& scenPath)
|
|
{
|
|
try
|
|
{
|
|
_trx.setScenarioCompare(scenPath);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
if(!(ui->l_verifySramParams->text() == "done"))
|
|
{
|
|
ui->l_verifySramParams->setText("failed");
|
|
changeLabelTextColor(ui->l_verifySramParams, Qt::red);
|
|
}
|
|
if(!(ui->l_verifyRegisterParams->text() == "done"))
|
|
{
|
|
ui->l_verifyRegisterParams->setText("failed");
|
|
changeLabelTextColor(ui->l_verifyRegisterParams, Qt::red);
|
|
}
|
|
if(!(ui->l_createSramBinary->text() == "done"))
|
|
{
|
|
ui->l_createSramBinary->setText("failed");
|
|
changeLabelTextColor(ui->l_createSramBinary, Qt::red);
|
|
}
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_setScenVerification_clicked()
|
|
{
|
|
ui->l_createSramBinary->setText("doing");
|
|
changeLabelTextColor(ui->l_createSramBinary, Qt::red);
|
|
|
|
ui->l_verifyRegisterParams->setText("doing");
|
|
changeLabelTextColor(ui->l_verifyRegisterParams, Qt::red);
|
|
|
|
ui->l_verifySramParams->setText("doing");
|
|
changeLabelTextColor(ui->l_verifySramParams, Qt::red);
|
|
|
|
const QString scenPath = ui->tb_scenFilesPath->text();
|
|
|
|
QtConcurrent::run(this, &MainWindow::setScenarioCompare, scenPath);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_scenBrowse_clicked()
|
|
{
|
|
QFileDialog fileDialog;
|
|
fileDialog.setFileMode(QFileDialog::Directory);
|
|
fileDialog.setOption(QFileDialog::ShowDirsOnly);
|
|
auto result = fileDialog.exec();
|
|
|
|
if(result)
|
|
{
|
|
auto selectedPath = fileDialog.selectedFiles()[0];
|
|
ui->tb_scenFilesPath->setText(selectedPath);
|
|
_settings->setValue(SCENARIO_FILE_PATH, selectedPath);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
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));
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_setIdx_clicked()
|
|
{
|
|
quint32 bar(0);
|
|
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;
|
|
}
|
|
|
|
if((endIndex < startIndex) || (endIndex > 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, endIndex);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/**************************************** 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 += "0" + QString::number(l, 16);
|
|
}
|
|
else
|
|
{
|
|
infoStr += QString::number(l, 16);
|
|
}
|
|
}
|
|
|
|
return infoStr;
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_trxRomIdWrite_clicked()
|
|
{
|
|
QString idStr = ui->tb_trxRomId->text();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(idStr);
|
|
trxEepromWrite(sendingArray, EEPROM_ID_BEGIN, _bCtrl);
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_trxRomInfoWrite_clicked()
|
|
{
|
|
QString infoStr = ui->tb_trxRomInfo->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = infoStr.toLatin1();
|
|
trxEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl);
|
|
//QByteArray sendingArray;
|
|
//unsigned char crcArray[] = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1,
|
|
//0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2,
|
|
//0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
|
//for(auto var : crcArray)
|
|
//sendingArray.push_back(static_cast<char>(var));
|
|
|
|
//trxEepromWrite(sendingArray, EEPROM_CRC_BEGIN, _bCtrl);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_trxRomIdRead_clicked()
|
|
{
|
|
EepromStatus romStatus;
|
|
try
|
|
{
|
|
_trx.trxState(romStatus);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_trxRomId->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the trx eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("Trx board is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_trxRomInfoRead_clicked()
|
|
{
|
|
try
|
|
{
|
|
QString receivingStr = _trx.trxInfo();
|
|
ui->tb_trxRomInfo->setText(receivingStr);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_mpsRomIdWrite_clicked()
|
|
{
|
|
QString idStr = ui->tb_mpsRomId->text();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(idStr);
|
|
mpsEepromWrite(sendingArray, EEPROM_ID_BEGIN, _bCtrl);
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_mpsRomInfoWrite_clicked()
|
|
{
|
|
QString infoStr = ui->tb_mpsRomInfo->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = infoStr.toLatin1();
|
|
mpsEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_mpsRomIdRead_clicked()
|
|
{
|
|
EepromStatus romStatus;
|
|
try
|
|
{
|
|
_trx.mpsState(romStatus);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_mpsRomId->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the mps eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("Mps board is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_mpsRomInfoRead_clicked()
|
|
{
|
|
try
|
|
{
|
|
QString receivingStr = _trx.mpsInfo();
|
|
ui->tb_mpsRomInfo->setText(receivingStr);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_prbCtrlRomIdWrite_clicked()
|
|
{
|
|
QString idStr = ui->tb_prbCtrlRomId->text();
|
|
try
|
|
{
|
|
QByteArray sendingArray = str2ByteArray(idStr);
|
|
prbCtrlEepromWrite(sendingArray, EEPROM_ID_BEGIN, _bCtrl);
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_prbCtrlRomInfoWrite_clicked()
|
|
{
|
|
QString infoStr = ui->tb_prbCtrlRomInfo->toPlainText();
|
|
try
|
|
{
|
|
QByteArray sendingArray = infoStr.toLatin1();
|
|
prbCtrlEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_prbCtrlRomIdRead_clicked()
|
|
{
|
|
EepromStatus romStatus;
|
|
try
|
|
{
|
|
_trx.prbCtrlState(romStatus);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_prbCtrlRomId->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the prbCtrl eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("PrbCtrl board is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_prbCtrlRomInfoRead_clicked()
|
|
{
|
|
try
|
|
{
|
|
QString receivingStr = _trx.prbCtrlInfo();
|
|
ui->tb_prbCtrlRomInfo->setText(receivingStr);
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_prbRomIdRead_clicked()
|
|
{
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
EepromStatus romStatus;
|
|
try
|
|
{
|
|
switch(sel)
|
|
{
|
|
case 0:
|
|
try
|
|
{
|
|
_trx.selectedPrbState(romStatus, prbA);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_prbRomIdRead->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe A eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("Probe A is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
break;
|
|
|
|
case 1:
|
|
try
|
|
{
|
|
_trx.selectedPrbState(romStatus, prbB);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_prbRomIdRead->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe B eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("Probe B is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
break;
|
|
|
|
case 2:
|
|
try
|
|
{
|
|
_trx.selectedPrbState(romStatus, prbC);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_prbRomIdRead->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe C eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("Probe C is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
break;
|
|
|
|
case 3:
|
|
try
|
|
{
|
|
_trx.selectedPrbState(romStatus, prbD);
|
|
if(romStatus.ConnectionMode == connected)
|
|
{
|
|
ui->tb_prbRomIdRead->setText(uint2IdString(romStatus.id));
|
|
if(romStatus.errorCode == EEPROM_CRC_ERROR)
|
|
{
|
|
throw"The crc error of the probe D eeprom is occured.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MESSAGE_BOX("Probe D is disconnected.");
|
|
}
|
|
}
|
|
catch(const char* exception)
|
|
{
|
|
qDebug() << exception;
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_prbRomImpulseRead_clicked()
|
|
{
|
|
try
|
|
{
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
QByteArray receivingArray = _trx.selectedPrbImpulseResponse(static_cast<quint8>(sel));
|
|
ui->tb_prbRomImpulseRead->setText(byteArray2InfoString(receivingArray));
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*********************************** AFE Configuration *******************************************/
|
|
/*************************************************************************************************/
|
|
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::exitApp()
|
|
{
|
|
this->QWidget::close();
|
|
}
|
|
|