Browse Source

Some features change in UI

Arash Aletayeb 2 years ago
parent
commit
663c533f7b
  1. 2
      developHw.pro.user
  2. 106
      mainwindow.cpp
  3. 21
      mainwindow.h
  4. 86
      mainwindow.ui

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2023-01-01T14:09:39. -->
<!-- Written by QtCreator 4.10.0, 2023-02-20T16:12:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

106
mainwindow.cpp

@ -2806,6 +2806,26 @@ QString MainWindow::byteArray2InfoString (QByteArray& arr)
return infoStr;
}
QByteArray MainWindow::crcWrite(const QList<quint8> &crcArray)
{
QByteArray crcByteArray;
foreach (auto byte, crcArray)
{
crcByteArray.push_back(static_cast<qint8>(byte));
}
return crcByteArray;
}
QByteArray MainWindow::e2promClear(quint32 length)
{
QByteArray clearRom;
for(quint32 i = 0; i < length; i++)
{
clearRom.push_back(char(0));
}
return clearRom;
}
/*************************************************************************************************/
/*************************************************************************************************/
void MainWindow::on_btn_trxRomIdWrite_clicked()
@ -2813,6 +2833,9 @@ void MainWindow::on_btn_trxRomIdWrite_clicked()
QString idStr = ui->tb_trxRomId->text();
try
{
QByteArray clearId = e2promClear(EEPROM_ID_NUMBER);
trxEepromWrite(clearId, EEPROM_ID_BEGIN, _bCtrl);
QByteArray sendingArray = str2ByteArray(idStr);
trxEepromWrite(sendingArray, EEPROM_ID_BEGIN, _bCtrl);
}
@ -2832,17 +2855,11 @@ void MainWindow::on_btn_trxRomInfoWrite_clicked()
QString infoStr = ui->tb_trxRomInfo->toPlainText();
try
{
QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER);
trxEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl);
QByteArray sendingArray = infoStr.toLatin1();
trxEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl);
//QByteArray sendingArray;
//unsigned char crcArray[] = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1,
//0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2,
//0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//for(auto var : crcArray)
//sendingArray.push_back(static_cast<char>(var));
//trxEepromWrite(sendingArray, EEPROM_CRC_BEGIN, _bCtrl); // TRX
}
catch(SonoException& e)
{
@ -2894,12 +2911,34 @@ void MainWindow::on_btn_trxRomInfoRead_clicked()
}
}
/*************************************************************************************************/
void MainWindow::on_chk_clearTrxRom_clicked(bool checked)
{
if(checked)
{
QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE);
trxEepromWrite(clearAll, 0, _bCtrl);
}
}
/*************************************************************************************************/
void MainWindow::on_chk_writeCrcTrxRom_clicked(bool checked)
{
if(checked)
{
QByteArray crc = crcWrite(crcArray);
trxEepromWrite(crc, EEPROM_CRC_BEGIN, _bCtrl);
}
}
/*************************************************************************************************/
void MainWindow::on_btn_mpsRomIdWrite_clicked()
{
QString idStr = ui->tb_mpsRomId->text();
try
{
QByteArray clearId = e2promClear(EEPROM_ID_NUMBER);
mpsEepromWrite(clearId, EEPROM_ID_BEGIN, _bCtrl);
QByteArray sendingArray = str2ByteArray(idStr);
mpsEepromWrite(sendingArray, EEPROM_ID_BEGIN, _bCtrl);
}
@ -2919,6 +2958,9 @@ void MainWindow::on_btn_mpsRomInfoWrite_clicked()
QString infoStr = ui->tb_mpsRomInfo->toPlainText();
try
{
QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER);
mpsEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl);
QByteArray sendingArray = infoStr.toLatin1();
mpsEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl);
}
@ -2972,12 +3014,35 @@ void MainWindow::on_btn_mpsRomInfoRead_clicked()
}
}
/*************************************************************************************************/
void MainWindow::on_chk_clearMpsRom_clicked(bool checked)
{
if(checked)
{
QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE);
mpsEepromWrite(clearAll, 0, _bCtrl);
}
}
/*************************************************************************************************/
void MainWindow::on_chk_writeCrcMpsRom_clicked(bool checked)
{
if(checked)
{
QByteArray crc = crcWrite(crcArray);
mpsEepromWrite(crc, EEPROM_CRC_BEGIN, _bCtrl);
}
}
/*************************************************************************************************/
void MainWindow::on_btn_prbCtrlRomIdWrite_clicked()
{
QString idStr = ui->tb_prbCtrlRomId->text();
try
{
QByteArray clearId = e2promClear(EEPROM_ID_NUMBER);
prbCtrlEepromWrite(clearId, EEPROM_ID_BEGIN, _bCtrl);
QByteArray sendingArray = str2ByteArray(idStr);
prbCtrlEepromWrite(sendingArray, EEPROM_ID_BEGIN, _bCtrl);
}
@ -2997,6 +3062,9 @@ void MainWindow::on_btn_prbCtrlRomInfoWrite_clicked()
QString infoStr = ui->tb_prbCtrlRomInfo->toPlainText();
try
{
QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER);
prbCtrlEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl);
QByteArray sendingArray = infoStr.toLatin1();
prbCtrlEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl);
}
@ -3050,6 +3118,26 @@ void MainWindow::on_btn_prbCtrlRomInfoRead_clicked()
}
}
/*************************************************************************************************/
void MainWindow::on_chk_clearPrbCtrlRom_clicked(bool checked)
{
if(checked)
{
QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE);
prbCtrlEepromWrite(clearAll, 0, _bCtrl);
}
}
/*************************************************************************************************/
void MainWindow::on_chk_writeCrcPrbCtrlRom_clicked(bool checked)
{
if(checked)
{
QByteArray crc = crcWrite(crcArray);
prbCtrlEepromWrite(crc, EEPROM_CRC_BEGIN, _bCtrl);
}
}
/*************************************************************************************************/
void MainWindow::on_btn_prbRomIdRead_clicked()
{

21
mainwindow.h

@ -31,6 +31,8 @@
#define MESSAGE_BOX(M) \
emit showMessage(M)
#define TRX_RLY_MPS_E2PROM_SIZE_BYTE 256
#define SCENARIO_FILE_PATH "scenarioFilePath"
#define SCENARIOS_FOLDER_PATH "scenariosFolderPath"
#define BITE_SCEN_FILE_PATH "biteScenarioFilePath"
@ -41,7 +43,6 @@
#define MCS_FILE_PATH "mcsFilePath"
#define REG_ACCESS_SEL "regAccessType"
#define START "Start"
#define STOP "Stop"
@ -83,6 +84,8 @@ public:
~MainWindow();
private:
const QList<quint8> crcArray = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1, \
0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2};
Ui::MainWindow *ui;
@ -166,6 +169,10 @@ private:
QString byteArray2InfoString (QByteArray& arr);
QByteArray crcWrite (const QList<quint8> &crcArray);
QByteArray e2promClear(quint32 length);
QString releaseCodeVersion (quint32 &value);
void getProbeColor (const QBrush brush, const int item);
@ -419,6 +426,18 @@ private slots:
void on_chk_batchLogEn_clicked(bool checked);
void on_chk_clearTrxRom_clicked(bool checked);
void on_chk_writeCrcTrxRom_clicked(bool checked);
void on_chk_clearMpsRom_clicked(bool checked);
void on_chk_writeCrcMpsRom_clicked(bool checked);
void on_chk_clearPrbCtrlRom_clicked(bool checked);
void on_chk_writeCrcPrbCtrlRom_clicked(bool checked);
signals:
void showMessage(QString message);
void threeDReady();

