commit 003adac6bd8f5ec15408fee9edd07fd1c535e327 Author: jiangyingjie <1308784381@qq.com> Date: Thu Aug 29 17:33:25 2024 +0800 完成基本功能 diff --git a/PlugBoardCommTestTool/PlugBoardCommTestTool.pro b/PlugBoardCommTestTool/PlugBoardCommTestTool.pro new file mode 100644 index 0000000..f9d8bc8 --- /dev/null +++ b/PlugBoardCommTestTool/PlugBoardCommTestTool.pro @@ -0,0 +1,31 @@ +QT += core gui serialport + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + mainwindow.cpp + +HEADERS += \ + mainwindow.h + +FORMS += \ + mainwindow.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/PlugBoardCommTestTool/PlugBoardCommTestTool.pro.user b/PlugBoardCommTestTool/PlugBoardCommTestTool.pro.user new file mode 100644 index 0000000..494b45b --- /dev/null +++ b/PlugBoardCommTestTool/PlugBoardCommTestTool.pro.user @@ -0,0 +1,319 @@ + + + + + + EnvironmentId + {b72ef07e-303d-4886-ad48-cd1f209eb895} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MinGW 64-bit + Desktop Qt 5.14.2 MinGW 64-bit + qt.qt5.5142.win64_mingw73_kit + 1 + 0 + 0 + + D:/_SRC/_tools/PlugBoardCommTestTool/build-PlugBoardCommTestTool-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:/_SRC/_tools/PlugBoardCommTestTool/build-PlugBoardCommTestTool-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + D:/_SRC/_tools/PlugBoardCommTestTool/build-PlugBoardCommTestTool-Desktop_Qt_5_14_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:D:/_SRC/_tools/PlugBoardCommTestTool/PlugBoardCommTestTool/PlugBoardCommTestTool.pro + D:/_SRC/_tools/PlugBoardCommTestTool/PlugBoardCommTestTool/PlugBoardCommTestTool.pro + + false + + false + true + true + false + false + true + + D:/_SRC/_tools/PlugBoardCommTestTool/build-PlugBoardCommTestTool-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/PlugBoardCommTestTool/main.cpp b/PlugBoardCommTestTool/main.cpp new file mode 100644 index 0000000..fd3e533 --- /dev/null +++ b/PlugBoardCommTestTool/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/PlugBoardCommTestTool/mainwindow.cpp b/PlugBoardCommTestTool/mainwindow.cpp new file mode 100644 index 0000000..fdf35e5 --- /dev/null +++ b/PlugBoardCommTestTool/mainwindow.cpp @@ -0,0 +1,844 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + Init(); + SerialPortInfo_Init(); + Config_Init(); // 文件初始化 + BindSlot(); // 槽函数 绑定 + + +} + +MainWindow::~MainWindow() +{ + DeInit(); + delete ui; +} + +/* @brief: 相关句柄的初始化 + * @para: void + * @return: void + */ +void MainWindow::Init() +{ + this->serial = new QSerialPort; + this->settings = new QSettings(CONFIG_FILE_LOCATION, QSettings::IniFormat); + this->recvTimer = new QTimer; + this->loopTimer = new QTimer; + + recvTimer->setSingleShot(true); // 单次模式 + loopTimer->setSingleShot(true); // 单次模式 + + // ui初始化 + ui->textEdit_receive->document()->setMaximumBlockCount(500); //最多500行 +} + +/* @brief: 去初始化 + * @para: void + * @return: void + */ +void MainWindow::DeInit() +{ + delete recvTimer; + delete loopTimer; + delete settings; + delete serial; +} + +/* @brief: 串口信息初始化 + * @para: void + * @return: void + */ +void MainWindow::SerialPortInfo_Init() +{ + ui->comboBox_port->clear(); // 清除数据 + for (QSerialPortInfo serialPortInfo : QSerialPortInfo::availablePorts()) + { + ui->comboBox_port->addItem(serialPortInfo.portName() + " [" + serialPortInfo.description() + ']'); + } +} + +/* @brief: 文件相关初始化 + * @para: void + * @return: void + */ +void MainWindow::Config_Init() +{ + // 配置文件 configuration 键值需要为true,否则是为没有配置文件或配置文件异常,需要清空配置文件随后重新初始化 + if (this->settings->value("configuration", false).toInt() != 1) + { + this->settings->clear(); + this->Config_SettingInit(); + } + this->Config_SettingUpdate(); // 更新界面显示 +} + +/* @brief: 初始化配置文件 + * @para: void + * @return: void + */ +void MainWindow::Config_SettingInit() +{ + QCheckBox *checkBox = new QCheckBox; + + this->settings->setValue("configuration", 1); + for (uint16_t i = 0; i <= 0xff; i++) + { + if (i % 16 == 0) // 16的倍数为全选框的配置 + { + checkBox = this->findChild(tr("checkBox_mix_%1x").arg(i / 16, 1, 16)); + if (checkBox != nullptr) + { + this->settings->setValue(checkBox->objectName(), 0); // 初始化设置为不勾选 + } + } + checkBox = this->findChild(tr("checkBox_mix_%1").arg(i, 2, 16, QLatin1Char('0'))); + if (checkBox != nullptr) + { + this->settings->setValue(checkBox->objectName(), 0); // // 初始化设置为不勾选 + } + } +} + +/* @brief: 配置文件更新显示 + * @para: void + * @return: void + */ +void MainWindow::Config_SettingUpdate() +{ + QCheckBox *checkBox = new QCheckBox; + QString checkBoxName = NULL; + int ret = 0; + + for (uint16_t i = 0; i <= 0xff; i++) + { + if (i % 16 == 0) // 16的倍数为全选框的配置 + { + checkBoxName = tr("checkBox_mix_%1x").arg(i / 16, 1, 16); + ret = this->settings->value(checkBoxName, -1).toInt(); + if (ret != -1) + { + checkBox = this->findChild(checkBoxName); + checkBox->setChecked((bool)ret); + } + } + checkBoxName = tr("checkBox_mix_%1").arg(i, 2, 16, QLatin1Char('0')); + ret = this->settings->value(checkBoxName, -1).toInt(); + if (ret != -1) + { + checkBox = this->findChild(checkBoxName); + checkBox->setChecked((bool)ret); + } + } +} + +/* @brief: 计算数据的校验和 + * @para: uint8_t*:传入数组 + * @return: uint8_t 获取到的校验和 + */ +uint8_t MainWindow::Serial_GetSumCheck(uint8_t* array) +{ + uint8_t cs = 0; + cs += array[SERIAL_COMM_INDEX_ADDR]; + cs += array[SERIAL_COMM_INDEX_LEN]; + for (uint8_t i = 0; i < array[SERIAL_COMM_INDEX_LEN]; i++) + { + cs += array[i + 4]; + } + return cs; +} + +/* @brief: 接收到串口数据后进行数据刷新 + * @para: + * @return: void + */ +void MainWindow::Serial_UpdateData(uint8_t* array) +{ + uint8_t mixIndex = array[SERIAL_COMM_INDEX_MIXINDEX]; + uint16_t mixData = array[SERIAL_COMM_INDEX_MIXDATA] << 8 | array[SERIAL_COMM_INDEX_MIXDATA + 1]; + PLUG_BOARD_POWER_STATUS_UNION powerStatus; // 电源上传的32位标志位 + powerStatus.inWord = ((uint32_t)(array[SERIAL_COMM_INDEX_STATUS] << 24) | + (uint32_t)(array[SERIAL_COMM_INDEX_STATUS + 1] << 16) | + (uint32_t)(array[SERIAL_COMM_INDEX_STATUS + 2] << 8) | + (uint32_t)(array[SERIAL_COMM_INDEX_STATUS + 3])); + + // 32位状态位显示 + for (uint8_t i = 0; i < 32; i++) + { + QLabel* label = this->findChild(QString("label_statusbits_%1").arg(i)); + if (label) + { + if (powerStatus.inWord & (1 << i)) // 如果为1 + { + label->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); // 设置样式表 + switch (i) + { + case 0: + label->setText("应急"); + break; + case 1: + label->setText("强起"); + break; + case 2: + case 7: + label->setText("手动"); + break; + case 3: + case 4: + case 5: + case 6: + case 27: + case 29: + case 30: + label->setText("故障"); + break; + default: + label->setText("有效"); + break; + } + } + else // 如果为0 + { + label->setStyleSheet("QLabel{background-color:rgb(0,255,0);}"); // 设置样式表 + switch (i) + { + case 2: + case 7: + label->setText("自动"); + break; + case 3: + case 4: + case 5: + case 6: + case 27: + case 29: + case 30: + label->setText("正常"); + break; + default: + label->setText("无效"); + break; + } + } + } + } + + + // 融合数据显示 + QLabel *label = this->findChild(tr("label_mix_%1").arg(mixIndex, 2, 16, QLatin1Char('0'))); + static QLabel* lastLabel = nullptr; // 保存上一次刷新的label控件 + if (label) + { + label->clear(); // 清除当前文字显示 + if (lastLabel) + { + lastLabel->setStyleSheet("QLabel{background-color:yellow;}"); // 重置上一个label的样式表 + } + label->setStyleSheet("QLabel{background-color:#c8ffff;}"); // 显示当前需要刷新的控件的样式表 + + // 进行融合数据的显示 + switch (mixIndex) // 判断融合数据索引 + { + case 0x01: // 版本号 + { + QString str = QString::number(array[10]) + QString::number(array[11]).asprintf("%02d", array[11]); + label->setText(str); + } + break; + case 0x02: // 回路数量 + { + QString str = QString::number(mixData); + label->setText(str); + } + break; + case 0x03: // 备电数量 + { + QString str = QString::number(mixData); + label->setText(str); + } + break; + case 0x04: // 电源设置 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x05: // 备电调试模式 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x10: // 主电电压 + { + QString str = QString::number(mixData); + label->setText(str + " V"); + } + break; + case 0x11: // 输出电压 + { + QString str = QString::number(mixData); + label->setText(str + " mV"); + } + break; + case 0x12: // 输出电流 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0x13: // 电池电压 + { + QString str = QString::number(mixData); + label->setText(str + " mV"); + } + break; + case 0x14: // 充电电流 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0x1f: // 备电切断电压 + { + QString str = QString::number(mixData); + label->setText(str + " mV"); + } + break; + case 0x20: // 欠压电池 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x21: // 过放电池 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x22: // 过压电池 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x23: // 开路电池 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x24: // 短路电池 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x30: // 开路回路 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x31: // 短路回路 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x32: // 熔断保险丝 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x33: // 过载回路 + { + QString str = QString::number(mixData, 16); + label->setText(str); + } + break; + case 0x40: // 电源地址码 + { + QString str = QString::number(mixData); + label->setText(str); + } + break; + case 0x41: // can波特率设置 + { + QString str = QString::number(mixData); + label->setText(str); + } + break; + case 0x42: // 灯具亮度等级 + { + QString str = QString::number(mixData); + label->setText(str); + } + break; + case 0x50: // 电池1温度 + { + QString str1 = nullptr, str2 = nullptr; + if(array[10] & 0x80) + { + str1 += "包:-"; + } + else + { + str1 += "包:"; + } + str1 += QString::number(array[10] & 0x7f); + if(array[11] & 0x80) + { + str2 += "内:-"; + } + else + { + str2 += "内:"; + } + str2 += QString::number(array[11] & 0x7f); + label->setText(str1 + " " + str2); + } + break; + break; + case 0xa0: // 回路电流_1 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa1: // 回路电流_2 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa2: // 回路电流_3 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa3: // 回路电流_4 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa4: // 回路电流_5 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa5: // 回路电流_6 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa6: // 回路电流_7 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xa7: // 回路电流_8 + { + QString str = QString::number(mixData); + label->setText(str + " mA"); + } + break; + case 0xb0: // 电池电压1 + { + QString str = QString::number(mixData); + label->setText(str + " mV"); + } + break; + case 0xb1: // 电池电压2 + { + QString str = QString::number(mixData); + label->setText(str + " mV"); + } + break; + case 0xb2: // 电池电压3 + { + QString str = QString::number(mixData); + label->setText(str + " mV"); + } + break; + case 0xff: // 获取额定功率 + { + QString str = QString::number(array[11] << 8 | array[10]); + label->setText(str + " W"); + } + break; + } + + lastLabel = label; // 保存上一次刷新的 + } +} + +/* @brief: [槽函数],融合数据查询按钮回调函数 + * @para: QByteArray:待发送数据 + * @return: void + */ +void MainWindow::Serial_SendData(QByteArray senddata) +{ + if (this->serial->isOpen()) + { + this->serial->write(senddata); + } + else + { + QMessageBox messageBox; + messageBox.setIcon(QMessageBox::Warning); + messageBox.setWindowTitle("警告"); + messageBox.setText("请先打开串口"); + messageBox.exec(); + } +} + + +/*****************************************************<槽函数>*/ +/* @brief: [槽函数],融合数据查询按钮回调函数 + * @para: void + * @return: void + */ +void MainWindow:: pushButton_mix_clicked_callback() +{ + QPushButton *btn = qobject_cast(sender()); // 获取信号的发送者 + uint8_t mixIndex = btn->text().mid(1, 2).toUInt(nullptr, 16); // 转16进制 + uint8_t sendbuf[] = {0x78, 0x02, 0x09, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, mixIndex, 0x00, 0x17}; + sendbuf[SERIAL_COMM_INDEX_CS] = Serial_GetSumCheck(sendbuf); + Serial_SendData(QByteArray(reinterpret_cast(sendbuf), sizeof(sendbuf) / sizeof(sendbuf[0]))); +} + +/* @brief: [槽函数],融合数据查询按钮回调函数 + * @para: void + * @return: void + */ +void MainWindow:: pushButton_mixsend_clicked_callback() +{ + QPushButton *btn = qobject_cast(sender()); // 获取信号的发送者 + uint8_t mixIndex = btn->text().mid(1, 2).toUInt(nullptr, 16); // 转16进制 + QLineEdit *lineEdit = this->findChild("lineEdit_mixsend_" + btn->text().mid(1, 2)); + if (lineEdit) + { + uint8_t sendbuf[] = {0x78, 0x02, 0x09, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, mixIndex, 0x00, 0x00, 0x00, 0x00, 0x17}; + + uint16_t mixData = lineEdit->text().toUShort(nullptr, 10); + sendbuf[SERIAL_COMM_INDEX_MIXDATA] = (uint8_t)(mixData >> 8); + sendbuf[SERIAL_COMM_INDEX_MIXDATA + 1] = (uint8_t)(mixData); + sendbuf[SERIAL_COMM_INDEX_CS] = Serial_GetSumCheck(sendbuf); + Serial_SendData(QByteArray(reinterpret_cast(sendbuf), sizeof(sendbuf) / sizeof(sendbuf[0]))); + } +} + +/* @brief: [槽函数],命令按钮回调函数 + * @para: void + * @return: void + */ +void MainWindow:: pushButton_cmd_clicked_callback() +{ + QPushButton *btn = qobject_cast(sender()); // 获取信号的发送者 + uint8_t cmd = btn->text().mid(1, 2).toUInt(nullptr, 16); // 转16进制 + uint8_t sendbuf[] = {0x78, 0x02, 0x09, 0x78, cmd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17}; + sendbuf[SERIAL_COMM_INDEX_CS] = Serial_GetSumCheck(sendbuf); + Serial_SendData(QByteArray(reinterpret_cast(sendbuf), sizeof(sendbuf) / sizeof(sendbuf[0]))); +} + +/* @brief: [槽函数],全选框回调函数 + * @para: void + * @return: void + */ +void MainWindow::checkbox_mix_all_stateChanged_callback() +{ + QCheckBox* checkbox_all = qobject_cast(sender()); // 获取信号的发送者 + QCheckBox* checkbox_singal = new QCheckBox; + QString section = checkbox_all->objectName().mid(13, 1); + int ret = checkbox_all->isChecked(); + + this->settings->setValue(checkbox_all->objectName(), ret); + + for (uint8_t i = 0; i <= 0x0f; i++) + { + checkbox_singal = this->findChild(tr("checkBox_mix_%1%2").arg(section).arg(i, 1, 16)); + if (checkbox_singal) + { + this->settings->setValue(checkbox_singal->objectName(), ret); + checkbox_singal->setChecked(checkbox_all->isChecked()); + } + } +} + +/* @brief: [槽函数],单个选中该框回调函数 + * @para: void + * @return: void + */ +void MainWindow::checkbox_mix_single_stateChanged_callback() +{ + QCheckBox* checkbox = qobject_cast(sender()); // 获取信号的发送者 + int data = checkbox->isChecked(); + this->settings->setValue(checkbox->objectName(), data); +} + +/* @brief: [槽函数],循环发送框回调函数 + * @para: void + * @return: void + */ +void MainWindow::checkbox_mix_loop_stateChanged_callback() +{ + if (ui->checkBox_mix_loop->isChecked()) + { + if (this->serial->isOpen()) + { + loopTimer->start(ui->lineEdit_looptime->text().toUInt()); + } + else + { + QMessageBox messageBox; + messageBox.setIcon(QMessageBox::Warning); + messageBox.setWindowTitle("警告"); + messageBox.setText("请先打开串口"); + messageBox.exec(); + ui->checkBox_mix_loop->setChecked(false); + } + } + else + { + loopTimer->stop(); + } +} + +/* @brief: [槽函数],端口刷新回调函数 + * @para: void + * @return: void + */ +void MainWindow::pushButton_refresh_clicked_callback() +{ + this->SerialPortInfo_Init(); +} + +/* @brief: [槽函数],开启串口按钮回调函数 + * @para: void + * @return: void + */ +void MainWindow::pushButton_open_clicked_callback() +{ + QStringList portStrList = ui->comboBox_port->currentText().split(" ["); // 获取端口号 + this->serial->setPortName(portStrList.at(0)); // 设置端口号 + this->serial->setBaudRate(ui->comboBox_bandrate->currentText().toUInt()); // 获取波特率 + this->serial->setDataBits(QSerialPort::Data8); // 串口数据位数 + this->serial->setStopBits(QSerialPort::OneStop); // 以为停止位 + this->serial->setParity(QSerialPort::NoParity); // 无奇偶校验 + this->serial->setFlowControl(QSerialPort::NoFlowControl); // 硬件控制 + + if (this->serial->open(QIODevice::ReadWrite)) // 打开成功 + { + ui->pushButton_open->setDisabled(true); + ui->pushButton_close->setEnabled(true); + ui->comboBox_port->setDisabled(true); + ui->pushButton_refresh->setDisabled(true); + ui->comboBox_bandrate->setDisabled(true); + } + else + { + ui->pushButton_open->setEnabled(true); + ui->pushButton_close->setDisabled(true); + ui->comboBox_port->setEnabled(true); + ui->pushButton_refresh->setEnabled(true); + ui->comboBox_bandrate->setEnabled(true); + } +} + +/* @brief: [槽函数],关闭串口按钮回调函数 + * @para: void + * @return: void + */ +void MainWindow::pushBurron_close_clicked_callback() +{ + if (serial->isOpen()) + { + recvTimer->stop(); // 关闭接收定时器 + loopTimer->stop(); // 关闭循环发送定时器 + serial->close(); // 关闭串口 + ui->pushButton_open->setEnabled(true); + ui->pushButton_close->setDisabled(true); + ui->comboBox_port->setEnabled(true); + ui->pushButton_refresh->setEnabled(true); + ui->comboBox_bandrate->setEnabled(true); + ui->checkBox_mix_loop->setChecked(false); + } +} + +/* @brief: [槽函数],串口接收到数据回调函数 + * @para: void + * @return: void + */ +void MainWindow::qserail_readyread_callback() +{ + this->recvTimer->start(ui->lineEdit_timeout->text().toUInt()); // 开启接收超时定时器 + recvByteArray.append(serial->readAll()); // 读取接收数据 +} + +/* @brief: [槽函数],串口接收超时回调函数 + * @para: void + * @return: void + */ +void MainWindow::recvtimer_timeout_callback() +{ + QString timeStr = QDateTime::currentDateTime().toString(); // 获取时间戳 + uint8_t recvBuf[SERIAL_BUF_MAXSIZE] = {0}; + QByteArray dataStr = nullptr; + + /********** 接收数据的显示 **********/ + for(uint8_t i = 0; i < recvByteArray.toHex().length(); i += 2) + { + dataStr += "0x" + recvByteArray.toHex().mid(i, 2) + ' '; // 转化为十六进制 + } + ui->textEdit_receive->insertPlainText('[' + timeStr + "] " + dataStr); + + /********** 进行接收数据的解析 **********/ + memcpy(recvBuf, recvByteArray.data(), recvByteArray.length()); // 将QByteArray转化为uint8_t + // 帧头帧尾的判断 + if (recvBuf[SERIAL_COMM_INDEX_HEAD] == SERIAL_COMM_HEAD && \ + recvBuf[recvBuf[SERIAL_COMM_INDEX_LEN] + 5] == SERIAL_COMM_TIAL) + { + // 校验和判断 + if (Serial_GetSumCheck(recvBuf) == recvBuf[recvBuf[SERIAL_COMM_INDEX_LEN] + 4]) + { + ui->textEdit_receive->insertPlainText(" [sumcheck - OK]\n"); + this->Serial_UpdateData(recvBuf); // 进行数据显示 + } + else + { + ui->textEdit_receive->insertPlainText(" [sumcheck - ERROR]\n"); + } + } + else + { + ui->textEdit_receive->insertPlainText(" [head&tail - ERROR]\n"); + } + recvByteArray.clear(); // 清除接收数据 + ui->textEdit_receive->moveCursor(QTextCursor::End); // 自动滚动 +} + + +/* @brief: [槽函数],循环发送定时到回调函数 + * @para: void + * @return: void + */ +void MainWindow::looptimer_timeout_callback() +{ + loopTimer->start(ui->lineEdit_looptime->text().toUInt()); + QCheckBox* checkBox = nullptr; + QPushButton* btn = nullptr; + do + { + btn = this->findChild(QString("pushButton_mix_%1").arg(loopIndex, 2, 16, QLatin1Char('0'))); + checkBox = this->findChild(QString("checkBox_mix_%1").arg(loopIndex++, 2, 16, QLatin1Char('0'))); + }while(!btn || !checkBox || !checkBox->isChecked()); + btn->click(); // 手动触发 +} + + +/* @brief: 绑定槽函数,用于部分控件回调函数绑定 + * @para: void + * @return: void + */ +void MainWindow::BindSlot() +{ + QCheckBox* checkbox = new QCheckBox; + QPushButton* btn = new QPushButton; + + // 融合数据索引按钮 + for (uint16_t i = 0; i <= 0xff; i++) + { + btn = this->findChild(tr("pushButton_mix_%1").arg(i, 2, 16, QLatin1Char('0'))); // 宽度2,不足补0 + if (btn) + { + connect(btn, &QPushButton::clicked, this, &MainWindow::pushButton_mix_clicked_callback); + } + } + + // 融合数据发送按钮 + for (uint16_t i = 0; i <= 0xff; i++) + { + btn = this->findChild(tr("pushButton_mixsend_%1").arg(i, 2, 16, QLatin1Char('0'))); // 宽度2,不足补0 + if (btn) + { + connect(btn, &QPushButton::clicked, this, &MainWindow::pushButton_mixsend_clicked_callback); + } + } + + // 命令按钮 + for (uint16_t i = 0; i <= 0xff; i++) + { + btn = this->findChild(tr("pushButton_cmd_%1").arg(i, 2, 16, QLatin1Char('0'))); // 宽度2,不足补0 + if (btn) + { + connect(btn, &QPushButton::clicked, this, &MainWindow::pushButton_cmd_clicked_callback); + } + } + + // 全选框 + for (uint8_t i = 0; i <= 0xf; i++) + { + checkbox = this->findChild(tr("checkBox_mix_%1x").arg(i, 0, 16)); + if (checkbox) + { + connect(checkbox, &QCheckBox::stateChanged, this, &MainWindow::checkbox_mix_all_stateChanged_callback); + } + } + + // 单个选择发送函数 + for (uint16_t i = 0; i <= 0xff; i++) + { + checkbox = this->findChild(tr("checkBox_mix_%1").arg(i, 2, 16, QLatin1Char('0'))); + if (checkbox) + { + connect(checkbox, &QCheckBox::stateChanged, this, &MainWindow::checkbox_mix_single_stateChanged_callback); + } + } + + // 循环发送框 + connect(ui->checkBox_mix_loop, &QCheckBox::stateChanged, this, &MainWindow::checkbox_mix_loop_stateChanged_callback); + + // 端口刷新按钮回调函数 + connect(ui->pushButton_refresh, &QPushButton::clicked, this, &MainWindow::pushButton_refresh_clicked_callback); + + // 打开串口按钮回调函数 + connect(ui->pushButton_open, &QPushButton::clicked, this, &MainWindow::pushButton_open_clicked_callback); + + // 关闭串口按钮回调函数 + connect(ui->pushButton_close, &QPushButton::clicked, this,&MainWindow::pushBurron_close_clicked_callback); + + // 清除接收显示回调函数 + connect(ui->pushButton_clear, &QPushButton::clicked, this, [=](){ + ui->textEdit_receive->clear(); + }); + + // 串口接收数据回调函数 + connect(serial, &QSerialPort::readyRead, this, &MainWindow::qserail_readyread_callback); + + // 串口接收超时回调函数 + connect(this->recvTimer, &QTimer::timeout, this, &MainWindow::recvtimer_timeout_callback); + + // 循环发送定时器定时达到回调函数 + connect(loopTimer, &QTimer::timeout, this, &MainWindow::looptimer_timeout_callback); + + // 十六进制发送按钮回调 + connect(ui->pushButton_send, &QPushButton::clicked, this, [=](){ + Serial_SendData(QByteArray::fromHex(ui->lineEdit_send->text().toLocal8Bit())); + }); +} + + diff --git a/PlugBoardCommTestTool/mainwindow.h b/PlugBoardCommTestTool/mainwindow.h new file mode 100644 index 0000000..1deb9d1 --- /dev/null +++ b/PlugBoardCommTestTool/mainwindow.h @@ -0,0 +1,152 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include +#include +#include +#include + +#include // 日期 +#include + + +#define RESET "\033[0m" +#define RED "\033[31m" /* Red */ +#define GREEN "\033[32m" /* Green */ + +#define CONFIG_FILE_LOCATION "./config.ini" // 配置文件的存储路径 + +#define SERIAL_BUF_MAXSIZE 50 // 串口通信缓存大小 +#define SERIAL_COMM_HEAD 0x78 // 串口数据帧头 +#define SERIAL_COMM_TIAL 0x17 // 串口数据帧尾 + +typedef enum +{ + SERIAL_COMM_INDEX_HEAD = 0, // 帧头索引 + SERIAL_COMM_INDEX_ADDR = 1, // 地址索引 + SERIAL_COMM_INDEX_LEN = 2, // 帧长度索引 + SERIAL_COMM_INDEX_STATUS = 5, // 32位标志位索引 + SERIAL_COMM_INDEX_MIXINDEX = 9, // 融合数据索引 + SERIAL_COMM_INDEX_MIXDATA = 10, // 融合数据 + SERIAL_COMM_INDEX_MIXASK = 12, // 需要查询的融合数据索引 + SERIAL_COMM_INDEX_CS = 13, // 校验和 +}SERIAL_COMM_INDEX; + +typedef struct +{ + + uint32_t Emergency_Flag : 1; // 应急状态[0:无效 1:有效] + uint32_t forceButtonFlg : 1; // 强启开关[0:无效 1:有效] + uint32_t WorkingModeBatMaintain : 1; // 手自动模式[0:自动 1:手动] + uint32_t mainPowerLostFlg : 1; // 主电状态[0:正常 1:丢失] + + uint32_t outPutERR : 1; // 输出故障[0:正常 1:故障] + uint32_t batErrFlg : 1; // 备电故障[0:正常 1:故障] + uint32_t LOOPERR : 1; // 输出状态[0:正常 1:故障] + uint32_t METOD_AUTO_ERR : 1; // 自检状态[0:正常 1:故障] + + uint32_t isAC220Lost : 1; // 联动控制端2状态[0:无效 1:有效] //220V市电 + uint32_t dryNode : 1; // 联动控制端3状态[0:无效 1:有效] //干接点 + uint32_t outPutOCFlg : 1; // 输出开路状态[0:无效 1:开路] + uint32_t outPutOLFlg : 1; // 输出过载状态[0:正常 1:过载] + + uint32_t Start_Comp_Flag : 1; // 启动完成状态[0:无效 1:有效] + uint32_t batOCFlg : 1; // 电池端口开路状态[0:无效 1:开路] + uint32_t batSCFlg : 1; // 电池端口短路状态[0:无效 1:短路] + uint32_t batSampleLineErrFlg : 1; // 电池采样线故障[0:无效 1:故障] + + uint32_t batUVFlg : 1; // 电池电压低于欠压点[0:无效 1:欠压] + uint32_t batUCVFlg : 1; // 电池电压低于切断点[0:无效 1:欠压] + uint32_t batOVFlg : 1; // 电池电压高于最大预设电压[0:无效 1:过压] + uint32_t : 1; // reserve + + uint32_t chargingFlg : 1; // 充电中状态[0:无效 1:充电] + uint32_t chargeCpltFlg : 1; // 充电完成状态[0:无效 1:充满] + uint32_t LOOPOCFlg : 1; // 路由开路状态[0:无效 1:开路] + uint32_t LOOPSCFlg : 1; // 路由短路状态[0:无效 1:短路] + + uint32_t FUSEOCFlg : 1; // 保险丝开路状态[0:无效 1:开路] + uint32_t LOOPOLFlg : 1; // 回路过载状态[0:正常 1:过载] + uint32_t reserve1 : 1; + uint32_t reserve2 : 1; + + uint32_t AC220ENStatus : 1; // 市电检测使能标志[0:未使能 1:使能] + uint32_t reserve4 : 1; + uint32_t reserve5 : 1; + uint32_t reserve6 : 1; + +} PLUG_BOARD_STATUS_TypeDef; + +typedef union +{ + PLUG_BOARD_STATUS_TypeDef inBit; + uint32_t inWord; +} PLUG_BOARD_POWER_STATUS_UNION; + + + + + + + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private slots: + void pushButton_mix_clicked_callback(); // 融合数据查询按钮回调函数 + + void pushButton_mixsend_clicked_callback(); // 融合数据发送按钮回调函数 + + void pushButton_cmd_clicked_callback(); // 指令按钮回调函数 + + void checkbox_mix_all_stateChanged_callback(); // 全选框回调函数 + + void checkbox_mix_single_stateChanged_callback(); // 单个选中框回调函数 + + void checkbox_mix_loop_stateChanged_callback(); // 循环发送框回调函数 + + void pushButton_refresh_clicked_callback(); // 端口刷新回调函数 + + void pushButton_open_clicked_callback(); // 打开串口回调函数 + + void pushBurron_close_clicked_callback(); // 关闭串口回调函数 + + void qserail_readyread_callback(); // 串口准备读取回调函数 + + void recvtimer_timeout_callback(); // 串口接收超时回调函数 + + void looptimer_timeout_callback(); // 循环发送定时器定时到回调函数 + +private: + Ui::MainWindow *ui; + QSerialPort *serial = nullptr; // 串口句柄 + QSettings *settings = nullptr; // 配置文件 + QTimer* recvTimer = nullptr; // 串口接收定时器 + QTimer* loopTimer = nullptr; // 串口循环发送定时器 + QByteArray recvByteArray = nullptr; // 串口接收数据 + uint8_t loopIndex = 0; // 循环发送索引 + + void Init(); // 句柄初始化函数 + void DeInit(); // 去初始化 + void BindSlot(); // 槽函数绑定 + void SerialPortInfo_Init(); // 串口信息初始化 + void Config_Init(); // 文件相关初始化 + void Config_SettingInit(); // 配置文件初始化 + void Config_SettingUpdate(); // 配置文件更新显示 + + uint8_t Serial_GetSumCheck(uint8_t *array); // 获取校验和 + void Serial_UpdateData(uint8_t* array); // 更新串口数据 + void Serial_SendData(QByteArray senddata); // 串口发送数据 +}; +#endif // MAINWINDOW_H diff --git a/PlugBoardCommTestTool/mainwindow.ui b/PlugBoardCommTestTool/mainwindow.ui new file mode 100644 index 0000000..82aa1d9 --- /dev/null +++ b/PlugBoardCommTestTool/mainwindow.ui @@ -0,0 +1,2580 @@ + + + MainWindow + + + + 0 + 0 + 1590 + 979 + + + + MainWindow + + + + + + 1360 + 9 + 211 + 941 + + + + 32位状态位 + + + + + + Qt::Horizontal + + + + + + + 5 + + + 5 + + + 10 + + + + + 00 应急状态 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 01 强起模式 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 02 手自动模式 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 03 主电故障 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 5 + + + 5 + + + 10 + + + + + 04 输出故障 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 05 备电故障 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 06 回路故障 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 07 手自动应急 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + Qt::Horizontal + + + + + + + 5 + + + 5 + + + 10 + + + + + 08 市电联动信号 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 10 输出开路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 09 应急联动信号 + + + + + + + 11 输出过载 + + + + + + + + + 5 + + + 5 + + + 10 + + + + + 12 电源启动完成 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 13 电池开路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 14 电池口短路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 15 采样线故障 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + Qt::Horizontal + + + + + + + 5 + + + 5 + + + 10 + + + + + 16 电池组欠压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 17 电池组过放 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 18 电池组过压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 19 电池温度异常 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 5 + + + 5 + + + 10 + + + + + 20 充电状态 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 21 充电完成状态 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 22 回路路由开路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 23 回路路由短路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + Qt::Horizontal + + + + + + + 5 + + + 5 + + + 10 + + + + + 24 保险丝开路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 25 回路路由过载 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 26 - + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 27 放电回路开路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 5 + + + 5 + + + 10 + + + + + 28 市电检测使能 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 29 放电回路短路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 30 放电回路过载 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + 31 - + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + Qt::Horizontal + + + + + + + + + 10 + 80 + 1341 + 191 + + + + 接收 + + + + + 10 + 20 + 1211 + 161 + + + + + + + 1240 + 50 + 91 + 16 + + + + 接收超时ms + + + + + + 1240 + 70 + 81 + 21 + + + + 50 + + + + + + 1240 + 120 + 81 + 31 + + + + + + + 清除数据 + + + + + + + 10 + 10 + 1341 + 61 + + + + 配置 + + + + + 60 + 20 + 591 + 31 + + + + + + + 10 + 30 + 72 + 15 + + + + 端口: + + + + + + 780 + 30 + 72 + 15 + + + + 波特率: + + + + + + 840 + 20 + 131 + 31 + + + + + 2400 + + + + + 4800 + + + + + 9600 + + + + + 115200 + + + + + + + 1010 + 20 + 121 + 28 + + + + QPushButton { + background-color: rgb(255,255,255); + color: green; +} + +QPushButton:disabled { + background-color: rgb(220,220,220); + color: balck; +} + + + + + 开启串口 + + + + + false + + + + 1140 + 20 + 121 + 28 + + + + QPushButton { + background-color: rgb(255,255,255); + color: red; +} + +QPushButton:disabled { + background-color: rgb(220,220,220); + color: balck; +} + + + + 关闭串口 + + + false + + + + + + 660 + 20 + 71 + 31 + + + + + + + 刷新 + + + + + + + 10 + 880 + 1341 + 71 + + + + 发送 + + + + + 10 + 20 + 1161 + 31 + + + + + + + 1190 + 20 + 111 + 31 + + + + + + + 十六进制发送 + + + + + + + 10 + 280 + 1341 + 591 + + + + Qt::LeftToRight + + + 1 + + + + border-color: rgb(213, 213, 213); + + + 融合数据查询 + + + + + + 全选 + + + + + + + + + + + + + + + + (41)CAN波特率 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 全选 + + + + + + + 全选 + + + + + + + Qt::Horizontal + + + + + + + + + + + + + + + + (14)充电电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (40)电源地址码 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (21)过放电池 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + 循环发送间隔(ms) + + + + + + + + 100 + 16777215 + + + + 300 + + + + + + + + + + + + + + + + + + (11)输出电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (24)短路电池 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (42)灯具亮度等级 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 全选 + + + + + + + 全选 + + + + + + + + + + + + + + + + (31)短路回路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 全选 + + + + + + + + + + + + + + + + (01)电源版本号 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (23)开路电池 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (1f)备电切断电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (13)电池电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + background-color: rgb(156, 255, 249); +font: 12pt "Adobe Arabic"; + + + 融合数据循环发送 + + + + + + + + + + + + + + + + (12)输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (02)回路数量 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (04)电源设置 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (33)过载回路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (05)备电调试模式 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (03)电池数量 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (30)开路回路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (10)主电电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (ff)获取额定功率 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (20)欠压电池 + + + + + + + true + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (22)过压电池 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (32)保险开路回路 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 全选 + + + + + + + + + + + + + + + + (b0)电池1电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (b1)电池2电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (b2)电池3电压 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 全选 + + + + + + + + + + + + + + + + (a0)回路1输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a1)回路2输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a2)回路3输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a3)回路4输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a4)回路5输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a5)回路6输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a6)回路7输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + + + + + + + + + (a7)回路8输出电流 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + 全选 + + + + + + + + + + + + + + + + (50)电池1温度 + + + + + + + background-color: rgb(255, 255, 0); + + + + + + + + + + + + + 指令 + + + + + 20 + 20 + 191 + 28 + + + + (11)进入自动应急 + + + + + + 20 + 60 + 191 + 28 + + + + (12)进入手动应急 + + + + + + 20 + 100 + 191 + 28 + + + + (13)退出应急 + + + + + + 20 + 140 + 191 + 28 + + + + (14)复位 + + + + + + 20 + 180 + 191 + 28 + + + + (15)开路由输出 + + + + + + 20 + 220 + 191 + 28 + + + + (16)关路由输出 + + + + + + 260 + 20 + 191 + 28 + + + + (20)消音 + + + + + + 260 + 60 + 191 + 28 + + + + (21)市电检测启用 + + + + + + 260 + 100 + 191 + 28 + + + + (22)市电检测禁止 + + + + + + 260 + 140 + 191 + 28 + + + + (23)静音 + + + + + + 260 + 180 + 191 + 28 + + + + (24)取消静音 + + + + + + 490 + 20 + 191 + 28 + + + + (33)使能单节电池检测 + + + + + + 490 + 60 + 191 + 28 + + + + (34)禁止单节电池检测 + + + + + + 730 + 20 + 191 + 28 + + + + (50)备电自杀 + + + + + + 730 + 60 + 191 + 28 + + + + (51)切断输出1 + + + + + + 730 + 100 + 191 + 28 + + + + (52)切断输出2 + + + + + + 730 + 140 + 191 + 28 + + + + (53)切断输出3 + + + + + + 730 + 180 + 191 + 28 + + + + (54)切断输出4 + + + + + + 730 + 220 + 191 + 28 + + + + (55)切断输出5 + + + + + + 730 + 260 + 191 + 28 + + + + (56)切断输出6 + + + + + + 730 + 300 + 191 + 28 + + + + (57)切断输出7 + + + + + + 730 + 340 + 191 + 28 + + + + (58)切断输出8 + + + + + + 960 + 60 + 191 + 28 + + + + (59)开启输出1 + + + + + + 960 + 100 + 191 + 28 + + + + (5a)开启输出2 + + + + + + 960 + 140 + 191 + 28 + + + + (5b)开启输出3 + + + + + + 960 + 180 + 191 + 28 + + + + (5c)开启输出4 + + + + + + 960 + 220 + 191 + 28 + + + + (5d)开启输出5 + + + + + + 960 + 260 + 191 + 28 + + + + (5e)开启输出6 + + + + + + 960 + 300 + 191 + 28 + + + + (5f)开启输出7 + + + + + + 960 + 340 + 191 + 28 + + + + (60)开启输出8 + + + + + + 730 + 430 + 191 + 28 + + + + (61)干接点短路 + + + + + + 960 + 430 + 191 + 28 + + + + (62)干接点开路 + + + + + + 融合数据设置 + + + + + 20 + 30 + 221 + 41 + + + + + + + 10100 + + + + + + + (30)设置备电切断电压值 + + + + + + + + + + + + 0 + 0 + 1590 + 23 + + + + + + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..4fba2a7 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ + + +# 更新列表 + +| 更新时间 | 更新内容 | +| ---------- | ------------------------------------------------------------ | +| 2024-07-18 | 1. 完成循环发送功能
2. 实现指令的发送功能以及输入框的发送功能
3. 调整布局
| +| 2024-07-17 | 1. 完成部分循环发送定时器逻辑处理
2. 增加插板通信32位状态位以及融合数据内容的解析
3. 调整开启/关闭串口按键在使能和禁用时的样式表
4. 增加串口接收超时和显示的逻辑,完成串口接收功能
| +| 2024-07-12 | 1. 完成串口配置功能
2. 完成串口 开启和关闭的功能
| +| 2024-07-11 | 1. 完成多选框配置文件的写入和读取操作
2. 完成页面的基本绘制
| +| 2024-07-09 | 1. 修改配置文件读写的方法(QFile -> QSettings)
2. 实现单选框配置文件的写入和读取操作
| +| 2024-06-28 | 1. 增加配置文件的创建读取和初始化写入操作
| +| 2024-06-25 | 1. 完成融合数据以及32位状态位的界面绘制和控件摆放
2. 完成融合数据全选框以及单个按钮的回调逻辑框架
| + + + + + + + +# TODO + +- [x] 增加多选框配置文件的写入和读取操作 +- [x] 单选框和多选框的逻辑如何处理 +- [ ] 串口功能的实现 +- [ ] 串口与显示多线程处理 + + + + + diff --git a/release/D3Dcompiler_47.dll b/release/D3Dcompiler_47.dll new file mode 100644 index 0000000..56512f5 Binary files /dev/null and b/release/D3Dcompiler_47.dll differ diff --git a/release/PlugBoardCommTestTool.exe b/release/PlugBoardCommTestTool.exe new file mode 100644 index 0000000..558f2e8 Binary files /dev/null and b/release/PlugBoardCommTestTool.exe differ diff --git a/release/Qt5Core.dll b/release/Qt5Core.dll new file mode 100644 index 0000000..5ec58e1 Binary files /dev/null and b/release/Qt5Core.dll differ diff --git a/release/Qt5Gui.dll b/release/Qt5Gui.dll new file mode 100644 index 0000000..d75c183 Binary files /dev/null and b/release/Qt5Gui.dll differ diff --git a/release/Qt5SerialPort.dll b/release/Qt5SerialPort.dll new file mode 100644 index 0000000..286dac1 Binary files /dev/null and b/release/Qt5SerialPort.dll differ diff --git a/release/Qt5Svg.dll b/release/Qt5Svg.dll new file mode 100644 index 0000000..4087736 Binary files /dev/null and b/release/Qt5Svg.dll differ diff --git a/release/Qt5Widgets.dll b/release/Qt5Widgets.dll new file mode 100644 index 0000000..84511cc Binary files /dev/null and b/release/Qt5Widgets.dll differ diff --git a/release/config.ini b/release/config.ini new file mode 100644 index 0000000..85fd340 --- /dev/null +++ b/release/config.ini @@ -0,0 +1,47 @@ +[General] +configuration=1 +checkBox_mix_0x=0 +checkBox_mix_01=0 +checkBox_mix_02=0 +checkBox_mix_03=0 +checkBox_mix_04=0 +checkBox_mix_05=0 +checkBox_mix_1x=0 +checkBox_mix_10=0 +checkBox_mix_11=0 +checkBox_mix_12=0 +checkBox_mix_13=0 +checkBox_mix_14=0 +checkBox_mix_1f=0 +checkBox_mix_2x=1 +checkBox_mix_20=1 +checkBox_mix_21=1 +checkBox_mix_22=1 +checkBox_mix_23=1 +checkBox_mix_24=1 +checkBox_mix_3x=0 +checkBox_mix_30=0 +checkBox_mix_31=0 +checkBox_mix_32=0 +checkBox_mix_33=0 +checkBox_mix_4x=0 +checkBox_mix_40=0 +checkBox_mix_41=0 +checkBox_mix_42=0 +checkBox_mix_5x=0 +checkBox_mix_50=1 +checkBox_mix_ax=0 +checkBox_mix_a0=1 +checkBox_mix_a1=1 +checkBox_mix_a2=1 +checkBox_mix_a3=1 +checkBox_mix_a4=0 +checkBox_mix_a5=0 +checkBox_mix_a6=0 +checkBox_mix_a7=0 +checkBox_mix_bx=0 +checkBox_mix_b0=0 +checkBox_mix_b1=0 +checkBox_mix_b2=0 +checkBox_mix_fx=0 +checkBox_mix_ff=0 diff --git a/release/iconengines/qsvgicon.dll b/release/iconengines/qsvgicon.dll new file mode 100644 index 0000000..7f92d34 Binary files /dev/null and b/release/iconengines/qsvgicon.dll differ diff --git a/release/imageformats/qgif.dll b/release/imageformats/qgif.dll new file mode 100644 index 0000000..fe72ce3 Binary files /dev/null and b/release/imageformats/qgif.dll differ diff --git a/release/imageformats/qicns.dll b/release/imageformats/qicns.dll new file mode 100644 index 0000000..1c5ab4f Binary files /dev/null and b/release/imageformats/qicns.dll differ diff --git a/release/imageformats/qico.dll b/release/imageformats/qico.dll new file mode 100644 index 0000000..4f12ab9 Binary files /dev/null and b/release/imageformats/qico.dll differ diff --git a/release/imageformats/qjpeg.dll b/release/imageformats/qjpeg.dll new file mode 100644 index 0000000..6dbeeb2 Binary files /dev/null and b/release/imageformats/qjpeg.dll differ diff --git a/release/imageformats/qsvg.dll b/release/imageformats/qsvg.dll new file mode 100644 index 0000000..6717ba4 Binary files /dev/null and b/release/imageformats/qsvg.dll differ diff --git a/release/imageformats/qtga.dll b/release/imageformats/qtga.dll new file mode 100644 index 0000000..bfe4295 Binary files /dev/null and b/release/imageformats/qtga.dll differ diff --git a/release/imageformats/qtiff.dll b/release/imageformats/qtiff.dll new file mode 100644 index 0000000..4cbf358 Binary files /dev/null and b/release/imageformats/qtiff.dll differ diff --git a/release/imageformats/qwbmp.dll b/release/imageformats/qwbmp.dll new file mode 100644 index 0000000..6d93968 Binary files /dev/null and b/release/imageformats/qwbmp.dll differ diff --git a/release/imageformats/qwebp.dll b/release/imageformats/qwebp.dll new file mode 100644 index 0000000..f783616 Binary files /dev/null and b/release/imageformats/qwebp.dll differ diff --git a/release/libEGL.dll b/release/libEGL.dll new file mode 100644 index 0000000..873d988 Binary files /dev/null and b/release/libEGL.dll differ diff --git a/release/libGLESv2.dll b/release/libGLESv2.dll new file mode 100644 index 0000000..d6786ca Binary files /dev/null and b/release/libGLESv2.dll differ diff --git a/release/opengl32sw.dll b/release/opengl32sw.dll new file mode 100644 index 0000000..475e82a Binary files /dev/null and b/release/opengl32sw.dll differ diff --git a/release/platforms/qwindows.dll b/release/platforms/qwindows.dll new file mode 100644 index 0000000..b02c018 Binary files /dev/null and b/release/platforms/qwindows.dll differ diff --git a/release/styles/qwindowsvistastyle.dll b/release/styles/qwindowsvistastyle.dll new file mode 100644 index 0000000..9f5b283 Binary files /dev/null and b/release/styles/qwindowsvistastyle.dll differ diff --git a/release/translations/qt_ar.qm b/release/translations/qt_ar.qm new file mode 100644 index 0000000..1e9227a Binary files /dev/null and b/release/translations/qt_ar.qm differ diff --git a/release/translations/qt_bg.qm b/release/translations/qt_bg.qm new file mode 100644 index 0000000..dcec255 Binary files /dev/null and b/release/translations/qt_bg.qm differ diff --git a/release/translations/qt_ca.qm b/release/translations/qt_ca.qm new file mode 100644 index 0000000..0b798e5 Binary files /dev/null and b/release/translations/qt_ca.qm differ diff --git a/release/translations/qt_cs.qm b/release/translations/qt_cs.qm new file mode 100644 index 0000000..3ab5ca7 Binary files /dev/null and b/release/translations/qt_cs.qm differ diff --git a/release/translations/qt_da.qm b/release/translations/qt_da.qm new file mode 100644 index 0000000..6756496 Binary files /dev/null and b/release/translations/qt_da.qm differ diff --git a/release/translations/qt_de.qm b/release/translations/qt_de.qm new file mode 100644 index 0000000..034286e Binary files /dev/null and b/release/translations/qt_de.qm differ diff --git a/release/translations/qt_en.qm b/release/translations/qt_en.qm new file mode 100644 index 0000000..9dad8df Binary files /dev/null and b/release/translations/qt_en.qm differ diff --git a/release/translations/qt_es.qm b/release/translations/qt_es.qm new file mode 100644 index 0000000..3a527df Binary files /dev/null and b/release/translations/qt_es.qm differ diff --git a/release/translations/qt_fi.qm b/release/translations/qt_fi.qm new file mode 100644 index 0000000..2548cca Binary files /dev/null and b/release/translations/qt_fi.qm differ diff --git a/release/translations/qt_fr.qm b/release/translations/qt_fr.qm new file mode 100644 index 0000000..8353f0a Binary files /dev/null and b/release/translations/qt_fr.qm differ diff --git a/release/translations/qt_gd.qm b/release/translations/qt_gd.qm new file mode 100644 index 0000000..fd7eecd Binary files /dev/null and b/release/translations/qt_gd.qm differ diff --git a/release/translations/qt_he.qm b/release/translations/qt_he.qm new file mode 100644 index 0000000..e15d45e Binary files /dev/null and b/release/translations/qt_he.qm differ diff --git a/release/translations/qt_hu.qm b/release/translations/qt_hu.qm new file mode 100644 index 0000000..b51bd1a Binary files /dev/null and b/release/translations/qt_hu.qm differ diff --git a/release/translations/qt_it.qm b/release/translations/qt_it.qm new file mode 100644 index 0000000..0d9d17d Binary files /dev/null and b/release/translations/qt_it.qm differ diff --git a/release/translations/qt_ja.qm b/release/translations/qt_ja.qm new file mode 100644 index 0000000..7f688c1 Binary files /dev/null and b/release/translations/qt_ja.qm differ diff --git a/release/translations/qt_ko.qm b/release/translations/qt_ko.qm new file mode 100644 index 0000000..c612a10 Binary files /dev/null and b/release/translations/qt_ko.qm differ diff --git a/release/translations/qt_lv.qm b/release/translations/qt_lv.qm new file mode 100644 index 0000000..c1dbfbd Binary files /dev/null and b/release/translations/qt_lv.qm differ diff --git a/release/translations/qt_pl.qm b/release/translations/qt_pl.qm new file mode 100644 index 0000000..62988d2 Binary files /dev/null and b/release/translations/qt_pl.qm differ diff --git a/release/translations/qt_ru.qm b/release/translations/qt_ru.qm new file mode 100644 index 0000000..7f092e9 Binary files /dev/null and b/release/translations/qt_ru.qm differ diff --git a/release/translations/qt_sk.qm b/release/translations/qt_sk.qm new file mode 100644 index 0000000..215d234 Binary files /dev/null and b/release/translations/qt_sk.qm differ diff --git a/release/translations/qt_uk.qm b/release/translations/qt_uk.qm new file mode 100644 index 0000000..02103d8 Binary files /dev/null and b/release/translations/qt_uk.qm differ diff --git a/release/translations/qt_zh_TW.qm b/release/translations/qt_zh_TW.qm new file mode 100644 index 0000000..051b516 Binary files /dev/null and b/release/translations/qt_zh_TW.qm differ