@ -38,20 +38,7 @@ MainWindow::MainWindow(QWidget* parent)
ui - > plot_2 - > xAxis - > setLabel ( " Line " ) ;
ui - > plot_2 - > yAxis - > setLabel ( " Point " ) ;
//ui->prg_adcSim->setVisible(false);
//ui->prg_scenarioUpload->setVisible(false);
//ui->prg_txDacUpload->setVisible(false);
//ui->prg_fpgaProgram->setVisible(false);
//ui->prg_adcLoggerFileWr->setVisible(false);
//ui->tb_scenarioFile->setReadOnly(true);
//ui->tb_paramFile->setReadOnly(true);
//ui->tb_txDacFile->setReadOnly(true);
ui - > tb_fpgaBit - > setReadOnly ( true ) ;
//ui->tb_scenarioFile->setText(_settings->value(SCENARIO_FILE_PATH).value<QString>());
//ui->tb_paramFile->setText(_settings->value(PARAM_FILE_PATH).value<QString>());
//ui->tb_txDacFile->setText(_settings->value(TX_DAC_FILE_PATH).value<QString>());
ui - > rbtn_reg - > setChecked ( _settings - > value ( REG_ACCESS_SEL ) . value < bool > ( ) ) ;
ui - > rbtn_offset - > setChecked ( ! _settings - > value ( REG_ACCESS_SEL ) . value < bool > ( ) ) ;
ui - > tb_fpgaBit - > setText ( _settings - > value ( FPGA_FILE_PATH ) . value < QString > ( ) ) ;
@ -65,19 +52,7 @@ MainWindow::MainWindow(QWidget* parent)
ui - > tb_prbCtrlRomInfo - > setPlaceholderText ( " info " ) ;
ui - > tb_prbRomIdRead - > setPlaceholderText ( " id(hex) " ) ;
ui - > tb_prbRomImpulseRead - > setPlaceholderText ( " impulse " ) ;
//connect(this, &MainWindow::updateBlockProgressValue, this,
//&MainWindow::newBlockProgressValue);
//connect(this, &MainWindow::updateFpgaProgressValue, this, &MainWindow::newFpgaProgressValue);
//connect(this, &MainWindow::updateBlockProgressVisibility, this,
//&MainWindow::newBlockProgressVisibility);
//connect(this, &MainWindow::updateFpgaProgressVisibility, this,
//&MainWindow::newFpgaProgressVisibility);
//connect(this, &MainWindow::updateAdcLoggerProgressValue, this,
//&MainWindow::newAdcLoggerProgressValue);
//connect(this, &MainWindow::updateAdcLoggerProgressVisibility, this,
//&MainWindow::newAdcLoggerProgressVisibility);
ui - > tb_scenInfo - > setPlaceholderText ( " Scenario Information " ) ;
connect ( ui - > action_Exit , & QAction : : triggered , this , & MainWindow : : exitApp ) ;
connect ( this , & MainWindow : : showMessage , this , & MainWindow : : newMessage ) ;
@ -117,7 +92,10 @@ MainWindow::MainWindow(QWidget* parent)
_dmaLog = false ;
_dmaRun = false ;
_fpsFlag = false ;
_dmaShow = false ;
_getPacket = false ;
_frameCount = 0 ;
setAfeConfig ( ) ;
@ -354,6 +332,16 @@ MainWindow::~MainWindow()
/*************************************************************************************************/
void MainWindow : : timeout ( )
{
fps = static_cast < double_t > ( float_t ( _frameCount ) / ( float_t ( _timeout - > interval ( ) ) / 1000.0f ) ) ;
if ( ui - > chk_continuousShowing - > isChecked ( ) | | _fpsFlag )
{
ui - > l_frameTime - > setText ( QString : : number ( fpsBuf , ' g ' , 3 ) + " fps " ) ;
}
else
ui - > l_frameTime - > setText ( QString : : number ( fps , ' g ' , 3 ) + " fps " ) ;
_frameCount = 0 ;
_fpsFlag = false ;
auto pcie_pid = _trx . deviceId ( ) ;
auto pcie_vid = _trx . vendorId ( ) ;
auto pcie_id = ( pcie_pid < < 16 ) | pcie_vid ;
@ -551,6 +539,7 @@ void MainWindow::timeout()
color = probeDetChanInterrupt ? Qt : : red : Qt : : green ;
changeLabelTextColor ( ui - > l_prbDetChg , color ) ;
if ( probeDetChanInterrupt )
{
emit connectedPrbChange ( ) ;
@ -936,7 +925,7 @@ void MainWindow::on_btn_fpgaProgram_clicked()
{
auto path = ui - > tb_fpgaBit - > text ( ) ;
//emit programmingGif( );
//QtConcurrent::run(this, &MainWindow::gifActive );
QString str = " doing " ;
QColor color = Qt : : red ;
@ -951,6 +940,10 @@ void MainWindow::on_btn_fpgaProgram_clicked()
//ui->l_programming->hide();
}
void MainWindow : : gifActive ( )
{
//emit programmingGif();
}
/*************************************************************************************************/
void MainWindow : : newMessage ( QString message )
{
@ -1192,11 +1185,51 @@ void MainWindow::getFramePacket(QByteArray packet)
_dmaBuffer . push_back ( packet ) ;
_lastBuffer = packet ;
_mutex . unlock ( ) ;
quint16 batchId = ( ( static_cast < quint16 > ( _lastBuffer [ 128 ] ) ) & 0x00FF ) |
( ( ( static_cast < quint16 > ( _lastBuffer [ 129 ] ) ) < < 8 ) & 0xFF00 ) ;
quint8 subBatchId = ( static_cast < quint8 > ( _lastBuffer [ 130 ] ) ) ;
// quint8 frmType = (static_cast<quint8>(_lastBuffer[131]));
// quint8 cri = (static_cast<quint8>(_lastBuffer[132]));
// quint16 bLine = ((static_cast<quint16>(_lastBuffer[136])) & 0x00FF) |
// (((static_cast<quint16>(_lastBuffer[137])) << 8) & 0xFF00);
// quint16 bPoint = ((static_cast<quint16>(_lastBuffer[138])) & 0x00FF) |
// (((static_cast<quint16>(_lastBuffer[139])) << 8) & 0xFF00);
// quint8 mLine = (static_cast<quint8>(_lastBuffer[140]));
// quint16 mPoint = ((static_cast<quint16>(_lastBuffer[141])) & 0x00FF) |
// (((static_cast<quint16>(_lastBuffer[142])) << 8) & 0xFF00);
if ( subBatchId = = 0 )
{
_frameCount + + ;
if ( _getPacket )
{
if ( _batchIdBuff = = batchId & & ( batchId - _batchIdBuff ) > 1 )
MESSAGE_BOX ( " The batch id error is happened. " ) ;
}
_batchIdBuff = batchId ;
_getPacket = true ;
}
// if(batchId < 3)
// {
// qDebug() << "batchId" << batchId;
// qDebug() << "subBatchId" << subBatchId;
// qDebug() << "bLine" << bLine;
// qDebug() << "bPoint" << bPoint;
// qDebug() << "frmType" << frmType;
// qDebug() << "cri" << cri;
// qDebug() << "mLine" << mLine;
// qDebug() << "mPoint" << mPoint;
// }
}
/*************************************************************************************************/
void MainWindow : : on_chk_continuousShowing_clicked ( )
{
fpsBuf = fps ;
_fpsFlag = true ;
if ( _dmaRun & & ui - > chk_continuousShowing - > isChecked ( ) )
{
QtConcurrent : : run ( this , & MainWindow : : on_btn_dmaShow_clicked ) ;
@ -1221,6 +1254,7 @@ void MainWindow::fillRam(QString path)
/*************************************************************************************************/
void MainWindow : : on_btn_scenStart_clicked ( )
{
_frameCount = 0 ;
try
{
auto str = ui - > btn_scenStart - > text ( ) ;
@ -1229,7 +1263,7 @@ void MainWindow::on_btn_scenStart_clicked()
ui - > btn_scenStart - > setText ( " Scenario Stop " ) ;
ui - > btn_emulator - > setText ( " Emulator Start " ) ;
ui - > btn_dmaLogLast - > setVisible ( true ) ;
_trx . scenPlayerStart ( ) ;
_trx . scenPlayerStart ( true ) ;
_dmaLog = true ;
_dmaRun = true ; //flag
_dmaBuffer . clear ( ) ;
@ -1243,7 +1277,7 @@ void MainWindow::on_btn_scenStart_clicked()
ui - > btn_dmaLogLast - > setHidden ( true ) ;
_dmaLog = false ;
_dmaRun = false ;
_trx . scenPlayerStop ( ) ;
_trx . scenPlayerStop ( true ) ;
}
}
catch ( SonoException & e )
@ -1284,7 +1318,7 @@ void MainWindow::on_btn_emulator_clicked()
_emul - > transferLength = TRANSFER_LENGTH ;
_emul - > ramBufAddress = RAM_BUFFER_OFFSET ;
_emul - > transferRate = TRANSFER_RATE ;
_emul - > emulOption = functionality ;
_emul - > emulOption = performance ;
_emul - > emulMode = dynamically ;
_trx . emulatorInit ( _emul ) ;
ui - > btn_emulator - > setText ( " Emulator Stop " ) ;
@ -1294,7 +1328,6 @@ void MainWindow::on_btn_emulator_clicked()
_dmaLog = true ;
_dmaRun = true ;
_dmaBuffer . clear ( ) ;
//QtConcurrent::run(this, &MainWindow::logPcie);
}
else
{
@ -1369,7 +1402,7 @@ void MainWindow::logPcie()
QFile file ( path ) ;
file . open ( QIODevice : : WriteOnly ) ;
//file.write(temp);
file . write ( temp ) ;
file . close ( ) ;
emit sendLogCount ( _dmaLogCount , progress ) ;
@ -1455,7 +1488,7 @@ void MainWindow::show3d()
quint8 mLine = ( static_cast < quint8 > ( temp [ 140 ] ) ) ;
quint16 mPoint = ( ( static_cast < quint16 > ( temp [ 141 ] ) ) & 0x00FF ) |
( ( ( static_cast < quint16 > ( temp [ 142 ] ) ) < < 8 ) & 0xFF00 ) ;
if ( bLine > 256 )
if ( bLine > 256 * 8 )
{
qDebug ( ) < < " ERROR :: (B Line) " < < bLine ;
@ -1474,6 +1507,7 @@ void MainWindow::show3d()
return ;
}
qDebug ( ) < < " batchId " < < batchId ;
qDebug ( ) < < " subBatchId " < < subBatchId ;
qDebug ( ) < < " bLine " < < bLine ;
@ -1513,7 +1547,7 @@ void MainWindow::show3d()
}
//qDebug() << "indx" << indx;
//qDebug() << "max" << max;
qDebug ( ) < < ui - > plot_2 - > plotLayout ( ) - > hasElement ( 0 , 1 ) ;
//qDebug() << ui->plot_2->plotLayout()->hasElement(0, 1);
if ( ! ui - > plot_2 - > plotLayout ( ) - > hasElement ( 0 , 1 ) )
{
@ -2559,9 +2593,31 @@ void MainWindow::on_btn_scenBrowse_clicked()
auto selectedPath = fileDialog . selectedFiles ( ) [ 0 ] ;
ui - > tb_scenFilesPath - > setText ( selectedPath ) ;
_settings - > setValue ( SCENARIO_FILE_PATH , selectedPath ) ;
ui - > tb_scenInfo - > clear ( ) ;
}
}
/*************************************************************************************************/
void MainWindow : : on_btn_scenInfo_clicked ( )
{
QString scenInfo = " /hardware/systemCheckParam.csv " ;
QString path = ui - > tb_scenFilesPath - > text ( ) + scenInfo ;
QFile sysFile ( path ) ;
if ( sysFile . fileName ( ) . isEmpty ( ) )
{
throw SonoException ( " No file is selected " ) ;
}
if ( ! sysFile . open ( QIODevice : : ReadOnly ) )
{
throw SonoException ( " Couldn't open system check param file programming " ) ;
}
QTextStream checkParam ( & sysFile ) ;
QString systemStr = checkParam . readAll ( ) ;
ui - > tb_scenInfo - > setPlainText ( systemStr ) ;
}
/*************************************************************************************************/
void MainWindow : : on_btn_setAtgcMode_clicked ( )
{
@ -3108,5 +3164,8 @@ void MainWindow::setAfeConfig()
/*************************************************************************************************/
void MainWindow : : exitApp ( )
{
auto str = ui - > btn_scenStart - > text ( ) ;
if ( str = = " Scenario Stop " )
on_btn_scenStart_clicked ( ) ;
this - > QWidget : : close ( ) ;
}