86
mainwindow.ui

@ -42,7 +42,7 @@
<string/>
</property>
<property name="currentIndex">
<number>5</number>
<number>4</number>
</property>
<widget class="QWidget" name="tab_0">
<attribute name="title">
@ -2126,7 +2126,7 @@
<property name="geometry">
<rect>
<x>410</x>
<y>100</y>
<y>170</y>
<width>381</width>
<height>151</height>
</rect>
@ -2341,7 +2341,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<y>170</y>
<width>381</width>
<height>81</height>
</rect>
@ -2442,6 +2442,84 @@
</layout>
</widget>
</widget>
<widget class="QCheckBox" name="chk_clearTrxRom">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Clear All</string>
</property>
</widget>
<widget class="QCheckBox" name="chk_writeCrcTrxRom">
<property name="geometry">
<rect>
<x>170</x>
<y>100</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Write CRC</string>
</property>
</widget>
<widget class="QCheckBox" name="chk_clearMpsRom">
<property name="geometry">
<rect>
<x>410</x>
<y>100</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Clear All</string>
</property>
</widget>
<widget class="QCheckBox" name="chk_writeCrcMpsRom">
<property name="geometry">
<rect>
<x>570</x>
<y>100</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Write CRC</string>
</property>
</widget>
<widget class="QCheckBox" name="chk_writeCrcPrbCtrlRom">
<property name="geometry">
<rect>
<x>170</x>
<y>260</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Write CRC</string>
</property>
</widget>
<widget class="QCheckBox" name="chk_clearPrbCtrlRom">
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>90</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Clear All</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -3028,7 +3106,7 @@
<rect>
<x>190</x>
<y>30</y>
<width>191</width>
<width>218</width>
<height>60</height>
</rect>
</property>

Loading…
Cancel
Save