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.
3299 lines
101 KiB
3299 lines
101 KiB
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
_settings = new QSettings("Hasis", "HwTester");
|
|
|
|
_usd = new UltraSoundDevice();
|
|
|
|
_timeout = new QTimer();
|
|
|
|
_healStatus = new HealthStatus;
|
|
_bCtrl = new BoardsCtrlMngt (_usd->device);
|
|
|
|
_supRbValue = new SupervisorRbValue;
|
|
_faultStatus = new MpsFaultStatus;
|
|
|
|
_version = new FpgaCodeVersion;
|
|
|
|
_vec = new StatusVec;
|
|
|
|
|
|
// 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");
|
|
// _colorMap = new QCPColorMap(ui->plot_2->xAxis,ui->plot_2->yAxis);
|
|
// 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);
|
|
// }
|
|
|
|
this->setFixedSize(this->width(),this->height());
|
|
|
|
// 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>());
|
|
|
|
// connect(this, &MainWindow::updateBlockProgressValue, this, &MainWindow::newBlockProgressValue);
|
|
// connect(this, &MainWindow::updateFpgaProgressValue, this, &MainWindow::newFpgaProgressValue);
|
|
// connect(this, &MainWindow::updateBlockProgressVisibility, this, &MainWindow::newBlockProgressVisibility);
|
|
// connect(this, &MainWindow::updateFpgaProgressVisibility, this, &MainWindow::newFpgaProgressVisibility);
|
|
|
|
//connect(this, &MainWindow::updateAdcLoggerProgressValue, this, &MainWindow::newAdcLoggerProgressValue);
|
|
//connect(this, &MainWindow::updateAdcLoggerProgressVisibility, this, &MainWindow::newAdcLoggerProgressVisibility);
|
|
|
|
connect(this, &MainWindow::showMessage, this, &MainWindow::newMessage);
|
|
connect(_timeout, &QTimer::timeout, this, &MainWindow::timeout);
|
|
|
|
// ui->btn_scenarioStartStop->setText(START);
|
|
// ui->btn_scenarioPauseResume->setText(PAUSE);
|
|
// ui->btn_txDacStartStop->setText(START);
|
|
// ui->btn_txDacOnOff->setText(ON);
|
|
// ui->btn_HVOnOff->setText(HV_ON);
|
|
// ui->btn_motorOnOff->setText(MOTOR_ON);
|
|
// ui->btn_pwr1OnOff->setText(PWR1_ON);
|
|
// ui->btn_pwr2OnOff->setText(PWR2_ON);
|
|
// ui->btn_pwr3OnOff->setText(PWR3_ON);
|
|
// ui->btn_pwr4OnOff->setText(PWR4_ON);
|
|
ui->btn_pllClkSt->setText(ON);
|
|
ui->btn_pllClkTps->setText(ON);
|
|
//ui->btn_mulDacTrig->setText(TRIG_ON);
|
|
//ui->btn_thsdStateUpdate->setText(THSD_State_Update);
|
|
// ui->btn_pwrDacsEnable->setText(VALID);
|
|
ui->btn_hvRegulatorConfig->setText(ENABLE);
|
|
ui->btn_pm5RegulatorConfig->setText(ENABLE);
|
|
// ui->btn_DacsOnOff->setText(DACS_ENABLE);
|
|
ui->btn_updateRdbackValue->setText(UPDATE);
|
|
// ui->btn_dmaStart_2->setText(START);
|
|
// ui->btn_dmaStop_2->setVisible(false);
|
|
// ui->btn_dmaLogLast->setVisible(false);
|
|
// ui->btn_adcLoggerStrt->setText(START);
|
|
// ui->btn_dbgTransferStrt->setText(START);
|
|
// ui->tb_adcLoggerPath->setText(_adcloggerFolder);
|
|
// ui->l_hvap->setText("0");
|
|
// ui->l_hvbp->setText("0");
|
|
// ui->l_cwdp->setText("0");
|
|
// ui->l_p24v->setText("0");
|
|
// ui->l_p12v->setText("0");
|
|
// ui->l_p5v->setText("0");
|
|
// ui->l_m5v->setText("0");
|
|
// ui->l_hvStop->setText("0");
|
|
// ui->l_curr24v->setText("0");
|
|
// ui->l_p4d->setText("0");
|
|
ui->l_detectedProbe->setText("None");
|
|
|
|
// if (pwr.getSetupCmdP24vOnOff())
|
|
// ui->chk_sup24v->setCheckState(Qt::CheckState::Checked);
|
|
|
|
// 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);
|
|
|
|
_trx.init();
|
|
|
|
_timeout->start(1000);
|
|
|
|
setReceiverConfiguration();
|
|
setBlendWeight();
|
|
setLineFilter();
|
|
setStbCoeff();
|
|
setFreqLut();
|
|
setDTgc();
|
|
setATgc();
|
|
setLpf();
|
|
|
|
setRxBeamformerPrp();
|
|
setPulseProperties();
|
|
//setAfeProperties();
|
|
setProbeElement();
|
|
setApodization();
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
|
|
delete _settings;
|
|
|
|
delete _usd;
|
|
|
|
delete _timeout;
|
|
|
|
delete _healStatus;
|
|
|
|
delete _bCtrl;
|
|
|
|
delete _supRbValue;
|
|
|
|
delete _faultStatus;
|
|
|
|
delete _version;
|
|
|
|
delete _vec;
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::binFileUploader(quint32 bar, quint32 offset, QString path, QProgressBar* prg)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if (!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open binary file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// const auto actualSize = file.size();
|
|
// auto readSize = 0;
|
|
// while(readSize < actualSize)
|
|
// {
|
|
// QByteArray chunk = file.read(8);
|
|
// auto value = byteArrayTo64LittleEndian(chunk);
|
|
// try
|
|
// {
|
|
// _usd->writeLong(offset + readSize, bar, value);
|
|
// auto rdValue = _usd->readLong(offset + readSize, bar);
|
|
// if (value != rdValue)
|
|
// {
|
|
// MESSAGE_BOX("Binary File Write Error");
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
|
|
// } catch (myexception e)
|
|
// {
|
|
// MESSAGE_BOX(e.what());
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// readSize += 8;
|
|
|
|
// auto percentage = (readSize * 100 / actualSize);
|
|
// emit updateBlockProgressValue(percentage, prg);
|
|
// }
|
|
|
|
// //MESSAGE_BOX("Binary file upload finished with success");
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::binAdcFileUploader(quint32 bar, QString path, QProgressBar* prg)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if (!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open binary file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// const auto actualSize = file.size();
|
|
// qint64 readSize = 0;
|
|
// quint32 addr = 0;
|
|
// quint32 data = 0;
|
|
// auto syncNum = 0;
|
|
// while((readSize < actualSize) & !_csvReadStopFlag)
|
|
// {
|
|
// QByteArray chunk = file.read(8);
|
|
// auto value = byteArrayTo64LittleEndian(chunk);
|
|
// try
|
|
// {
|
|
// addr = static_cast<quint32>(value >> 32);
|
|
// data = static_cast<quint32>(value & 0xFFFFFFFF);
|
|
|
|
// _usd->writeWord(addr, bar, data);
|
|
// if (addr != 3076)
|
|
// {
|
|
// qDebug() << syncNum << "==> " << addr << "::" << data;
|
|
// syncNum +=1;
|
|
|
|
// }
|
|
|
|
|
|
// } catch (myexception e)
|
|
// {
|
|
// MESSAGE_BOX(e.what());
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// readSize += 8;
|
|
// auto percentage = (readSize * 100 / actualSize);
|
|
// emit updateBlockProgressValue(percentage, prg);
|
|
// }
|
|
|
|
// //MESSAGE_BOX("Binary file upload finished with success");
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
//}
|
|
///*************************************************************************************************/
|
|
//void MainWindow::CsvFileUploader(quint32 bar, QString path, QProgressBar* prg)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if(!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open param file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// QString line;
|
|
// auto size = file.size();
|
|
// qint64 readSize = 0;
|
|
// while((readSize < size) & !_csvReadStopFlag)
|
|
// {
|
|
// line = file.readLine();
|
|
// auto sl = line.split(',');
|
|
// auto address = sl[0].toUInt(Q_NULLPTR, 16);
|
|
// auto value = sl[1].toUInt(Q_NULLPTR, 16);
|
|
// _usd->writeWord(address, bar, value);
|
|
// //qDebug() << _usd->readWord(address, bar);
|
|
// readSize += static_cast<qint64>(line.length());
|
|
// emit updateBlockProgressValue((readSize * 100 / size), prg);
|
|
// //delay(1);
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
//}
|
|
///*************************************************************************************************/
|
|
//void MainWindow::CsvFileChecker(quint32 bar, QString pathBase, QString pathTarget, QProgressBar* prg)
|
|
//{
|
|
// QFile baseFile(pathBase);
|
|
// QFile tragetFile(pathTarget);
|
|
|
|
// if(!baseFile.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open param file, aborting operation");
|
|
// return;
|
|
// }
|
|
// tragetFile.open(QFile::WriteOnly);
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// QString line;
|
|
// auto size = baseFile.size();
|
|
// qint64 readSize = 0;
|
|
// while(readSize < size)
|
|
// {
|
|
// line = baseFile.readLine();
|
|
// auto sl = line.split(',');
|
|
// auto address = sl[0].toUInt(Q_NULLPTR, 16);
|
|
// auto baseValue = sl[1].toUInt(Q_NULLPTR, 16);
|
|
// auto boardValue = _usd->readWord(address, bar);
|
|
// auto res = "NOK";
|
|
// if (boardValue == baseValue)
|
|
// {
|
|
// res = "OK";
|
|
// }
|
|
// auto str = QStringLiteral("%1,%2,%3,%4").arg(address, 8, 16, QLatin1Char('0')).arg(baseValue, 8, 16, QLatin1Char('0'))
|
|
// .arg(boardValue, 8, 16, QLatin1Char('0')).arg(res);
|
|
// tragetFile.write(str.toStdString().c_str(), str.length());
|
|
// tragetFile.write("\r\n", 2);
|
|
|
|
// readSize += static_cast<qint64>(line.length());
|
|
// emit updateBlockProgressValue((readSize * 100 / size), prg);
|
|
// //delay(1);
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// baseFile.close();
|
|
|
|
// tragetFile.close();
|
|
|
|
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//#define NO_AFE_CHANNEL 192
|
|
//#define NO_LOGGER_SMPL_COUNT 2048
|
|
//void MainWindow::AdcLogCsvFileWriter(QString folderPath, QProgressBar* prg)
|
|
//{
|
|
// quint32 bar = 0;
|
|
// quint32 offset = 0x2000;
|
|
// uint32_t offsetDbgTrsfr[3] = {0x140002*4,0x240002*4,0x340002*4};
|
|
// uint32_t offsetDbgTrsfrDone[3] = {0x14000A*4,0x24000A*4,0x34000A*4};
|
|
// _adcLoggerTrnsDone = false;
|
|
|
|
// QTime t = QTime::currentTime();
|
|
// QString path = folderPath + "/adcLog_" + QString("%1_%2_%3.csv").arg(t.hour()).arg(t.minute()).arg(t.second());
|
|
// QFile file(path);
|
|
// file.open(QIODevice::WriteOnly);
|
|
|
|
// emit updateBlockProgressVisibility(true, prg);
|
|
// emit updateBlockProgressValue(0, prg);
|
|
|
|
// auto timeOut = 0;
|
|
// quint32 doneFlag = 0;
|
|
// quint32 value = 0;
|
|
// quint32 fpgaNum = 0;
|
|
|
|
// offset = 0x4 * 4;
|
|
// auto gtSndMd = _usd->readWord(offset, bar);
|
|
// qDebug() << "--- SET GT Send Mode :: ADC Raw Logger --- ";
|
|
// _usd->writeWord(offset, bar, 0x2); // set GT Send mode (ADC Raw Logger)
|
|
|
|
// for (auto j = 0; j < 3; j+=1)
|
|
// _usd->writeWord(offsetDbgTrsfr[j], bar,0x0);
|
|
|
|
// for (quint16 i = 0; i < NO_AFE_CHANNEL; i += 1)
|
|
// {
|
|
// fpgaNum = (i / 64);
|
|
|
|
// offset = 0x400*4;// set adc logger stop
|
|
// value = (fpgaNum << 1);
|
|
// _usd->writeWord(offset, bar,value);
|
|
|
|
// value = value | 0x01;// set adc logger fpgaSel and start
|
|
// _usd->writeWord(offset, bar,value);
|
|
|
|
// _usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,0x0);
|
|
// value = i % 64;
|
|
// value = static_cast<quint32>(((static_cast<quint32>(0X01))) | ((static_cast<quint32>(value & 0xFF)) << 8));
|
|
// _usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,value);
|
|
|
|
// timeOut = 0;
|
|
// doneFlag = 0;
|
|
// while (timeOut < 10 && doneFlag == 0 )
|
|
// {
|
|
// doneFlag = ((_usd->readWord(offsetDbgTrsfrDone[fpgaNum], bar)) & 0x100) >> 8; // wait Until transfer done
|
|
// timeOut += 1;
|
|
// delay(2);
|
|
// }
|
|
// if(timeOut == 10)
|
|
// {
|
|
// qDebug() << "Unable to transfer done";
|
|
// //MESSAGE_BOX("Unable to transfer done");
|
|
// //return;
|
|
// }
|
|
|
|
// doneFlag = 0;
|
|
// timeOut = 0;
|
|
// offset = 0x401*4;
|
|
// while (timeOut < 10 && doneFlag == 0 )
|
|
// {
|
|
// doneFlag = (_usd->readWord(offset, bar) & 0x1); // wait until adc logger MemDone Flag true
|
|
// timeOut += 1;
|
|
// delay(2);
|
|
// }
|
|
// if(timeOut == 10)
|
|
// {
|
|
// //MESSAGE_BOX("Unable to reach adc logger memory done");
|
|
// qDebug() << "Unable to reach adc logger memory done :: 0x" << _usd->readWord(offset, bar);
|
|
// //return;
|
|
// }
|
|
|
|
// _usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,0); // Stop Debug transfer
|
|
|
|
// offset = 0x2000;
|
|
// qint16 val = 0;
|
|
// for(auto j = 0; j < NO_LOGGER_SMPL_COUNT; j += 1)
|
|
// {
|
|
// value = _usd->readWord(offset, bar); // Read Adc logger Bram
|
|
|
|
// val = static_cast<qint16>(value & 0x3FFF) << 2;
|
|
// val = val >> 2;
|
|
// auto str = QStringLiteral("%1,").arg(val);
|
|
// file.write(str.toStdString().c_str(), str.length());
|
|
|
|
// offset += 4;
|
|
// }
|
|
// file.write("\r\n", 2);
|
|
|
|
// value = (fpgaNum << 1) | 0x00;// set adc logger fpgaSel and Stop
|
|
// offset = 0x400*4;
|
|
// _usd->writeWord(offset, bar,value);
|
|
|
|
// emit updateBlockProgressValue(i * 100 / NO_AFE_CHANNEL, prg);
|
|
// delay(10);
|
|
|
|
// }
|
|
// offset = 0x400*4;
|
|
// _usd->writeWord(offset, bar,0x0);
|
|
|
|
// qDebug() << "--- SET GT Send Mode :: Previous Mode --- ";
|
|
// offset = 0x4 * 4;
|
|
// _usd->writeWord(offset, bar, gtSndMd); // set GT Send mode
|
|
// emit updateBlockProgressVisibility(false, prg);
|
|
|
|
// file.close();
|
|
// _adcLoggerTrnsDone = true;
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::scenarioFileVerifier(quint32 bar, quint32 offset, QString path)
|
|
//{
|
|
// QFile file(path);
|
|
|
|
// if (!file.open(QFile::ReadOnly))
|
|
// {
|
|
// MESSAGE_BOX("Could not open binary file, aborting operation");
|
|
// return;
|
|
// }
|
|
|
|
// emit updateBlockProgressVisibility(true, ui->prg_scenarioUpload);
|
|
// emit updateBlockProgressValue(0, ui->prg_scenarioUpload);
|
|
|
|
// const auto actualSize = file.size();
|
|
// auto readSize = 0;
|
|
// while(readSize < actualSize)
|
|
// {
|
|
// QByteArray chunk = file.read(8);
|
|
// auto value = byteArrayTo64LittleEndian(chunk);
|
|
// try
|
|
// {
|
|
// auto data = _usd->readLong(offset + readSize, bar);
|
|
// if(data != value)
|
|
// {
|
|
// auto message = QString("Error in data @ offset 0x%1, expected 0x%2 saw 0x%3")
|
|
// .arg(QString::number(offset + readSize))
|
|
// .arg(QString::number(value, 16))
|
|
// .arg(QString::number(data, 16));
|
|
// MESSAGE_BOX(message);
|
|
|
|
// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// }
|
|
// catch (myexception e)
|
|
// {
|
|
// MESSAGE_BOX(e.what());
|
|
|
|
// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload);
|
|
|
|
// file.close();
|
|
|
|
// return;
|
|
// }
|
|
// readSize += 8;
|
|
|
|
// auto percentage = (readSize * 100 / actualSize);
|
|
// emit updateBlockProgressValue(percentage, ui->prg_scenarioUpload);
|
|
// }
|
|
|
|
// MESSAGE_BOX("Binary verified with success");
|
|
|
|
// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload);
|
|
|
|
// file.close();
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::fpgaProgrammer(QString path)
|
|
{
|
|
try
|
|
{
|
|
_trx.slaveFpgaProgram(path);
|
|
ui->l_programDone->setText("done");
|
|
changeLabelTextColor(ui->l_programDone, Qt::green);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//quint64 MainWindow::byteArrayTo64LittleEndian(QByteArray data)
|
|
//{
|
|
// quint64 temp = 0;
|
|
|
|
// temp = ((static_cast<quint64>(data[0])) & 0x00000000000000FF) |
|
|
// (((static_cast<quint64>(data[1])) << 8) & 0x000000000000FF00) |
|
|
// (((static_cast<quint64>(data[2])) << 16) & 0x0000000000FF0000) |
|
|
// (((static_cast<quint64>(data[3])) << 24) & 0x00000000FF000000) |
|
|
// (((static_cast<quint64>(data[4])) << 32) & 0x000000FF00000000) |
|
|
// (((static_cast<quint64>(data[5])) << 40) & 0x0000FF0000000000) |
|
|
// (((static_cast<quint64>(data[6])) << 48) & 0x00FF000000000000) |
|
|
// (((static_cast<quint64>(data[7])) << 56) & 0xFF00000000000000);
|
|
|
|
// return temp;
|
|
//}
|
|
/*************************************************************************************************/
|
|
//quint32 MainWindow::byteArrayTo32LittleEndian(QByteArray data)
|
|
//{
|
|
// quint32 temp = 0;
|
|
|
|
// temp = ((static_cast<quint32>(data[0])) & 0x000000FF) |
|
|
// (((static_cast<quint32>(data[1])) << 8) & 0x0000FF00) |
|
|
// (((static_cast<quint32>(data[2])) << 16) & 0x00FF0000) |
|
|
// (((static_cast<quint32>(data[3])) << 24) & 0xFF000000) ;
|
|
|
|
// return temp;
|
|
//}
|
|
///*************************************************************************************************/
|
|
//quint32 MainWindow::byteArrayTo32BigEndian(QByteArray data)
|
|
//{
|
|
// quint32 temp = 0;
|
|
|
|
// temp = (data[3] & 0x000000FF) |
|
|
// ((data[2] << 8) & 0x0000FF00) |
|
|
// ((data[1] << 16) & 0x00FF0000) |
|
|
// ((data[0] << 24) & 0xFF000000);
|
|
|
|
// return temp;
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::timeout()
|
|
{
|
|
//auto pcie_id = _usd->readWord(0, 2);
|
|
|
|
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(1);
|
|
|
|
bool probeADetected=_bCtrl->getConnectedPrb().at(0);
|
|
bool probeBDetected=_bCtrl->getConnectedPrb().at(1);
|
|
bool probeCDetected=_bCtrl->getConnectedPrb().at(2);
|
|
bool probeDDetected=_bCtrl->getConnectedPrb().at(3);
|
|
|
|
if(probeDDetected == true){
|
|
ui->l_detectedProbe->setText("D");
|
|
}
|
|
else if (probeCDetected == true) {
|
|
ui->l_detectedProbe->setText("C");
|
|
}
|
|
else if (probeBDetected == true) {
|
|
ui->l_detectedProbe->setText("B");
|
|
}
|
|
else if (probeADetected == true) {
|
|
ui->l_detectedProbe->setText("A");
|
|
}
|
|
else{
|
|
ui->l_detectedProbe->setText("None");
|
|
}
|
|
|
|
delay(1);
|
|
|
|
_trx.getHealthStatus(_healStatus);
|
|
delay(10);
|
|
/******************* System Monitoring *********************/
|
|
|
|
float tempSensor = _healStatus->systemTemperature;
|
|
ui->l_Temp->setText(QString("%1").arg(static_cast<double>(tempSensor)));
|
|
delay(1);
|
|
|
|
auto adcCh1 = _healStatus->adcMon->mon12Vin;
|
|
ui->l_adcCh1->setText(QString("%1").arg(static_cast<double>(adcCh1)));
|
|
delay(1);
|
|
|
|
auto adcCh2 = _healStatus->adcMon->mon5Vin;
|
|
ui->l_adcCh2->setText(QString("%1").arg(static_cast<double>(adcCh2)));
|
|
delay(1);
|
|
|
|
auto adcCh3 = _healStatus->adcMon->prbZeroEncoder;
|
|
ui->l_adcCh3->setText(QString("%1").arg(static_cast<double>(adcCh3)));
|
|
delay(1);
|
|
|
|
auto adcCh4 = _healStatus->adcMon->prbCtrl3P3V;
|
|
ui->l_adcCh4->setText(QString("%1").arg(static_cast<double>(adcCh4)));
|
|
delay(1);
|
|
|
|
auto adcCh5 = _healStatus->adcMon->afeVcntlp;
|
|
ui->l_adcCh5->setText(QString("%1").arg(static_cast<double>(adcCh5)));
|
|
delay(1);
|
|
|
|
auto adcCh6 = _healStatus->adcMon->mon3P3V;
|
|
ui->l_adcCh6->setText(QString("%1").arg(static_cast<double>(adcCh6)));
|
|
delay(1);
|
|
|
|
auto adcCh7 = _healStatus->adcMon->monAfeA1P8V;
|
|
ui->l_adcCh7->setText(QString("%1").arg(static_cast<double>(adcCh7)));
|
|
delay(1);
|
|
|
|
auto adcCh8 = _healStatus->adcMon->monAfeD1P8V;
|
|
ui->l_adcCh8->setText(QString("%1").arg(static_cast<double>(adcCh8)));
|
|
delay(1);
|
|
|
|
/******************* Power Good *********************/
|
|
|
|
auto regAPg = _healStatus->voltsPg->regulatorA;
|
|
ui->l_pgRegA->setText(enum2String(regAPg));
|
|
delay(1);
|
|
|
|
auto regBPg = _healStatus->voltsPg->regulatorB;
|
|
ui->l_pgRegB->setText(enum2String(regBPg));
|
|
delay(1);
|
|
|
|
auto pg12v = _healStatus->voltsPg->mon12Vin;
|
|
ui->l_pg12Vin->setText(enum2String(pg12v));
|
|
delay(1);
|
|
|
|
auto pg5v = _healStatus->voltsPg->mon5Vin;
|
|
ui->l_pg5Vin->setText(enum2String(pg5v));
|
|
delay(1);
|
|
|
|
auto Pg3P3 = _healStatus->voltsPg->mon3P3V;
|
|
ui->l_pg3P3->setText(enum2String(Pg3P3));
|
|
delay(1);
|
|
|
|
auto pgAvdd = _healStatus->voltsPg->monAfeA1P8V;
|
|
ui->l_pg1P8Avdd->setText(enum2String(pgAvdd));
|
|
delay(1);
|
|
|
|
auto pgDvdd = _healStatus->voltsPg->monAfeD1P8V;
|
|
ui->l_pg1P8Dvdd->setText(enum2String(pgDvdd));
|
|
delay(1);
|
|
|
|
auto pgPrbCtrl = _healStatus->voltsPg->prbCtrl3P3V;
|
|
ui->l_pgPrbCtrl3P3->setText(enum2String(pgPrbCtrl));
|
|
delay(1);
|
|
|
|
/******************* 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(1);
|
|
|
|
bool mpsErr=_vec->mpsErr;
|
|
ui->l_mps->setText(QVariant(mpsErr).toString());
|
|
color = mpsErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_mps, color);
|
|
delay(1);
|
|
|
|
bool fanFault=_vec->fanFault;
|
|
ui->l_fan->setText(QVariant(fanFault).toString());
|
|
color = fanFault ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_fan, color);
|
|
delay(1);
|
|
|
|
bool pulserThd=_vec->pulserThd;
|
|
ui->l_pulserThd->setText(QVariant(pulserThd).toString());
|
|
color = pulserThd ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_pulserThd, color);
|
|
delay(1);
|
|
|
|
bool scenGtErr=_vec->scenGtErr;
|
|
ui->l_scenGt->setText(QVariant(scenGtErr).toString());
|
|
color = scenGtErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_scenGt, color);
|
|
delay(1);
|
|
|
|
bool scenPriErr=_vec->scenPriErr;
|
|
ui->l_scenPri->setText(QVariant(scenPriErr).toString());
|
|
color = scenPriErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_scenPri, color);
|
|
delay(1);
|
|
|
|
bool thermalErr=_vec->thermalErr;
|
|
ui->l_thermal->setText(QVariant(thermalErr).toString());
|
|
color = thermalErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_thermal, color);
|
|
delay(1);
|
|
|
|
bool scenSramErr=_vec->scenSramErr;
|
|
ui->l_scenSram->setText(QVariant(scenSramErr).toString());
|
|
color = scenSramErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_scenSram, color);
|
|
delay(1);
|
|
|
|
bool syncFifoErr=_vec->syncFifoErr;
|
|
ui->l_syncFifo->setText(QVariant(syncFifoErr).toString());
|
|
color = syncFifoErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_syncFifo, color);
|
|
delay(1);
|
|
|
|
bool syncPointErr=_vec->syncPointErr;
|
|
ui->l_syncPoint->setText(QVariant(syncPointErr).toString());
|
|
color = syncPointErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_syncPoint, color);
|
|
delay(1);
|
|
|
|
bool dintrlvFifoErr=_vec->dintrlvFifoErr;
|
|
ui->l_dintrlvFifo->setText(QVariant(dintrlvFifoErr).toString());
|
|
color = dintrlvFifoErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_dintrlvFifo, color);
|
|
delay(1);
|
|
|
|
bool dintrlvPointErr=_vec->dintrlvPointErr;
|
|
ui->l_dintrlvPoint->setText(QVariant(dintrlvPointErr).toString());
|
|
color = dintrlvPointErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_dintrlvPoint, color);
|
|
delay(1);
|
|
|
|
bool sram1ParityErr=_vec->sram1ParityErr;
|
|
ui->l_sram1Parity->setText(QVariant(sram1ParityErr).toString());
|
|
color = sram1ParityErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_sram1Parity, color);
|
|
delay(1);
|
|
|
|
bool sram2ParityErr=_vec->sram2ParityErr;
|
|
ui->l_sram2Parity->setText(QVariant(sram2ParityErr).toString());
|
|
color = sram2ParityErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_sram2Parity, color);
|
|
delay(1);
|
|
|
|
bool dmaCtrlTransferErr=_vec->dmaCtrlTransferErr;
|
|
ui->l_DmaCtrlTrans->setText(QVariant(dmaCtrlTransferErr).toString());
|
|
color = dmaCtrlTransferErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_DmaCtrlTrans, color);
|
|
delay(1);
|
|
|
|
bool emulDmaTransferErr=_vec->emulDmaTransferErr;
|
|
ui->l_emulDmaTrans->setText(QVariant(emulDmaTransferErr).toString());
|
|
color = emulDmaTransferErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_emulDmaTrans, color);
|
|
delay(1);
|
|
|
|
bool probeDisconnectErr=_vec->probeDisconnectErr;
|
|
ui->l_prbDiscon->setText(QVariant(probeDisconnectErr).toString());
|
|
color = probeDisconnectErr ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_prbDiscon, color);
|
|
delay(1);
|
|
|
|
bool probeDetChanInterrupt=_vec->probeDetChanInterrupt;
|
|
ui->l_prbDetChg->setText(QVariant(probeDetChanInterrupt).toString());
|
|
color = probeDetChanInterrupt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_prbDetChg, color);
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::scenarioStart()
|
|
//{
|
|
// auto value = 0x1;
|
|
// _usd->writeWord(0x800, 0, value);
|
|
|
|
// qDebug() << "--- SET GT Send Mode :: BF --- ";
|
|
// _usd->writeWord(0x10, 0, 0x1);
|
|
|
|
// auto bar = 0;
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// uint32_t offsetDbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4};
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value | 0x2);
|
|
// }
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetDbgCmd[i], 0);
|
|
// value &= 0xFFFFFFF0;
|
|
// _usd->writeWord(offsetDbgCmd[i], 0, value);
|
|
// }
|
|
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::scenarioStop()
|
|
//{
|
|
// auto value = 0x0;
|
|
// _usd->writeWord(0x800, 0, value);
|
|
|
|
// auto bar = 0;
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// delay(10);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value & 0x1);
|
|
// }
|
|
//}
|
|
|
|
//bool MainWindow::checkTermalShutdown(quint8 value)
|
|
//{
|
|
// return value == 0x0F;
|
|
//}
|
|
|
|
void MainWindow::changeLabelTextColor(QLabel *label, QColor color)
|
|
{
|
|
auto palette = label->palette();
|
|
palette.setColor(QPalette::Foreground, color);
|
|
label->setAutoFillBackground(true);
|
|
label->setPalette(palette);
|
|
label->update();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_rbtn_reg_toggled(bool checked)
|
|
{
|
|
if(checked)
|
|
{
|
|
_settings->setValue(REG_ACCESS_SEL, true);
|
|
|
|
|
|
|
|
ui->l_regIndicator->setText("Register number: (Hex)");
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_rbtn_offset_toggled(bool checked)
|
|
{
|
|
if(checked)
|
|
{
|
|
_settings->setValue(REG_ACCESS_SEL, false);
|
|
ui->l_regIndicator->setText("Register offset: (Hex)");
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_readReg_clicked()
|
|
{
|
|
auto bar = ui->cb_regBarNum->currentText().toUInt();
|
|
|
|
auto offset = ui->tb_regIndicator->text().toUInt(Q_NULLPTR, 16);
|
|
if(offset == 0 && ui->tb_regIndicator->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for offset");
|
|
return;
|
|
}
|
|
|
|
quint64 value = 0;
|
|
auto width = ui->cb_regWidth->currentIndex();
|
|
switch(width)
|
|
{
|
|
case 0:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 4;
|
|
value = _usd->readWord(offset, bar);
|
|
ui->lcd_regvalue->setDigitCount(8);
|
|
break;
|
|
case 1:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 8;
|
|
value = _usd->readLong(offset, bar);
|
|
ui->lcd_regvalue->setDigitCount(16);
|
|
break;
|
|
}
|
|
|
|
ui->lcd_regvalue->display(QString::number(value, 16));
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_writeReg_clicked()
|
|
{
|
|
auto bar = ui->cb_regBarNum->currentText().toUInt();
|
|
|
|
auto offset = ui->tb_regIndicator->text().toUInt(Q_NULLPTR, 16);
|
|
if(offset == 0 && ui->tb_regIndicator->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for offset");
|
|
return;
|
|
}
|
|
|
|
auto value = ui->tb_regValue->text().toULong(Q_NULLPTR, 16);
|
|
if(value == 0 && ui->tb_regValue->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for write value");
|
|
return;
|
|
}
|
|
|
|
auto width = ui->cb_regWidth->currentIndex();
|
|
switch(width)
|
|
{
|
|
case 0:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 4;
|
|
_usd->writeWord(offset, bar, static_cast<quint32>(value));
|
|
break;
|
|
case 1:
|
|
if(ui->rbtn_reg->isChecked())
|
|
offset *= 8;
|
|
_usd->writeLong(offset, bar, value);
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::newBlockProgressValue(int percentage, QProgressBar* prg)
|
|
//{
|
|
// prg->setValue(percentage);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::newFpgaProgressValue(int percentage)
|
|
//{
|
|
// ui->prg_fpgaProgram->setValue(percentage);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::newBlockProgressVisibility(bool show, QProgressBar* prg)
|
|
//{
|
|
// prg->setVisible(show);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::newFpgaProgressVisibility(bool show)
|
|
//{
|
|
// ui->prg_fpgaProgram->setVisible(show);
|
|
//}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_fpgaBrowse_clicked()
|
|
{
|
|
QFileDialog fileDialog;
|
|
fileDialog.setNameFilters({"FPGA program file (*.bit)"});
|
|
auto result = fileDialog.exec();
|
|
|
|
if(result)
|
|
{
|
|
auto selectedPath = fileDialog.selectedFiles()[0];
|
|
ui->tb_fpgaBit->setText(selectedPath);
|
|
_settings->setValue(FPGA_FILE_PATH, selectedPath);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_fpgaProgram_clicked()
|
|
{
|
|
ui->l_programDone->setText("doing");
|
|
changeLabelTextColor(ui->l_programDone, Qt::red);
|
|
|
|
auto path = ui->tb_fpgaBit->text();
|
|
|
|
//return;
|
|
|
|
//catch (SonoException& e) {
|
|
// qDebug() << e.what();
|
|
//
|
|
//}
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
|
|
QtConcurrent::run(this, &MainWindow::fpgaProgrammer, path);
|
|
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::newMessage(QString message)
|
|
{
|
|
QMessageBox msgBox;
|
|
msgBox.setText(message);
|
|
msgBox.exec();
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
//void MainWindow::threadFinished()
|
|
//{
|
|
// _dial->close();
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//QString MainWindow::WhichFpgaFailed(quint32 status)
|
|
//{
|
|
// status = (status >> 12) & 0x07;
|
|
// QString failedFpga = "";
|
|
|
|
// if((status & 0x01) == 0)
|
|
// {
|
|
// failedFpga += "FPGA0 ";
|
|
// }
|
|
// if((status & 0x02) == 0)
|
|
// {
|
|
// failedFpga += "FPGA1 ";
|
|
// }
|
|
// if((status & 0x04) == 0)
|
|
// {
|
|
// failedFpga += "FPGA2";
|
|
// }
|
|
|
|
// return failedFpga;
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"SRAM binary file (*.bin)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_scenarioFile->setText(selectedPath);
|
|
// _settings->setValue(SCENARIO_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioVerify_clicked()
|
|
//{
|
|
// auto bar = 1;
|
|
|
|
// auto offset = 0;
|
|
|
|
// auto path = ui->tb_scenarioFile->text();
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::scenarioFileVerifier, bar, offset, path);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_ParamBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"Scenario param file (*.csv)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_paramFile->setText(selectedPath);
|
|
// _settings->setValue(PARAM_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioUpload_clicked()
|
|
//{
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// auto bar = 0;
|
|
|
|
// auto scenarioBar = 1;
|
|
// auto paramBar = 0;
|
|
|
|
// auto scenarioOffset = 0;
|
|
|
|
// auto scenarioPath = ui->tb_scenarioFile->text();
|
|
// auto paramPath = ui->tb_paramFile->text();
|
|
|
|
// scenarioStop();
|
|
|
|
// qDebug() << "--- Clear Scen Register Valid Register --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, 0X0);
|
|
// }
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::binFileUploader, scenarioBar, scenarioOffset, scenarioPath, ui->prg_scenarioUpload);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
|
|
// _csvReadStopFlag = false;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// future = QtConcurrent::run(this, &MainWindow::CsvFileUploader, paramBar, paramPath, ui->prg_scenarioUpload);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
|
|
|
|
|
|
// qDebug() << "--- SET Scen Register Valid Register --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, 0X1);
|
|
// }
|
|
|
|
// qDebug() << "--- SET GT Send Mode :: BF --- ";
|
|
// _usd->writeWord(0x4*4, bar, 0X1);
|
|
// delay(20);
|
|
|
|
|
|
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioStartStop_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// //auto offset = 0;
|
|
|
|
// auto startIndex = ui->tb_startIndex->text().toUInt(Q_NULLPTR, 16);
|
|
// if(startIndex == 0 && ui->tb_startIndex->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for start index");
|
|
// return;
|
|
// }
|
|
|
|
// auto stopIndex = ui->tb_stopIndex->text().toUInt(Q_NULLPTR, 16);
|
|
// if(stopIndex == 0 && ui->tb_stopIndex->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 str = ui->btn_scenarioStartStop->text();
|
|
// if(str == START)
|
|
// {
|
|
// ui->btn_scenarioStartStop->setText(STOP);
|
|
// scenarioStart();
|
|
// }
|
|
// else
|
|
// {
|
|
// ui->btn_scenarioStartStop->setText(START);
|
|
// scenarioStop();
|
|
// }
|
|
//}
|
|
|
|
void MainWindow::on_btn_scenStart_clicked()
|
|
{
|
|
try
|
|
{
|
|
auto str = ui->btn_scenStart->text();
|
|
if(str == "Scenario Start")
|
|
{
|
|
_trx.scenPlayerStart();
|
|
ui->btn_scenStart->setText("Scenario Stop");
|
|
}
|
|
else
|
|
{
|
|
_trx.scenPlayerStop();
|
|
ui->btn_scenStart->setText("Scenario Start");
|
|
}
|
|
}
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
}
|
|
|
|
///*************************************************************************************************/
|
|
//void MainWindow::on_btn_scenarioPauseResume_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x800;
|
|
// auto scenCtrlReg = _usd->readWord(offset, bar);
|
|
// if (~(scenCtrlReg & 0x01))
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// auto str = ui->btn_scenarioPauseResume->text();
|
|
// if(str == PAUSE)
|
|
// {
|
|
// auto value = 0;
|
|
// _usd->writeWord(offset, bar, scenCtrlReg | 0x4);
|
|
// ui->btn_scenarioPauseResume->setText(RESUME);
|
|
// }
|
|
// else
|
|
// {
|
|
// auto value = 0;
|
|
// _usd->writeWord(offset, bar, scenCtrlReg & 0xf3);
|
|
// ui->btn_scenarioPauseResume->setText(PAUSE);
|
|
// }
|
|
//}
|
|
|
|
|
|
///*************************************************************************************************/
|
|
//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 bar = 0;
|
|
// auto offset = 0x26008;
|
|
|
|
auto indx = index;
|
|
//indx = ui->cb_selectedProbe->currentIndex();
|
|
// auto value = 0;
|
|
// value = _usd->readWord(offset, bar);
|
|
// value = value & 0xFFFFFFF0;
|
|
// if(indx == 0){
|
|
// _usd->writeWord(offset, bar, value | 0x1);
|
|
// }else if(indx == 1){
|
|
// _usd->writeWord(offset, bar, value | 0x2);
|
|
// }else if(indx == 2){
|
|
// _usd->writeWord(offset, bar, value | 0x3);
|
|
// }else {
|
|
// _usd->writeWord(offset, bar, value | 0x4);
|
|
// }
|
|
|
|
if(indx == 0){
|
|
_trx.selectProbe(prbA);
|
|
}else if(indx == 1){
|
|
_trx.selectProbe(prbB);
|
|
}else if(indx == 2){
|
|
_trx.selectProbe(prbC);
|
|
}else {
|
|
_trx.selectProbe(prbD);
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*void MainWindow::on_btn_pllClkSt_clicked()
|
|
{
|
|
|
|
auto bar = 0;
|
|
auto offset = 0x26000;
|
|
|
|
auto str = ui->btn_pllClkSt->text();
|
|
if(str == ON)
|
|
{
|
|
auto temp = ui->tb_pllClkSt->text().toUInt(Q_NULLPTR, 10);
|
|
if(temp == 0 && ui->tb_pllClkSt->text() != "0" || temp < 400 || temp > 2000)
|
|
{
|
|
MESSAGE_BOX("Invalid input format for PLL CLK ST");
|
|
return;
|
|
}
|
|
|
|
float halfPeriod = 50000.0f / temp;
|
|
uint roundHalfPeriod = uint(roundf(halfPeriod)) & 0xFF;
|
|
float t = roundf(50000.0f / roundHalfPeriod);
|
|
ui->tb_pllClkSt->setText(QString::number(t, 'f', 0));
|
|
|
|
|
|
auto value = 0;
|
|
value = roundHalfPeriod | 0x00000300;
|
|
_usd->writeWord(offset, bar, value );
|
|
value = value & 0x000002FF;
|
|
_usd->writeWord(offset, bar, value );
|
|
|
|
ui->btn_pllClkSt->setText(OFF);
|
|
}
|
|
else
|
|
{
|
|
auto value = 0;
|
|
_usd->writeWord(offset, bar, value);
|
|
ui->btn_pllClkSt->setText(ON);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//void MainWindow::on_btn_pllClkTps_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x26004;
|
|
|
|
// auto str = ui->btn_pllClkTps->text();
|
|
// if(str == ON)
|
|
// {
|
|
// auto temp = ui->tb_pllClkTps->text().toUInt(Q_NULLPTR, 10);
|
|
// if(temp == 0 && ui->tb_pllClkTps->text() != "0" || temp < 400 || temp > 2000)
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for PLL CLK TPS");
|
|
// return;
|
|
// }
|
|
|
|
// float halfPeriod = 50000.0f / temp;
|
|
// uint roundHalfPeriod = uint(roundf(halfPeriod)) & 0xFF;
|
|
// float t = roundf(50000.0f / roundHalfPeriod);
|
|
// ui->tb_pllClkTps->setText(QString::number(t, 'f', 0));
|
|
|
|
// auto value =0;
|
|
// value = roundHalfPeriod | 0x00000300;
|
|
// _usd->writeWord(offset, bar, value );
|
|
// value = value & 0x000002FF;
|
|
// _usd->writeWord(offset, bar, value );
|
|
|
|
// ui->btn_pllClkTps->setText(OFF);
|
|
// }
|
|
// else
|
|
// {
|
|
// auto value = 0;
|
|
// _usd->writeWord(offset, bar, value);
|
|
// ui->btn_pllClkTps->setText(ON);
|
|
// }
|
|
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_mulDacTrig_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x86018;
|
|
|
|
// // auto str = ui->btn_mulDacTrig->text();
|
|
// //if(str == TRIG_ON)
|
|
// //{
|
|
// auto temp = ui->tb_mlDac->text().toUInt(Q_NULLPTR, 16);
|
|
// _usd->writeWord(offset, bar, temp );
|
|
// if (ui->chk_usrMulDac->isChecked())
|
|
// {
|
|
// _usd->writeWord(offset, bar, temp|0x3000 );
|
|
// _usd->writeWord(offset, bar, temp|0x2000 );
|
|
// }
|
|
|
|
//// ui->btn_mulDacTrig->setText(TRIG_OFF);
|
|
// //}
|
|
// //else
|
|
// //{
|
|
// // auto value = 0;
|
|
// //_usd->writeWord(offset, bar, value);
|
|
// // ui->btn_mulDacTrig->setText(TRIG_ON);
|
|
// //}
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_HVOnOff_clicked()
|
|
//{
|
|
//// auto bar = 0;
|
|
//// auto offset = 0x26008;
|
|
|
|
// auto name = ui->btn_HVOnOff->text();
|
|
|
|
// if (name==HV_ON){
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value | 0x100);
|
|
// _trx.init();
|
|
// ui->btn_HVOnOff->setText("Probe ctrl init");
|
|
// }
|
|
// else{
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value & (0xFFFFFEFF));
|
|
//// relay.setHvMuxPwrEn(false);
|
|
//// ui->btn_HVOnOff->setText(HV_OFF);
|
|
// }
|
|
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_motorOnOff_clicked()
|
|
//{
|
|
//// auto bar = 0;
|
|
//// auto offset = 0x26008;
|
|
|
|
// auto name = ui->btn_motorOnOff->text();
|
|
|
|
// if (name==MOTOR_ON){
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value | 0x200);
|
|
//// relay.setMotorMuxPwrEn(true);
|
|
//// ui->btn_motorOnOff->setText(MOTOR_OFF);
|
|
// _trx.init();
|
|
// ui->btn_motorOnOff->setText("Probe ctrl init");
|
|
// }
|
|
// else{
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value & (0xFFFFFDFF));
|
|
//// relay.setMotorMuxPwrEn(false);
|
|
//// ui->btn_motorOnOff->setText(MOTOR_ON);
|
|
// }
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_pwr1OnOff_clicked()
|
|
//{
|
|
//// auto bar = 0;
|
|
//// auto offset = 0x26008;
|
|
|
|
// auto name = ui->btn_pwr1OnOff->text();
|
|
|
|
// if (name==PWR1_ON){
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value | (0x10));
|
|
//// relay.setProbeALowPwrEn(true);
|
|
//// ui->btn_pwr1OnOff->setText(PWR1_OFF);
|
|
// _trx.init();
|
|
// ui->btn_pwr1OnOff->setText("Probe ctrl init");
|
|
// }
|
|
// else{
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value & (0xFFFFFFEF));
|
|
//// relay.setProbeALowPwrEn(false);
|
|
//// ui->btn_pwr1OnOff->setText(PWR1_ON);
|
|
// }
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_pwr2OnOff_clicked()
|
|
//{
|
|
//// auto bar = 0;
|
|
//// auto offset = 0x26008;
|
|
|
|
// auto name = ui->btn_pwr2OnOff->text();
|
|
|
|
// if (name==PWR2_ON){
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value | (0x20));
|
|
//// relay.setProbeBLowPwrEn(true);
|
|
//// ui->btn_pwr2OnOff->setText(PWR2_OFF);
|
|
// _trx.init();
|
|
// ui->btn_pwr2OnOff->setText("Probe ctrl init");
|
|
// }
|
|
// else{
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value & (0xFFFFFFDF));
|
|
//// relay.setProbeBLowPwrEn(false);
|
|
//// ui->btn_pwr2OnOff->setText(PWR2_ON);
|
|
// }
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_pwr3OnOff_clicked()
|
|
//{
|
|
//// auto bar = 0;
|
|
//// auto offset = 0x26008;
|
|
|
|
// auto name = ui->btn_pwr3OnOff->text();
|
|
|
|
// if (name==PWR3_ON){
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value | (0x40));
|
|
//// relay.setProbeCLowPwrEn(true);
|
|
//// ui->btn_pwr3OnOff->setText(PWR3_OFF);
|
|
// _trx.init();
|
|
// ui->btn_pwr3OnOff->setText("Probe ctrl init");
|
|
// }
|
|
// else{
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value & (0xFFFFFFBF));
|
|
//// relay.setProbeCLowPwrEn(false);
|
|
//// ui->btn_pwr3OnOff->setText(PWR3_ON);
|
|
// }
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_pwr4OnOff_clicked()
|
|
//{
|
|
//// auto bar = 0;
|
|
//// auto offset = 0x26008;
|
|
|
|
// auto name = ui->btn_pwr4OnOff->text();
|
|
|
|
// if (name==PWR4_ON){
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value | (0x80));
|
|
//// relay.setProbeDLowPwrEn(true);
|
|
//// ui->btn_pwr4OnOff->setText(PWR4_OFF);
|
|
// _trx.init();
|
|
// ui->btn_pwr4OnOff->setText("Probe ctrl init");
|
|
// }
|
|
// else{
|
|
//// auto value = 0;
|
|
//// value = _usd->readWord(offset, bar);
|
|
//// _usd->writeWord(offset, bar, value & (0xFFFFFF7F));
|
|
//// relay.setProbeDLowPwrEn(false);
|
|
//// ui->btn_pwr4OnOff->setText(PWR4_ON);
|
|
// }
|
|
//}
|
|
|
|
//&*************************************************************************************************
|
|
//void MainWindow::on_btn_thsdStateUpdate_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x43C37C;
|
|
|
|
// auto thsd_f1_temp = _usd->readWord(offset, bar);
|
|
// auto thsd_f1 = thsd_f1_temp & 0x0000000F;
|
|
// auto color = checkTermalShutdown(thsd_f1) ? Qt::green : Qt::red;
|
|
// changeLabelTextColor(ui->l_thermalShutdownFpga1, color);
|
|
// ui->l_thermalShutdownFpga1->setText(QString::number(thsd_f1, 16));
|
|
// delay (100);
|
|
|
|
// auto thsd_f2_temp = _usd->readWord(offset+0x400000, bar);
|
|
// auto thsd_f2 = thsd_f2_temp&0x0000000F;
|
|
// color = checkTermalShutdown(thsd_f2) ? Qt::green : Qt::red;
|
|
// changeLabelTextColor(ui->l_thermalShutdownFpga2, color);
|
|
// ui->l_thermalShutdownFpga2->setText(QString::number(thsd_f2, 16));
|
|
// delay (100);
|
|
|
|
// auto thsd_f3_temp = _usd->readWord(offset+0x800000, bar);
|
|
// auto thsd_f3 = thsd_f3_temp&0x0000000F;
|
|
// color = checkTermalShutdown(thsd_f3) ? Qt::green : Qt::red;
|
|
// changeLabelTextColor(ui->l_thermalShutdownFpga3, color);
|
|
// ui->l_thermalShutdownFpga3->setText(QString::number(thsd_f3, 16));
|
|
//}*/
|
|
|
|
/********************************************************************/
|
|
void MainWindow::delay(int ms)
|
|
{
|
|
delayTimer.singleShot(ms, &loop, &QEventLoop::quit);
|
|
loop.exec();
|
|
}
|
|
|
|
const QString MainWindow::enum2String(ePg state) const
|
|
{
|
|
QString pg;
|
|
pg = (state) ? "good" : "bad";
|
|
return pg;
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/*********************************************DMA*************************************************/
|
|
/*************************************************************************************************/
|
|
//void MainWindow::on_pushButton_3_clicked()
|
|
//{
|
|
// _usd->device->fillRam();
|
|
//}
|
|
|
|
|
|
///*************************************************************************************************/
|
|
//#define TRANSFER_LENGTH 4 * 1024 * 1024
|
|
//void MainWindow::on_btn_dmaStart_2_clicked()
|
|
//{
|
|
// auto name = ui->btn_dmaStart_2->text();
|
|
|
|
// if (name==START)
|
|
// {
|
|
// ui->btn_dmaStart_2->setText(STOP);
|
|
// _usd->device->stopTransfer();
|
|
|
|
// _swCounter = 0;
|
|
// _hwCounter = _usd->device->getCounter();
|
|
|
|
// _usd->device->setRamOffsetAddress(0);
|
|
// _usd->device->setTransferLength(TRANSFER_LENGTH);
|
|
// _usd->device->setOptions(false);
|
|
// _usd->device->setMode(true);
|
|
// _usd->device->setTransferRate(30.0f);
|
|
|
|
// _usd->device->startTransfer(ui->chk_emulatorEn->isChecked());
|
|
|
|
// _dmaBuffer.clear();
|
|
// _dmaRun = true;
|
|
// _dmaLog = true;
|
|
// _dmaLogCount = 0;
|
|
// QtConcurrent::run(this, &MainWindow::readPcie);
|
|
// QtConcurrent::run(this, &MainWindow::logPcie);
|
|
// }
|
|
// else
|
|
// {
|
|
// ui->btn_dmaStart_2->setText(START);
|
|
// _dmaRun = false;
|
|
// _dmaLog = false;
|
|
// _usd->device->stopTransfer();
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::on_btn_dmaStop_2_clicked()
|
|
//{
|
|
// //_dmaRun = false;
|
|
// //12_usd->device->stopTransfer();
|
|
//}
|
|
|
|
//void MainWindow::on_btn_dmaBrowse_2_clicked()
|
|
//{
|
|
// QFileDialog dialog;
|
|
// dialog.setFileMode(QFileDialog::Directory);
|
|
// dialog.setOption(QFileDialog::ShowDirsOnly);
|
|
// auto result = dialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// _logFolder = dialog.selectedFiles()[0];
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::on_btn_dmaShow_2_clicked()
|
|
//{
|
|
// QByteArray temp = _lastBuffer;
|
|
|
|
// 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::readPcie()
|
|
//{
|
|
// while(_dmaRun)
|
|
// {
|
|
// auto cnt = _usd->device->getCounter();
|
|
|
|
// if(cnt == 0)
|
|
// {
|
|
// std::this_thread::delay_for(std::chrono::milliseconds(3));
|
|
// continue;
|
|
// }
|
|
// if(cnt != _hwCounter)
|
|
// {
|
|
// _hwCounter++;
|
|
// if(_hwCounter > HW_BUFFER_NUM)
|
|
// {
|
|
// _hwCounter = 1;
|
|
// }
|
|
|
|
// _usd->device->copy(_hwCounter - 1, _swCounter);
|
|
|
|
// auto temp = QByteArray::fromRawData(_usd->device->getBufferPtr(_swCounter), TRANSFER_LENGTH);
|
|
|
|
// _mutex.lock();
|
|
// _dmaBuffer.push_back(temp);
|
|
// _mutex.unlock();
|
|
|
|
// _lastBuffer = temp;
|
|
|
|
// _swCounter++;
|
|
// if(_swCounter >= SW_BUFFER_NUM)
|
|
// {
|
|
// _swCounter = 0;
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::logPcie()
|
|
//{
|
|
// int i = 0;
|
|
// while(_dmaLog)
|
|
// {
|
|
// if(_dmaBuffer.size() == 0)
|
|
// {
|
|
// std::this_thread::delay_for(std::chrono::milliseconds(3));
|
|
// continue;
|
|
// }
|
|
// QByteArray temp;
|
|
|
|
// _mutex.lock();
|
|
// temp = _dmaBuffer.front();
|
|
// _dmaBuffer.pop_front();
|
|
// _mutex.unlock();
|
|
|
|
// _dmaLogCount +=1;
|
|
// if (_dmaLogCount == 50)
|
|
// _dmaLog = false;
|
|
|
|
// QString path = _logFolder + QString("/%1.bin").arg(i++);
|
|
// QFile file(path);
|
|
|
|
// file.open(QIODevice::WriteOnly);
|
|
// file.write(temp);
|
|
|
|
|
|
//// for(auto j = 0; j < TRANSFER_LENGTH; j += 8)
|
|
//// {
|
|
//// auto val = ((static_cast<quint64>(temp[j])) & 0x00000000000000FF) |
|
|
//// (((static_cast<quint64>(temp[j + 1])) << 8) & 0x000000000000FF00) |
|
|
//// (((static_cast<quint64>(temp[j + 2])) << 16) & 0x0000000000FF0000) |
|
|
//// (((static_cast<quint64>(temp[j + 3])) << 24) & 0x00000000FF000000) |
|
|
//// (((static_cast<quint64>(temp[j + 4])) << 32) & 0x000000FF00000000) |
|
|
//// (((static_cast<quint64>(temp[j + 5])) << 40) & 0x0000FF0000000000) |
|
|
//// (((static_cast<quint64>(temp[j + 6])) << 48) & 0x00FF000000000000) |
|
|
//// (((static_cast<quint64>(temp[j + 7])) << 56) & 0xFF00000000000000);
|
|
//// auto str = QStringLiteral("%1").arg(val, 16, 16, QLatin1Char('0'));
|
|
//// file.write(str.toStdString().c_str(), str.length());
|
|
//// file.write("\r\n", 2);
|
|
//// }
|
|
|
|
// file.close();
|
|
// }
|
|
//}
|
|
|
|
///*************************************************************************************************/
|
|
///********************************************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_btn_DacsOnOff_clicked()
|
|
//{
|
|
// bool i2cBusy, i2cDone;
|
|
|
|
// auto dacsEnableValue=ui->tb_DacsOnOff->text().toUInt(Q_NULLPTR, 10);
|
|
// auto hvaValue=ui->tb_hvaDacValue->text().toFloat(Q_NULLPTR);
|
|
// auto cwdValue=ui->tb_cwdDacValue->text().toFloat(Q_NULLPTR);
|
|
|
|
//// i2cBusy=pwr.getI2cBusy();
|
|
//// while (i2cBusy==true) {
|
|
//// i2cBusy=pwr.getI2cBusy();
|
|
//// }
|
|
//// // delay(100);
|
|
|
|
//// switch (dacsEnableValue) {
|
|
//// case 1 : pwr.setSetupCmdDacsOnOff(false, false, true); break;
|
|
//// case 3 : pwr.setSetupCmdDacsOnOff(false, true, true); break;
|
|
//// case 5 : hvaValue<10.00f ? hvaValue=10.00f : hvaValue=hvaValue;
|
|
//// pwr.setDAcs(true, cwdValue, 1.53f, hvaValue);
|
|
//// pwr.setDAcs(false, cwdValue, 1.53f, hvaValue);
|
|
//// i2cDone=pwr.getI2cCmdDone();
|
|
//// while (i2cDone==false){
|
|
//// i2cDone=pwr.getI2cCmdDone();
|
|
//// }
|
|
//// pwr.setSetupCmdDacsOnOff(true, false, true);
|
|
//// break;
|
|
//// default: pwr.setSetupCmdDacsOnOff(false, false, false); break;
|
|
//// }
|
|
|
|
//// 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_chk_initBoards_clicked()
|
|
{
|
|
// bool i2cBusy, i2cDone;
|
|
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// while (i2cBusy==true) {
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// }
|
|
|
|
if (ui->chk_initBoards->isChecked())
|
|
{
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// while (i2cBusy==true) {
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// }
|
|
// // delay (100);
|
|
try
|
|
{
|
|
_trx.init(); // p24_On
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
// i2cDone=pwr.getI2cCmdDone();
|
|
// while (i2cDone==false){
|
|
// i2cDone=pwr.getI2cCmdDone();
|
|
// }
|
|
}
|
|
|
|
else
|
|
{
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// while (i2cBusy==true) {
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// }
|
|
// // delay (100);
|
|
|
|
// pwr.setSetupCmdP24vOnOff(false); // p24_Off
|
|
// i2cDone=pwr.getI2cCmdDone();
|
|
// while (i2cDone==false){
|
|
// i2cDone=pwr.getI2cCmdDone();
|
|
// }
|
|
}
|
|
}
|
|
///*************************************************************************************************/
|
|
|
|
void MainWindow::on_btn_supJump_clicked()
|
|
{
|
|
// bool i2cBusy, i2cDone;
|
|
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// while (i2cBusy==true) {
|
|
// i2cBusy=pwr.getI2cBusy();
|
|
// }
|
|
|
|
// pwr.setSetupCmdJmp(true); // jump
|
|
// pwr.setSetupCmdJmp(false);
|
|
|
|
// i2cDone=pwr.getI2cCmdDone();
|
|
// while (i2cDone==false){
|
|
// i2cDone=pwr.getI2cCmdDone();
|
|
// }
|
|
try
|
|
{
|
|
_trx.mpsReset(); //jump
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_updateRdbackValue_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
_trx.supervisorRbValue(_supRbValue);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
|
|
auto hvapValue=_supRbValue->hvap;
|
|
ui->l_hvap->setText(QString::number(static_cast<double>(hvapValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto hvbpValue=_supRbValue->hvbp;
|
|
ui->l_hvbp->setText(QString::number(static_cast<double>(hvbpValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto cwdpValue=_supRbValue->cwdp;
|
|
ui->l_cwdp->setText(QString::number(static_cast<double>(cwdpValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto curr24vValue=_supRbValue->curr24V;
|
|
ui->l_curr24v->setText(QString::number(static_cast<double>(curr24vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p24vValue=_supRbValue->p24V;
|
|
ui->l_p24v->setText(QString::number(static_cast<double>(p24vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p12vValue=_supRbValue->p12V;
|
|
ui->l_p12v->setText(QString::number(static_cast<double>(p12vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p5vValue=_supRbValue->p5V;
|
|
ui->l_p5v->setText(QString::number(static_cast<double>(p5vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto m5vValue=_supRbValue->m5V;
|
|
ui->l_m5v->setText(QString::number(static_cast<double>(m5vValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto hvStopValue=_supRbValue->hvStop;
|
|
ui->l_hvStop->setText(QString::number(static_cast<double>(hvStopValue), 'f', 3));
|
|
delay(10);
|
|
|
|
auto p4dValue=_supRbValue->p4D;
|
|
ui->l_p4d->setText(QString::number(static_cast<double>(p4dValue), 'f', 3));
|
|
delay(10);
|
|
|
|
/********************Faults***********************/
|
|
try
|
|
{
|
|
_trx.mpsFaultStatus(_faultStatus);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
|
|
bool hvapFlt=_faultStatus->hvap;
|
|
ui->l_hvapFlt->setText(QVariant(hvapFlt).toString());
|
|
auto colorHvapFlt = hvapFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_hvapFlt, colorHvapFlt);
|
|
delay(10);
|
|
|
|
bool hvbpFlt=_faultStatus->hvbp;
|
|
ui->l_hvbpFlt->setText(QVariant(hvbpFlt).toString());
|
|
auto colorHvbpFlt = hvbpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_hvbpFlt, colorHvbpFlt);
|
|
delay(10);
|
|
|
|
bool cwdpFlt=_faultStatus->cwdp;
|
|
ui->l_cwdFlt->setText(QVariant(cwdpFlt).toString());
|
|
auto colorCwdpFlt = cwdpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_cwdFlt, colorCwdpFlt);
|
|
delay(10);
|
|
|
|
bool cur24vFlt=_faultStatus->curr24V;
|
|
ui->l_curr24vFlt->setText(QVariant(cur24vFlt).toString());
|
|
auto colorCur24vFlt = cur24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_curr24vFlt, colorCur24vFlt);
|
|
delay(10);
|
|
|
|
bool p24vFlt=_faultStatus->p24v;
|
|
ui->l_p24vFlt->setText(QVariant(p24vFlt).toString());
|
|
auto colorP24vFlt = p24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p24vFlt, colorP24vFlt);
|
|
delay(10);
|
|
|
|
bool p12vFlt=_faultStatus->p12v;
|
|
ui->l_p12vFlt->setText(QVariant(p12vFlt).toString());
|
|
auto colorP12vFlt = p12vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p12vFlt, colorP12vFlt);
|
|
delay(10);
|
|
|
|
bool p5vFlt=_faultStatus->p5v;
|
|
ui->l_p5vFlt->setText(QVariant(p5vFlt).toString());
|
|
auto colorP5vFlt = p5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p5vFlt, colorP5vFlt);
|
|
delay(10);
|
|
|
|
bool m5vFlt=_faultStatus->m5v;
|
|
ui->l_m5vFlt->setText(QVariant(m5vFlt).toString());
|
|
auto colorM5vFlt = m5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_m5vFlt, colorM5vFlt);
|
|
delay(10);
|
|
|
|
bool hvFlt=_faultStatus->hvError;
|
|
ui->l_hvFlt->setText(QVariant(hvFlt).toString());
|
|
auto colorHvFlt = hvFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_hvFlt, colorHvFlt);
|
|
delay(10);
|
|
|
|
bool sup4dFlt=_faultStatus->sup4d;
|
|
ui->l_p4dFlt->setText(QVariant(sup4dFlt).toString());
|
|
auto colorP4dFlt = sup4dFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_p4dFlt, colorP4dFlt);
|
|
delay(10);
|
|
|
|
/******************Faults_Over*********************/
|
|
bool ovrHvapFlt=_faultStatus->overHvap;
|
|
ui->l_ovrHVapFlt->setText(QVariant(ovrHvapFlt).toString());
|
|
auto colorOvrHvapFlt = ovrHvapFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrHVapFlt, colorOvrHvapFlt);
|
|
delay(10);
|
|
|
|
bool ovrHvbpFlt=_faultStatus->overHvbp;
|
|
ui->l_ovrHVbpFlt->setText(QVariant(ovrHvbpFlt).toString());
|
|
auto colorOvrHvbpFlt = ovrHvbpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrHVbpFlt, colorOvrHvbpFlt);
|
|
delay(10);
|
|
|
|
bool ovrCwdpFlt=_faultStatus->overCwdp;
|
|
ui->l_ovrCWdpFlt->setText(QVariant(ovrCwdpFlt).toString());
|
|
auto colorOvrCwdpFlt = ovrCwdpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrCWdpFlt, colorOvrCwdpFlt);
|
|
delay(10);
|
|
|
|
bool ovrCur24vFlt=_faultStatus->overCurr24V;
|
|
ui->l_ovrCur24vFlt->setText(QVariant(ovrCur24vFlt).toString());
|
|
auto colorOvrCur24vFlt = ovrCur24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrCur24vFlt, colorOvrCur24vFlt);
|
|
delay(10);
|
|
|
|
bool ovrP24vFlt=_faultStatus->overP24v;
|
|
ui->l_ovrP24vFlt->setText(QVariant(ovrP24vFlt).toString());
|
|
auto colorOvrP24vFlt = ovrP24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrP24vFlt, colorOvrP24vFlt);
|
|
delay(10);
|
|
|
|
bool ovrP12vFlt=_faultStatus->overP12v;
|
|
ui->l_ovrP12vFlt->setText(QVariant(ovrP12vFlt).toString());
|
|
auto colorOvrP12vFlt = ovrP12vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrP12vFlt, colorOvrP12vFlt);
|
|
delay(10);
|
|
|
|
bool ovrP5vFlt=_faultStatus->overP5v;
|
|
ui->l_ovrP5vFlt->setText(QVariant(ovrP5vFlt).toString());
|
|
auto colorOvrP5vFlt = ovrP5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrP5vFlt, colorOvrP5vFlt);
|
|
delay(10);
|
|
|
|
bool ovrM5vFlt=_faultStatus->overM5v;
|
|
ui->l_ovrM5vFlt->setText(QVariant(ovrM5vFlt).toString());
|
|
auto colorOvrM5vFlt = ovrM5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrM5vFlt, colorOvrM5vFlt);
|
|
delay(10);
|
|
|
|
bool ovrHvFlt=_faultStatus->overHvError;
|
|
ui->l_ovrHvFlt->setText(QVariant(ovrHvFlt).toString());
|
|
auto colorOvrHvFlt = ovrHvFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovrHvFlt, colorOvrHvFlt);
|
|
delay(10);
|
|
|
|
bool ovrSup4dFlt=_faultStatus->overSup4d;
|
|
ui->l_ovr4dFlt->setText(QVariant(ovrSup4dFlt).toString());
|
|
auto colorOvrP4dFlt = ovrSup4dFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_ovr4dFlt, colorOvrP4dFlt);
|
|
delay(10);
|
|
|
|
/******************Faults_Under*********************/
|
|
bool udrHvapFlt=_faultStatus->underHvap;
|
|
ui->l_udrHVapFlt->setText(QVariant(udrHvapFlt).toString());
|
|
auto colorUdrHvapFlt = udrHvapFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrHVapFlt, colorUdrHvapFlt);
|
|
delay(10);
|
|
|
|
bool udrHvbpFlt=_faultStatus->underHvbp;
|
|
ui->l_udrHVbpFlt->setText(QVariant(udrHvbpFlt).toString());
|
|
auto colorUdrHvbpFlt = udrHvbpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrHVbpFlt, colorUdrHvbpFlt);
|
|
delay(10);
|
|
|
|
bool udrCwdpFlt=_faultStatus->underCwdp;
|
|
ui->l_udrCWdpFlt->setText(QVariant(udrCwdpFlt).toString());
|
|
auto colorUdrCwdpFlt = udrCwdpFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrCWdpFlt, colorUdrCwdpFlt);
|
|
delay(10);
|
|
|
|
bool udrCur24vFlt=_faultStatus->underCurr24V;
|
|
ui->l_udrCurr24vFlt->setText(QVariant(udrCur24vFlt).toString());
|
|
auto colorUdrCur24vFlt = udrCur24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrCurr24vFlt, colorUdrCur24vFlt);
|
|
delay(10);
|
|
|
|
bool udrP24vFlt=_faultStatus->underP24v;
|
|
ui->l_udrP24vFlt->setText(QVariant(udrP24vFlt).toString());
|
|
auto colorUdrP24vFlt = udrP24vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrP24vFlt, colorUdrP24vFlt);
|
|
delay(10);
|
|
|
|
bool udrP12vFlt=_faultStatus->underP12v;
|
|
ui->l_udrP12vFlt->setText(QVariant(udrP12vFlt).toString());
|
|
auto colorUdrP12vFlt = udrP12vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrP12vFlt, colorUdrP12vFlt);
|
|
delay(10);
|
|
|
|
bool udrP5vFlt=_faultStatus->underP5v;
|
|
ui->l_udrP5vFlt->setText(QVariant(udrP5vFlt).toString());
|
|
auto colorUdrP5vFlt = udrP5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrP5vFlt, colorUdrP5vFlt);
|
|
delay(10);
|
|
|
|
bool udrM5vFlt=_faultStatus->underM5v;
|
|
ui->l_udrM5vFlt->setText(QVariant(udrM5vFlt).toString());
|
|
auto colorUdrM5vFlt = udrM5vFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrM5vFlt, colorUdrM5vFlt);
|
|
delay(10);
|
|
|
|
bool udrHvFlt=_faultStatus->underHvError;
|
|
ui->l_udrHvFlt->setText(QVariant(udrHvFlt).toString());
|
|
auto colorUdrHvFlt = udrHvFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udrHvFlt, colorUdrHvFlt);
|
|
delay(10);
|
|
|
|
bool udrSup4dFlt=_faultStatus->underSup4d;
|
|
ui->l_udr4dFlt->setText(QVariant(udrSup4dFlt).toString());
|
|
auto colorUdrP4dFlt = udrSup4dFlt ? Qt::red : Qt::green;
|
|
changeLabelTextColor(ui->l_udr4dFlt, colorUdrP4dFlt);
|
|
delay(10);
|
|
}
|
|
|
|
|
|
//void MainWindow::on_chk_usrMulDac_stateChanged(int arg1)
|
|
//{
|
|
// auto bar = 0;
|
|
// auto offset = 0x86018;
|
|
// auto value = _usd->readWord(offset, bar);
|
|
// if (!ui->chk_usrMulDac->isChecked())
|
|
// _usd->writeWord(offset, bar, value&0xFFF);
|
|
//}
|
|
|
|
//void MainWindow::on_btn_afeProg_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// uint32_t offsetWr[3] = {0x10F0DA*4,0x20F0DA*4,0x30F0DA*4};
|
|
// uint32_t offsetRd[3] = {0x10F0DE*4,0x20F0DE*4,0x30F0DE*4};
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetWr[i], bar, 0xF0);
|
|
// _usd->writeWord(offsetWr[i], bar, 0x0F);
|
|
// }
|
|
// qDebug() << "--- AFE Registers --- ";
|
|
// for (int i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetRd[i], bar);
|
|
// qDebug() << QString::number(offsetRd[i], 16) << QString::number(value, 16);
|
|
// }
|
|
// qDebug() << "--- ------------- --- ";
|
|
//}
|
|
|
|
//void MainWindow::on_btn_gtReg_clicked()
|
|
//{
|
|
// auto result = "OK";
|
|
// auto bar = 0;
|
|
// uint32_t offsetRd[24] = {0x14008*4,0x114008*4,0x214008*4,0x314008*4,
|
|
// 0x1400B*4,0x11400B*4,0x21400B*4,0x31400B*4,
|
|
// 0x1400C*4,0x11400C*4,0x21400C*4,0x31400C*4,
|
|
// 0x1400D*4,0x11400D*4,0x21400D*4,0x31400D*4,
|
|
// 0x14010*4,0x114010*4,0x214010*4,0x314010*4,
|
|
// 0x14011*4,0x114011*4,0x214011*4,0x314011*4};
|
|
// uint32_t correctVal[24] = {0x0,0xFF43,0xFF43,0xFF43,
|
|
// 0x0,0xFFFF,0xFFFF,0xFFFF,
|
|
// 0x0,0xF0F,0xF0F,0xF0F,
|
|
// 0xFF43,0xF04F,0xFF43,0xFF43,
|
|
// 0xFFFF,0xFF00,0xFFFF,0xFFFF,
|
|
// 0xF0F,0xF00,0xF0F,0xF0F};
|
|
// qDebug() << "--- GT Status Registers --- ";
|
|
// for (auto i=0 ; i<20;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetRd[i], bar);
|
|
// if (value == correctVal[i])
|
|
// result = "OK";
|
|
// else
|
|
// result = "NOK";
|
|
// qDebug() << QString::number(offsetRd[i]/4, 16) << QString::number(value, 16) << result;
|
|
// }
|
|
// qDebug() << "--- ------------------- --- ";
|
|
//}
|
|
|
|
//void MainWindow::on_btn_browse_clicked()
|
|
//{
|
|
// QFileDialog dialog;
|
|
// dialog.setFileMode(QFileDialog::Directory);
|
|
// dialog.setOption(QFileDialog::ShowDirsOnly);
|
|
// auto result = dialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// //_adcloggerFolder = dialog.selectedFiles()[0];
|
|
|
|
// ui->tb_adcLoggerPath->setText(dialog.selectedFiles()[0]);
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::on_btn_dbgTransferStrt_clicked()
|
|
//{
|
|
// ui->btn_dbgTransferStrt->setText("Trans...");
|
|
// auto path = ui->tb_adcLoggerPath->text();
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::AdcLogCsvFileWriter, path, ui->prg_adcLoggerFileWr);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// ui->btn_dbgTransferStrt->setText(START);
|
|
//}
|
|
|
|
//void MainWindow::on_btn_adcLoggerStrt_clicked()
|
|
//{
|
|
// ui->btn_adcLoggerStrt->setText("Log...");
|
|
// uint32_t bar = 0;
|
|
// uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4};
|
|
|
|
// qDebug() << "--- ADC Logger Start --- ";
|
|
|
|
// auto temp = ui->tb_dbgSmplCnt->text().toUInt(Q_NULLPTR, 16);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x1); //reset Logger
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x0); //reset done
|
|
|
|
// auto value = temp<<8;
|
|
// value |= 0x4;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Start ADC Logger and set Counter
|
|
// }
|
|
// QtConcurrent::run(this, &MainWindow::adcLoggerStatusCheck);
|
|
//}
|
|
|
|
//void MainWindow::on_prg_adcLoggerFileWr_valueChanged(int value)
|
|
//{
|
|
|
|
//}
|
|
|
|
|
|
//void MainWindow::adcLoggerStatusCheck()
|
|
//{
|
|
// uint32_t offsetTrnsStatus[3] = {0x14000A*4,0x24000A*4,0x34000A*4};
|
|
// uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4};
|
|
// _adcLoggerDone = false;
|
|
// auto timeOut = 0;
|
|
// auto doneFlag = 0;
|
|
// while (timeOut < 1000 && doneFlag < 3 )
|
|
// {
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// doneFlag += (_usd->readWord(offsetTrnsStatus[i], 0) & 0X1);
|
|
// }
|
|
// timeOut += 1;
|
|
// delay(10);
|
|
// }
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetTrnsfrCmdLen[i], 0);
|
|
// value &= 0xFFFFFFF0;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], 0, value);
|
|
// }
|
|
|
|
// ui->btn_adcLoggerStrt->setText(START);
|
|
// _adcLoggerDone = true;
|
|
// if(timeOut == 1000)
|
|
// {
|
|
// MESSAGE_BOX("Logger incomplete");
|
|
// return;
|
|
// }
|
|
// else
|
|
// qDebug() << "--- ADC Logger done --- ";
|
|
//}
|
|
|
|
|
|
//void MainWindow::on_btn_adcSimBrowse_clicked()
|
|
//{
|
|
// QFileDialog fileDialog;
|
|
// fileDialog.setNameFilters({"ADC Sim Scenario file (*.bin)"});
|
|
// auto result = fileDialog.exec();
|
|
|
|
// if(result)
|
|
// {
|
|
// auto selectedPath = fileDialog.selectedFiles()[0];
|
|
// ui->tb_adcSimPath->setText(selectedPath);
|
|
// _settings->setValue(ADC_SIM_FILE_PATH, selectedPath);
|
|
// }
|
|
//}
|
|
|
|
//void MainWindow::on_btn_adcSimStart_clicked()
|
|
//{
|
|
// auto bar = 0;
|
|
// //auto offset = 0;
|
|
// uint32_t offsetDbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4};
|
|
// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4};
|
|
// auto startIndex = ui->tb_adcSimStartIndex->text().toUInt(Q_NULLPTR, 16);
|
|
// if(startIndex == 0 && ui->tb_adcSimStartIndex->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for start index");
|
|
// return;
|
|
// }
|
|
|
|
// auto stopIndex = ui->tb_adcSimStopIndex->text().toUInt(Q_NULLPTR, 16);
|
|
// if(stopIndex == 0 && ui->tb_adcSimStopIndex->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for stop index");
|
|
// return;
|
|
// }
|
|
|
|
// if((stopIndex < startIndex) || (stopIndex>131071) || (startIndex>131071))
|
|
// {
|
|
// MESSAGE_BOX("Stop index should be greater than or equal to start index");
|
|
// return;
|
|
// }
|
|
|
|
// _usd->writeWord(0x804, bar, startIndex);
|
|
// _usd->writeWord(0x808, bar, stopIndex);
|
|
// auto value = 0;
|
|
// auto str = ui->btn_adcSimStart->text();
|
|
// if(str == START)
|
|
// {
|
|
// qDebug() << "--- SET GT Send Mode :: BF --- ";
|
|
// _usd->writeWord(0x10, 0, 0x1);
|
|
// _csvReadStopFlag = false;
|
|
// ui->btn_adcSimStart->setText(STOP);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetDbgCmd[i], 0);
|
|
// value |= 0x1;
|
|
// _usd->writeWord(offsetDbgCmd[i], 0, value);
|
|
// }
|
|
|
|
// delay(100);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value | 0x2);
|
|
// }
|
|
// auto path = ui->tb_adcSimPath->text();
|
|
// auto future = QtConcurrent::run(this, &MainWindow::binAdcFileUploader, 0, path , ui->prg_adcSim);
|
|
// }
|
|
// else
|
|
// {
|
|
// _csvReadStopFlag = true;
|
|
// ui->btn_adcSimStart->setText(START);
|
|
// _usd->writeWord(0x800, bar, 0);
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// auto value = _usd->readWord(offsetDbgCmd[i], 0);
|
|
// value &= 0xFFFFFFF0;
|
|
// _usd->writeWord(offsetDbgCmd[i], 0, value);
|
|
// }
|
|
// delay(100);
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// value = _usd->readWord(offsetSlvScenCmd[i], bar);
|
|
// _usd->writeWord(offsetSlvScenCmd[i], bar, value & 0x1);
|
|
// }
|
|
|
|
// //scenarioStop();
|
|
// }
|
|
|
|
//}
|
|
|
|
//void MainWindow::on_btn_adcLoggerAutoCount_clicked()
|
|
//{
|
|
// uint32_t bar = 0;
|
|
// uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4};
|
|
|
|
// auto logCount = ui->tb_dbgAutoLogCount->text().toUInt();
|
|
// if(logCount == 0 && ui->tb_dbgAutoLogCount->text() != "0")
|
|
// {
|
|
// MESSAGE_BOX("Invalid input format for logCount");
|
|
// return;
|
|
// }
|
|
|
|
// ui->btn_adcLoggerAutoCount->setText("Log...");
|
|
// uint32_t offsetAfePwrDn[3] = {0x10F0C5*4,0x20F0C5*4,0x30F0C5*4};
|
|
// uint32_t offsetAfeLpf[3] = {0x10F0C4*4,0x20F0C4*4,0x30F0C4*4};
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x0);
|
|
// _usd->writeWord(offsetAfeLpf[i], bar, 0x0100);
|
|
// }
|
|
// qDebug() << "--- AFE Registers --- ";
|
|
// delay(1);
|
|
|
|
|
|
// for (auto j = 0 ; j < logCount ; j++)
|
|
// {
|
|
|
|
// qDebug() << "--- ADC Auto Logger Start --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x1); //reset Logger
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x0); //reset done
|
|
|
|
// auto value = 1<<8;
|
|
// value |= 0x4;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Start ADC Logger and set Counter
|
|
|
|
// value |= 0x8;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Set Manual Trig
|
|
|
|
// value &= 0xF7;
|
|
// _usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Set Manual Trig
|
|
|
|
// }
|
|
// QtConcurrent::run(this, &MainWindow::adcLoggerStatusCheck);
|
|
// delay(10);
|
|
// while (!_adcLoggerDone);
|
|
|
|
// auto path = ui->tb_adcLoggerPath->text();
|
|
|
|
// QFutureWatcher<void> watcher;
|
|
// connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// auto future = QtConcurrent::run(this, &MainWindow::AdcLogCsvFileWriter, path, ui->prg_adcLoggerFileWr);
|
|
// watcher.setFuture(future);
|
|
// _dial->exec();
|
|
// disconnect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
|
|
// ui->btn_dbgTransferStrt->setText(START);
|
|
|
|
// delay(10);
|
|
// while (!_adcLoggerTrnsDone);
|
|
// }
|
|
// ui->btn_adcLoggerAutoCount->setText(START);
|
|
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x8000);
|
|
// }
|
|
// qDebug() << "--- AFE Registers Power Down --- ";
|
|
//}
|
|
|
|
//void MainWindow::on_btn_eepromTest_clicked()
|
|
//{
|
|
// auto addr = 100;
|
|
// QByteArray eepromData("allli");
|
|
|
|
// try {
|
|
// auto len = eepromData.length();
|
|
//// ptmMngt.trxEepromWrite(eepromData,addr,len);
|
|
//// eepromData = ptmMngt.trxEepromRead(addr, len);
|
|
// trxEepromWrite(eepromData, addr, _bCtrl);
|
|
// _trx.trxInfo();
|
|
|
|
// qDebug() << "EEPROM Data : "<< eepromData;
|
|
// }
|
|
// catch (SonoException exp) {
|
|
// qDebug() << exp.what();
|
|
// }
|
|
// catch (...)
|
|
// {
|
|
// qDebug() << "Others";
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
//void MainWindow::on_btn_scenRead_clicked()
|
|
//{
|
|
// auto paramPath = ui->tb_paramFile->text();
|
|
// auto paramBar = 0;
|
|
// auto boardParamPath = "/home/hasis/Desktop/TrxBoardFile/_log/readBack.csv";
|
|
// QtConcurrent::run(this, &MainWindow::CsvFileChecker,paramBar, paramPath , boardParamPath , ui->prg_scenarioUpload);
|
|
|
|
//}
|
|
|
|
void MainWindow::on_btn_getFpgaVersion_clicked()
|
|
{
|
|
_trx.getFpgasCodeVersion(_version);
|
|
auto value = _version->masterCode;
|
|
ui->l_masterVersion->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
value = _version->slave0Code;
|
|
ui->l_slave0Version->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
value = _version->slave1Code;
|
|
ui->l_slave1Version->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
value = _version->slave2Code;
|
|
ui->l_slave2Version->setText(QStringLiteral("%1").arg(value, 8, 10));
|
|
}
|
|
|
|
//void MainWindow::on_btn_txTrig_clicked()
|
|
//{
|
|
|
|
// auto bar = 0;
|
|
// uint32_t offsetAfeAdc2[3] = {0x10F002*4,0x20F002*4,0x30F002*4};
|
|
|
|
//// qDebug() << "--- SET AFE Ramp Count Mode --- ";
|
|
//// for (auto i=0 ; i<3;i++)
|
|
//// {
|
|
//// _usd->writeWord(offsetAfeAdc2[i], bar, 0x1380);
|
|
//// }
|
|
// delay(20);
|
|
|
|
|
|
// uint32_t offsetAfePwrDn[3] = {0x10F0C5*4,0x20F0C5*4,0x30F0C5*4};
|
|
// //uint32_t offsetAfeLpf[3] = {0x10F0C4*4,0x20F0C4*4,0x30F0C4*4};
|
|
|
|
// qDebug() << "--- SET AFE Power On Mode --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x0);
|
|
// //_usd->writeWord(offsetAfeLpf[i], bar, 0x0100);
|
|
// }
|
|
// delay(100);
|
|
|
|
|
|
// qDebug() << "--- Set TX Trig --- ";
|
|
|
|
// auto offset = 0x5*4;
|
|
// auto value = 0x1;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// value = 0x5;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// value = 0x1;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// delay(100);
|
|
// value = 0x0;
|
|
// _usd->writeWord(offset,bar,value);
|
|
// qDebug() << "--- TX Trig Done--- ";
|
|
|
|
// delay(10);
|
|
//// qDebug() << "--- SET AFE Normal Mode --- ";
|
|
//// for (auto i=0 ; i<3;i++)
|
|
//// {
|
|
//// _usd->writeWord(offsetAfeAdc2[i], bar, 0x1000);
|
|
//// }
|
|
// qDebug() << "--- SET AFE Power On Mode --- ";
|
|
// for (auto i=0 ; i<3;i++)
|
|
// {
|
|
// _usd->writeWord(offsetAfePwrDn[i], bar, 0x8000);
|
|
// //_usd->writeWord(offsetAfeLpf[i], bar, 0x0100);
|
|
// }
|
|
// delay(1);
|
|
// delay(20);
|
|
|
|
//}
|
|
/*************************************************************************************************/
|
|
/**************************************** DSP ****************************************************/
|
|
/*************************************************************************************************/
|
|
void MainWindow::setReceiverConfiguration()
|
|
{
|
|
// _scenParams.hwRegister.->mla.clear();
|
|
// _scenParams->hwRegister->configLut->stb.clear();
|
|
// _scenParams->hwRegister->configLut->lpfSel.clear();
|
|
// _scenParams->hwRegister->configLut->aTgcSel.clear();
|
|
// _scenParams->hwRegister->configLut->focusNo.clear();
|
|
// _scenParams->hwRegister->configLut->lineMode.clear();
|
|
// _scenParams->hwRegister->configLut->ncoFreqSel.clear();
|
|
// _scenParams->hwRegister->configLut->absEn.clear();
|
|
// _scenParams->hwRegister->configLut->ddcEn.clear();
|
|
// _scenParams->hwRegister->configLut->dpeEn.clear();
|
|
// _scenParams->hwRegister->configLut->stbEn.clear();
|
|
// _scenParams->hwRegister->configLut->wmfEn.clear();
|
|
// _scenParams->hwRegister->configLut->dcCancelerEn.clear();
|
|
// _scenParams->hwRegister->configLut->lineFilterEn.clear();
|
|
// _scenParams->hwRegister->configLut->subtractFilterEn.clear();
|
|
|
|
// for (quint8 i = 0; i < 8; i++){
|
|
// _scenParams.hwRegister.receiverConfigProps.append();
|
|
// _scenParams.hwRegister->configLut->stb.append((i*2) % 3);
|
|
// _scenParams.hwRegister->configLut->lpfSel.append((i*3) % 3);
|
|
// _scenParams.hwRegister->configLut->aTgcSel.append((i*4) % 3);
|
|
// _scenParams.hwRegister->configLut->focusNo.append((i*5) % 3);
|
|
// _scenParams.hwRegister->configLut->lineMode.append((i*6) % 15);
|
|
// _scenParams.hwRegister->configLut->ncoFreqSel.append((i*7) % 7);
|
|
// _scenParams.hwRegister->configLut->absEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->ddcEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->dpeEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->stbEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->wmfEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->dcCancelerEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->lineFilterEn.append((i % 2)!=0);
|
|
// _scenParams.hwRegister->configLut->subtractFilterEn.append((i % 2)!=0);
|
|
// }
|
|
}
|
|
|
|
|
|
void MainWindow::setLineFilter()
|
|
{
|
|
_lineFilter.clear();
|
|
for (auto i = 0; i < 4; i++)
|
|
{
|
|
_lineFilter.append(i);
|
|
}
|
|
}
|
|
|
|
void MainWindow::on_btn_lineFilter_clicked()
|
|
{
|
|
|
|
ui->l_lineFilter->setText("doing");
|
|
changeLabelTextColor(ui->l_lineFilter, Qt::red);
|
|
|
|
_trx.setLineFilterCoefficient(_lineFilter);
|
|
|
|
ui->l_lineFilter->setText("done");
|
|
changeLabelTextColor(ui->l_lineFilter, Qt::green);
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::setFreqLut()
|
|
{
|
|
_scenParams.hwRegister.freqLut.clear();
|
|
for (quint8 i = 0; i < 8; i++)
|
|
{
|
|
_scenParams.hwRegister.freqLut.append(i*10);
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::setStbCoeff()
|
|
{
|
|
_stb.clear();
|
|
for (quint8 i = 0; i < 8; i++)
|
|
{
|
|
_stb.append(i);
|
|
}
|
|
}
|
|
|
|
void MainWindow::on_btn_stbCoeff_clicked()
|
|
{
|
|
|
|
ui->l_stbCoeff->setText("doing");
|
|
changeLabelTextColor(ui->l_stbCoeff, Qt::red);
|
|
|
|
_trx.setStbCoefficient(_stb);
|
|
|
|
ui->l_stbCoeff->setText("done");
|
|
changeLabelTextColor(ui->l_stbCoeff, Qt::green);
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::setATgc()
|
|
{
|
|
// QVector<quint32> temp;
|
|
// _scenParams.hwRegister.atgcLut.clear();
|
|
|
|
// for (quint8 i = 0; i < 4; i++)
|
|
// {
|
|
// temp.clear();
|
|
// for (quint16 j = 0; j < 256; j++)
|
|
// {
|
|
// temp.append(j);
|
|
// }
|
|
// _scenParams.hwRegister.atgcLut.append(temp);
|
|
// }
|
|
}
|
|
|
|
|
|
void MainWindow::setDTgc()
|
|
{
|
|
_dTgc.clear();
|
|
for (quint16 i = 0; i < 1024; i++)
|
|
{
|
|
_dTgc.append(i);
|
|
}
|
|
}
|
|
|
|
void MainWindow::on_btn_dtgc_clicked()
|
|
{
|
|
|
|
ui->l_dtgc->setText("doing");
|
|
changeLabelTextColor(ui->l_dtgc, Qt::red);
|
|
|
|
_trx.setDtgcLut(_dTgc);
|
|
|
|
ui->l_dtgc->setText("done");
|
|
changeLabelTextColor(ui->l_dtgc, Qt::green);
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::setBlendWeight()
|
|
{
|
|
QVector<float> temp;
|
|
_scenParams.hwRegister.blendWeight.clear();
|
|
|
|
for (quint8 i = 0; i < 4; i++)
|
|
{
|
|
temp.clear();
|
|
for (quint16 j = 0; j < 512; j++)
|
|
{
|
|
temp.append(j);
|
|
}
|
|
_scenParams.hwRegister.blendWeight.append(temp);
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::setLpf()
|
|
{
|
|
// QVector<quint32> temp;
|
|
// _scenParams->hwRegister->lpfLut.clear();
|
|
|
|
// for (quint8 i = 0; i < 4; i++)
|
|
// {
|
|
// temp.clear();
|
|
// for (quint8 j = 0; j < 48; j++)
|
|
// {
|
|
// temp.append(j);
|
|
// }
|
|
// _scenParams->hwRegister->lpfLut.append(temp);
|
|
// }
|
|
}
|
|
|
|
|
|
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));
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/**************************************** EEPROM *************************************************/
|
|
/*************************************************************************************************/
|
|
void MainWindow::on_btn_trxRomWrite_clicked()
|
|
{
|
|
|
|
QByteArray arr;
|
|
arr.clear();
|
|
QString txtStr = ui->tb_trxRomWrite->toPlainText();
|
|
try
|
|
{
|
|
foreach (auto i, txtStr){
|
|
arr.append(i.toLatin1());
|
|
}
|
|
trxEepromWrite(arr, 0, _bCtrl);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_trxRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
quint32 id = _trx.trxId();
|
|
ui->tb_trxRomIdRead->setText(QString::number(id, 16));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_trxRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
QString infoStr = _trx.trxInfo();
|
|
ui->tb_trxRomInfoRead->setText(infoStr);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_mpsRomWrite_clicked()
|
|
{
|
|
|
|
QByteArray arr;
|
|
arr.clear();
|
|
QString txtStr = ui->tb_mpsRomWrite->toPlainText();
|
|
try
|
|
{
|
|
foreach (auto i, txtStr){
|
|
arr.append(i.toLatin1());
|
|
}
|
|
mpsEepromWrite(arr, 0, _bCtrl);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_mpsRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
quint32 id = _trx.mpsId();
|
|
ui->tb_mpsRomIdRead->setText(QString::number(id, 16));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_mpsRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
QString infoStr = _trx.mpsInfo();
|
|
ui->tb_mpsRomInfoRead->setText(infoStr);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_prbCtrlRomWrite_clicked()
|
|
{
|
|
|
|
QByteArray arr;
|
|
arr.clear();
|
|
QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText();
|
|
try
|
|
{
|
|
foreach (auto i, txtStr){
|
|
arr.append(i.toLatin1());
|
|
}
|
|
prbCtrlEepromWrite(arr, 0, _bCtrl);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbCtrlRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
quint32 id = _trx.prbCtrlId();
|
|
ui->tb_prbCtrlRomIdRead->setText(QString::number(id, 16));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbCtrlRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
QString infoStr = _trx.prbCtrlInfo();
|
|
ui->tb_prbCtrlRomInfoRead->setText(infoStr);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_btn_prbRomWrite_clicked()
|
|
{
|
|
|
|
QByteArray arr;
|
|
arr.clear();
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
QString txtStr = ui->tb_prbRomWrite->toPlainText();
|
|
try
|
|
{
|
|
foreach (auto i, txtStr){
|
|
arr.append(i.toLatin1());
|
|
}
|
|
prbEepromWrite(arr, 0, static_cast<quint8>(sel), _bCtrl);
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbRomIdRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
quint32 id = _trx.prbId(static_cast<quint8>(sel));
|
|
ui->tb_prbRomIdRead->setText(QString::number(id, 16));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::on_btn_prbRomInfoRead_clicked()
|
|
{
|
|
|
|
try
|
|
{
|
|
auto sel = ui->cb_prbSelRom->currentIndex();
|
|
QByteArray arr = _trx.prbInfo(static_cast<quint8>(sel));
|
|
ui->tb_prbRomInfoRead->setText(QString(arr));
|
|
}
|
|
catch (SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************************************************/
|
|
/************************************** BeamFormer ***********************************************/
|
|
/*************************************************************************************************/
|
|
void MainWindow::setRxBeamformerPrp()
|
|
{
|
|
// _scenParams->hwRegister->rxBeamformer->lag.clear();
|
|
// _scenParams->hwRegister->rxBeamformer->mla.clear();
|
|
// _scenParams->hwRegister->rxBeamformer->apodization.clear();
|
|
|
|
// for (quint8 i = 0; i < 8; i++){
|
|
// _scenParams->hwRegister->rxBeamformer->lag.append(i);
|
|
// _scenParams->hwRegister->rxBeamformer->mla.append((i*2) % 7);
|
|
// _scenParams->hwRegister->rxBeamformer->apodization.append((i*3) % 3);
|
|
// }
|
|
}
|
|
|
|
void MainWindow::setProbeElement()
|
|
{
|
|
_scenParams.hwRegister.elementXPosition.clear();
|
|
_scenParams.hwRegister.elementYPosition.clear();
|
|
_scenParams.hwRegister.elementZPosition.clear();
|
|
|
|
for (quint8 i = 0; i < 192; i++){
|
|
_scenParams.hwRegister.elementXPosition.append(i);
|
|
_scenParams.hwRegister.elementYPosition.append(i*2);
|
|
_scenParams.hwRegister.elementZPosition.append(i*3);
|
|
}
|
|
}
|
|
|
|
void MainWindow::setApodization()
|
|
{
|
|
// QVector<quint32> temp;
|
|
// _scenParams->hwRegister->apodization.clear();
|
|
|
|
// for (quint8 i = 0; i < 4; i++)
|
|
// {
|
|
// temp.clear();
|
|
// for (quint16 j = 0; j < 3057; j++)
|
|
// {
|
|
// temp.append(j);
|
|
// }
|
|
// _scenParams->hwRegister->apodization.append(temp);
|
|
// }
|
|
}
|
|
|
|
void MainWindow::setPulseProperties()
|
|
{
|
|
// _scenParams->hwRegister->pulse->halfPeriod.clear();
|
|
// _scenParams->hwRegister->pulse->halfCycleNo.clear();
|
|
// _scenParams->hwRegister->pulse->startPhase.clear();
|
|
// _scenParams->hwRegister->pulse->pulseVoltSel.clear();
|
|
// _scenParams->hwRegister->pulse->dampingPulseWidth.clear();
|
|
|
|
|
|
// for (quint8 i = 0; i < 8; i++){
|
|
|
|
// _scenParams->hwRegister->pulse->halfPeriod.append(i);
|
|
// _scenParams->hwRegister->pulse->halfCycleNo.append(i*2);
|
|
// _scenParams->hwRegister->pulse->startPhase.append((i % 2)==0);
|
|
// _scenParams->hwRegister->pulse->pulseVoltSel.append((i % 2)==0);
|
|
// _scenParams->hwRegister->pulse->dampingPulseWidth.append(i*3);
|
|
|
|
// }
|
|
}
|
|
|
|
//void MainWindow::setAfeProperties()
|
|
//{
|
|
// _scenParams->afe->lpfProg.clear();
|
|
// _scenParams->afe->pgaHpfDis.clear();
|
|
// _scenParams->afe->pgaClampDis.clear();
|
|
// _scenParams->afe->pgaGain.clear();
|
|
// _scenParams->afe->gblActiveTerm.clear();
|
|
// _scenParams->afe->actTermEn.clear();
|
|
// _scenParams->afe->inputClampLvl.clear();
|
|
// _scenParams->afe->lnaHpfDis.clear();
|
|
// _scenParams->afe->lnaGainGbl.clear();
|
|
// _scenParams->afe->lowNf.clear();
|
|
// _scenParams->afe->powModes.clear();
|
|
// _scenParams->afe->gblPdwn.clear();
|
|
// _scenParams->afe->lnaHpfProg.clear();
|
|
|
|
// for (quint8 i = 0; i < 8; i++){
|
|
|
|
// _scenParams->afe->lpfProg.append(i);
|
|
// _scenParams->afe->pgaHpfDis.append((i % 2)==0);
|
|
// _scenParams->afe->pgaClampDis.append((i % 2)==0);
|
|
// _scenParams->afe->pgaGain.append((i % 2)==0);
|
|
// _scenParams->afe->gblActiveTerm.append((i*2) % 3);
|
|
// _scenParams->afe->actTermEn.append((i % 2)==0);
|
|
// _scenParams->afe->inputClampLvl.append((i*3) % 7);
|
|
// _scenParams->afe->lnaHpfDis.append((i % 2)==0);
|
|
// _scenParams->afe->lnaGainGbl.append((i*4) % 3);
|
|
// _scenParams->afe->lowNf.append((i % 2)==0);
|
|
// _scenParams->afe->powModes.append((i*5) % 3);
|
|
// _scenParams->afe->gblPdwn.append((i % 2)==0);
|
|
// _scenParams->afe->lnaHpfProg.append((i*6) % 3);
|
|
|
|
// }
|
|
//}
|
|
|
|
|
|
void MainWindow::on_btn_scenParams_clicked()
|
|
{
|
|
ui->l_scenParams->setText("doing");
|
|
changeLabelTextColor(ui->l_scenParams, Qt::red);
|
|
|
|
_scenParams.focusTypeNumber = 100;
|
|
_scenParams.totalTxShotNumber = 100;
|
|
|
|
for (int var = 0; var < 100; var++) {
|
|
_scenParams.rxBeamFormerNumber.append(5);
|
|
}
|
|
|
|
auto startIndex = ui->tb_startIdx->text().toUInt(Q_NULLPTR, 16);
|
|
if(startIndex == 0 && ui->tb_startIdx->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for start index");
|
|
return;
|
|
}
|
|
|
|
auto endIndex = ui->tb_endIdx->text().toUInt(Q_NULLPTR, 16);
|
|
if(endIndex == 0 && ui->tb_endIdx->text() != "0")
|
|
{
|
|
MESSAGE_BOX("Invalid input format for stop index");
|
|
return;
|
|
}
|
|
_scenParams.hwRegister.scenarioStartIndex = startIndex;
|
|
_scenParams.hwRegister.scenarioEndIndex = endIndex;
|
|
|
|
try
|
|
{
|
|
_trx.setScenario(_scenParams);
|
|
}
|
|
|
|
catch(SonoException& e)
|
|
{
|
|
qDebug() << e.what();
|
|
}
|
|
|
|
ui->l_scenParams->setText("done");
|
|
changeLabelTextColor(ui->l_scenParams, Qt::green);
|
|
}
|
|
|