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.
		
		
		
		
			
				
					2822 lines
				
				88 KiB
			
		
		
			
		
	
	
					2822 lines
				
				88 KiB
			| 
											5 years ago
										 | #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(); | ||
|  |     _usd->device->init(); | ||
|  | 
 | ||
|  |     _timer = new QTimer(); | ||
|  | //    _dial = new WaitDialog();
 | ||
|  | //    _dial->setModal(true);
 | ||
|  | 
 | ||
|  | 
 | ||
|  | //    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(_timer, &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);
 | ||
|  | 
 | ||
|  |     //_timer->start(5000);
 | ||
|  | 
 | ||
|  |      setReceiverConfiguration(); | ||
|  |      setBlendWeight(); | ||
|  |      setLineFilter(); | ||
|  |      setStbCoeff(); | ||
|  |      setFreqLut(); | ||
|  |      setDTgc(); | ||
|  |      setATgc(); | ||
|  |      setLpf(); | ||
|  | } | ||
|  | 
 | ||
|  | MainWindow::~MainWindow() | ||
|  | { | ||
|  |     delete ui; | ||
|  | 
 | ||
|  |     delete _settings; | ||
|  | 
 | ||
|  |     delete _usd; | ||
|  | 
 | ||
|  |     //delete _dial;
 | ||
|  | 
 | ||
|  |     delete _timer; | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | /*************************************************************************************************/ | ||
|  | //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)
 | ||
|  | //{
 | ||
|  | //    trx.slaveFpgaProgram(path);
 | ||
|  | //}
 | ||
|  | 
 | ||
|  | /*************************************************************************************************/ | ||
|  | //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");
 | ||
|  | //        }
 | ||
|  | 
 | ||
|  | //auto detectedPrb = _usd->readWord(0x26078, 0);
 | ||
|  | //    detectedPrb = detectedPrb & (0xF);
 | ||
|  | //    if(detectedPrb == 0x7){
 | ||
|  | //        ui->l_detectedProbe->setText("D");
 | ||
|  | //    }
 | ||
|  | //    else if (detectedPrb == 0xB) {
 | ||
|  | //        ui->l_detectedProbe->setText("C");
 | ||
|  | //    }
 | ||
|  | //    else if (detectedPrb == 0xD) {
 | ||
|  | //        ui->l_detectedProbe->setText("B");
 | ||
|  | //    }
 | ||
|  | //    else if (detectedPrb == 0xE) {
 | ||
|  | //        ui->l_detectedProbe->setText("A");
 | ||
|  | //    }
 | ||
|  | //    else{
 | ||
|  | //        ui->l_detectedProbe->setText("None");
 | ||
|  | //    }
 | ||
|  | 
 | ||
|  |     delay(10); | ||
|  | //    auto tempSensor = _usd->readWord(0x26078, 0);
 | ||
|  | //    float temp = tempSensor;
 | ||
|  | //    if (((tempSensor >>  10) & 0x01) == 0x01)
 | ||
|  | //    {
 | ||
|  | //        temp *= -1;
 | ||
|  | //    }
 | ||
|  | //    temp *= 0.125f;
 | ||
|  |     // auto detected_probe = _usd->readWord(0, 0);
 | ||
|  |     // ui->l_detectedProbe->setText(QString::number(detected_probe, 16));
 | ||
|  |    //  delay(100);
 | ||
|  | 
 | ||
|  |      //auto interruptVec = _usd->readWord(0x0, 0);
 | ||
|  |      //ui->l_intrVector->setText(QString::number(interruptVec, 16));
 | ||
|  | 
 | ||
|  |     HealthStatus* healStatus; | ||
|  |     trx.getHealthStatus(healStatus); | ||
|  | 
 | ||
|  |     float tempSensor = healStatus->systemTemperature; | ||
|  |     ui->l_Temp->setText(QString("%1").arg(tempSensor)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh1 = healStatus->adcMon->mon12Vin; | ||
|  |     ui->l_adcCh1->setText(QString("%1").arg(adcCh1)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh2 = healStatus->adcMon->mon5Vin; | ||
|  |     ui->l_adcCh2->setText(QString("%1").arg(adcCh2)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh3 = healStatus->adcMon->prbZeroEncoder; | ||
|  |     ui->l_adcCh3->setText(QString("%1").arg(adcCh3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh4 = healStatus->adcMon->prbCtrl3P3V; | ||
|  |     ui->l_adcCh4->setText(QString("%1").arg(adcCh4)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh5 = healStatus->adcMon->afeVcntlp; | ||
|  |     ui->l_adcCh5->setText(QString("%1").arg(adcCh5)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh6 = healStatus->adcMon->mon3P3V; | ||
|  |     ui->l_adcCh6->setText(QString("%1").arg(adcCh6)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh7 = healStatus->adcMon->monAfeA1P8V; | ||
|  |     ui->l_adcCh7->setText(QString("%1").arg(adcCh7)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto adcCh8 = healStatus->adcMon->monAfeD1P8V; | ||
|  |     ui->l_adcCh8->setText(QString("%1").arg(adcCh8)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  | //    bool fan1=pwr.getFan1Fault();
 | ||
|  | //    ui->l_fan1Flt->setText(QVariant(fan1).toString());
 | ||
|  | //    auto colorFan1 = fan1 ? Qt::red : Qt::green;
 | ||
|  | //    changeLabelTextColor(ui->l_fan1Flt, colorFan1);
 | ||
|  | //    delay(10);
 | ||
|  | 
 | ||
|  | //    bool fan2=pwr.getFan2Fault();
 | ||
|  | //    ui->l_fan2Flt->setText(QVariant(fan2).toString());
 | ||
|  | //    auto colorFan2 = fan2 ? Qt::red : Qt::green;
 | ||
|  | //    changeLabelTextColor(ui->l_fan2Flt, colorFan2);
 | ||
|  | //    delay(10);
 | ||
|  | 
 | ||
|  | //    bool cmdDoneI2c=pwr.getI2cCmdDone();
 | ||
|  | //    ui->l_cmdDone->setText(QVariant(cmdDoneI2c).toString());
 | ||
|  | //    auto colorCmdDone = cmdDoneI2c ? Qt::green : Qt::red;
 | ||
|  | //    changeLabelTextColor(ui->l_cmdDone, colorCmdDone);
 | ||
|  | //    delay(10);
 | ||
|  | 
 | ||
|  | //    bool cmdErrorI2c=pwr.getI2cCmdErr();
 | ||
|  | //    ui->l_cmdError->setText(QVariant(cmdErrorI2c).toString());
 | ||
|  | //    auto colorCmdError = cmdErrorI2c ? Qt::red : Qt::green;
 | ||
|  | //    changeLabelTextColor(ui->l_cmdError, colorCmdError);
 | ||
|  | //    delay(10);
 | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | /*************************************************************************************************/ | ||
|  | //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, 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() | ||
|  | { | ||
|  | //    auto bar = 0;
 | ||
|  | //    auto offset = 0x400;
 | ||
|  | 
 | ||
|  |     auto path = ui->tb_fpgaBit->text(); | ||
|  |     try { | ||
|  |         trx.slaveFpgaProgram(path); | ||
|  |         return; | ||
|  |     } | ||
|  |     catch (SonoException& e) { | ||
|  |         qDebug() << e.what(); | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  | //    QFutureWatcher<void> watcher;
 | ||
|  | //    connect(&watcher, &QFutureWatcher<void>::finished, this, &MainWindow::threadFinished);
 | ||
|  | //    auto future = QtConcurrent::run(this, &MainWindow::fpgaProgrammer, bar, offset, 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_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;
 | ||
|  | 
 | ||
|  |     //on probe change
 | ||
|  |     auto 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) | ||
|  | { | ||
|  |     QEventLoop* loop; | ||
|  |     QTimer* timer; | ||
|  |     timer->singleShot(ms, loop, SLOT(QEventLoop::quit)); | ||
|  | //    connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
 | ||
|  | //    timer.start(msec);
 | ||
|  |     loop->exec(); | ||
|  | //    timer.stop();
 | ||
|  | } | ||
|  | 
 | ||
|  | /*************************************************************************************************/ | ||
|  | /*********************************************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);
 | ||
|  | 
 | ||
|  | //      trx.mpsSetAo(hvaValue, hvbValue);
 | ||
|  | 
 | ||
|  | ////    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_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_sup24v_stateChanged(int arg1)
 | ||
|  | //{
 | ||
|  | //    bool i2cBusy, i2cDone;
 | ||
|  | 
 | ||
|  | ////    i2cBusy=pwr.getI2cBusy();
 | ||
|  | ////    while (i2cBusy==true) {
 | ||
|  | ////        i2cBusy=pwr.getI2cBusy();
 | ||
|  | ////    }
 | ||
|  | 
 | ||
|  | //    if (ui->chk_sup24v->isChecked())
 | ||
|  | //    {
 | ||
|  | ////        i2cBusy=pwr.getI2cBusy();
 | ||
|  | ////        while (i2cBusy==true) {
 | ||
|  | ////            i2cBusy=pwr.getI2cBusy();
 | ||
|  | ////        }
 | ||
|  | ////       // delay (100);
 | ||
|  | 
 | ||
|  | //        trx.init();     // p24_On
 | ||
|  | ////        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();
 | ||
|  | ////    }
 | ||
|  | //    trx.mpsReset();
 | ||
|  | //}
 | ||
|  | 
 | ||
|  | /*************************************************************************************************/ | ||
|  | void MainWindow::on_btn_updateRdbackValue_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     SupervisorRbValue* supRbValue; | ||
|  |     trx.supervisorRbValue(supRbValue); | ||
|  | 
 | ||
|  | 
 | ||
|  |     auto hvapValue=supRbValue->hvap; | ||
|  |     ui->l_hvap->setText(QString::number(hvapValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto hvbpValue=supRbValue->hvbp; | ||
|  |     ui->l_hvbp->setText(QString::number(hvbpValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto cwdpValue=supRbValue->cwdp; | ||
|  |     ui->l_cwdp->setText(QString::number(cwdpValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto curr24vValue=supRbValue->curr24V; | ||
|  |     ui->l_curr24v->setText(QString::number(curr24vValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto p24vValue=supRbValue->p24V; | ||
|  |     ui->l_p24v->setText(QString::number(p24vValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto p12vValue=supRbValue->p12V; | ||
|  |     ui->l_p12v->setText(QString::number(p12vValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto p5vValue=supRbValue->p5V; | ||
|  |     ui->l_p5v->setText(QString::number(p5vValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto m5vValue=supRbValue->m5V; | ||
|  |     ui->l_m5v->setText(QString::number(m5vValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto hvStopValue=supRbValue->hvStop; | ||
|  |     ui->l_hvStop->setText(QString::number(hvStopValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     auto p4dValue=supRbValue->p4D; | ||
|  |     ui->l_p4d->setText(QString::number(p4dValue, 'f', 3)); | ||
|  |     delay(10); | ||
|  | 
 | ||
|  |     /********************Faults***********************/ | ||
|  |     MpsFaultStatus* faultStatus; | ||
|  |     trx.mpsFaultStatus(faultStatus); | ||
|  | 
 | ||
|  |     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()
 | ||
|  | //{
 | ||
|  | //    uint32_t offsetVersion[4] = {0x4,0x14000C*4,0x24000C*4,0x34000C*4};
 | ||
|  | //    auto value = _usd->readWord(offsetVersion[0], 0);
 | ||
|  | //    ui->l_masterVersion->setText(QStringLiteral("%1").arg(value, 8, 10));
 | ||
|  | //    value = _usd->readWord(offsetVersion[1], 0);
 | ||
|  | //    ui->l_slave0Version->setText(QStringLiteral("%1").arg(value, 8, 10));
 | ||
|  | //    value = _usd->readWord(offsetVersion[2], 0);
 | ||
|  | //    ui->l_slave1Version->setText(QStringLiteral("%1").arg(value, 8, 10));
 | ||
|  | //    value = _usd->readWord(offsetVersion[3], 0);
 | ||
|  | //    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);
 | ||
|  | 
 | ||
|  | //}
 | ||
|  | 
 | ||
|  | void MainWindow::setReceiverConfiguration() | ||
|  | { | ||
|  |     _receiveConfig->mla.clear(); | ||
|  |     _receiveConfig->stb.clear(); | ||
|  |     _receiveConfig->lpfSel.clear(); | ||
|  |     _receiveConfig->aTgcSel.clear(); | ||
|  |     _receiveConfig->focusNo.clear(); | ||
|  |     _receiveConfig->lineMode.clear(); | ||
|  |     _receiveConfig->ncoFreqSel.clear(); | ||
|  |     _receiveConfig->absEn.clear(); | ||
|  |     _receiveConfig->ddcEn.clear(); | ||
|  |     _receiveConfig->dpeEn.clear(); | ||
|  |     _receiveConfig->stbEn.clear(); | ||
|  |     _receiveConfig->wmfEn.clear(); | ||
|  |     _receiveConfig->dcCancelerEn.clear(); | ||
|  |     _receiveConfig->lineFilterEn.clear(); | ||
|  |     _receiveConfig->subtractFilterEn.clear(); | ||
|  | 
 | ||
|  |     for (quint8 i = 0; i < 8; i++){ | ||
|  |         _receiveConfig->mla.append(i); | ||
|  |         _receiveConfig->stb.append(i*2); | ||
|  |         _receiveConfig->lpfSel.append(i*3); | ||
|  |         _receiveConfig->aTgcSel.append(i*4); | ||
|  |         _receiveConfig->focusNo.append(i*5); | ||
|  |         _receiveConfig->lineMode.append(i*6); | ||
|  |         _receiveConfig->ncoFreqSel.append(i*7); | ||
|  |         _receiveConfig->absEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->ddcEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->dpeEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->stbEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->wmfEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->dcCancelerEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->lineFilterEn.append((i % 2)!=0); | ||
|  |         _receiveConfig->subtractFilterEn.append((i % 2)!=0); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_receiveConfig_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_receiveConfigState->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_receiveConfigState, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenReceiverConfigurationLut(_receiveConfig); | ||
|  | 
 | ||
|  |     ui->l_receiveConfigState->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_receiveConfigState, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setLineFilter() | ||
|  | { | ||
|  |     _lineFilter.clear(); | ||
|  |     for (quint8 i = 0; i < 4; i++) | ||
|  |     { | ||
|  |         _lineFilter.append(i*10); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_lineFilter_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_lineFilter->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_lineFilter, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenLineFilterCoefficient(_lineFilter); | ||
|  | 
 | ||
|  |     ui->l_lineFilter->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_lineFilter, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setFreqLut() | ||
|  | { | ||
|  |     _freq.clear(); | ||
|  |     for (quint8 i = 0; i < 8; i++) | ||
|  |     { | ||
|  |         _freq.append(i*10); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_freqLut_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_freq->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_freq, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenFrequencyLut(_freq); | ||
|  | 
 | ||
|  |     ui->l_freq->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_freq, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setStbCoeff() | ||
|  | { | ||
|  |     _stb.clear(); | ||
|  |     for (quint8 i = 0; i < 8; i++) | ||
|  |     { | ||
|  |         _stb.append(i*10); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_stbCoeff_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_stbCoeff->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_stbCoeff, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenStbCoefficient(_stb); | ||
|  | 
 | ||
|  |     ui->l_stbCoeff->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_stbCoeff, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setATgc() | ||
|  | { | ||
|  |     QList<quint32> temp; | ||
|  |     _aTgc.clear(); | ||
|  | 
 | ||
|  |     for (quint8 i = 0; i < 4; i++) | ||
|  |     { | ||
|  |         temp.clear(); | ||
|  |         for (quint16 j = 0; j < 256; j++) | ||
|  |         { | ||
|  |             temp.append(j); | ||
|  |         } | ||
|  |         _aTgc.append(temp); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_atgc_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_atgc->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_atgc, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenAtgcLut(_aTgc); | ||
|  | 
 | ||
|  |     ui->l_atgc->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_atgc, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setDTgc() | ||
|  | { | ||
|  |     _dTgc.clear(); | ||
|  |     for (quint16 i = 0; i < 1024; i++) | ||
|  |     { | ||
|  |         _dTgc.append(i*10); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_dtgc_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_dtgc->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_dtgc, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenDtgcLut(_dTgc); | ||
|  | 
 | ||
|  |     ui->l_dtgc->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_dtgc, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setBlendWeight() | ||
|  | { | ||
|  |     QList<quint32> temp; | ||
|  |     _blendWeight.clear(); | ||
|  | 
 | ||
|  |     for (quint8 i = 0; i < 4; i++) | ||
|  |     { | ||
|  |         temp.clear(); | ||
|  |         for (quint16 j = 0; j < 512; j++) | ||
|  |         { | ||
|  |             temp.append(j); | ||
|  |         } | ||
|  |         _blendWeight.append(temp); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_blendWeight_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_blendWeight->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_blendWeight, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenBlendWeight(_blendWeight); | ||
|  | 
 | ||
|  |     ui->l_blendWeight->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_blendWeight, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | void MainWindow::setLpf() | ||
|  | { | ||
|  |     QList<quint32> temp; | ||
|  |     _lpf.clear(); | ||
|  | 
 | ||
|  |     for (quint8 i = 0; i < 4; i++) | ||
|  |     { | ||
|  |         temp.clear(); | ||
|  |         for (quint8 j = 0; j < 48; j++) | ||
|  |         { | ||
|  |             temp.append(j); | ||
|  |         } | ||
|  |         _lpf.append(temp); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | void MainWindow::on_btn_lpf_clicked() | ||
|  | { | ||
|  | 
 | ||
|  |     ui->l_lpf->setText("false"); | ||
|  |     changeLabelTextColor(ui->l_lpf, Qt::red); | ||
|  | 
 | ||
|  |     trx.scenLpfLut(_lpf); | ||
|  | 
 | ||
|  |     ui->l_lpf->setText("true"); | ||
|  |     changeLabelTextColor(ui->l_lpf, Qt::green); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | 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)); | ||
|  | } |