2025-09-28T17:19:30
This commit is contained in:
parent
f22e46dba4
commit
e1e7bc984f
BIN
experiment_data/sample_data/new_2025_09_28_08_41_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_41_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_49_55.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_49_55.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_51_43.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_51_43.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_51_58.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_51_58.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_52_02.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_52_02.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_52_48.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_52_48.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_54_03.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_54_03.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_57_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_57_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_09_30_38.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_09_30_38.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_10_01_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_10_01_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_10_29_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_10_29_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_12_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_12_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_16_53.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_16_53.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_25_00.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_25_00.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_28_02.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_28_02.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_40_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_40_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_40_47.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_40_47.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_41_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_41_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_45_16.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_45_16.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_08_30.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_08_30.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_09_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_09_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_10_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_10_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_11_14.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_11_14.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_11_27.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_11_27.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_11_50.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_11_50.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_12_52.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_12_52.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_13_09.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_13_09.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_13_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_13_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_36_16.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_36_16.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_36_29.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_36_29.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_40_31.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_40_31.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_59_00.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_59_00.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_02_51.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_02_51.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_04_38.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_04_38.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_09_15.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_09_15.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_20_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_20_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_23_52.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_23_52.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_24_47.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_24_47.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_25_04.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_25_04.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_27_53.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_27_53.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_26_27.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_26_27.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_27_08.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_27_08.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_27_41.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_27_41.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_28_04.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_28_04.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_28_30.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_28_30.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_28_53.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_28_53.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_29_50.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_29_50.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_30_27.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_30_27.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_31_15.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_31_15.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_31_41.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_31_41.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_32_29.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_32_29.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_33_16.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_33_16.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_37_58.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_37_58.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_52_33.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_52_33.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_53_08.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_53_08.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_53_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_53_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_16_03_50.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_16_03_50.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/~$new_2025_09_28_15_29_50.xlsx
Normal file
BIN
experiment_data/sample_data/~$new_2025_09_28_15_29_50.xlsx
Normal file
Binary file not shown.
@ -147,7 +147,7 @@ void XlsxHandler::readPhaseData(QXlsx::Worksheet *workSheet, int &startLineIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XlsxHandler::writeExperimentFile(const QString filePath) {
|
void XlsxHandler::writeExperimentFile(const QString filePath) {
|
||||||
logde << "write file...";
|
logde << "writeExperimentFile...";
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(Global::_curveExperimentDataVtr.empty()){
|
if(Global::_curveExperimentDataVtr.empty()){
|
||||||
@ -293,9 +293,12 @@ void XlsxHandler::writeExperimentFile(const QString filePath) {
|
|||||||
// logde<<"edVtr size:"<<edVtr.size();
|
// logde<<"edVtr size:"<<edVtr.size();
|
||||||
|
|
||||||
for (int index = 0; index < edVtr.size(); index++) {
|
for (int index = 0; index < edVtr.size(); index++) {
|
||||||
// logde<<"index :"<<index;
|
|
||||||
const Global::ExperimentData &ed = edVtr.at(index);
|
const Global::ExperimentData &ed = edVtr.at(index);
|
||||||
|
// 跳过运行时间为0 的数据
|
||||||
|
if(ed.runTime == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
xlsx.write(row, 1, index);
|
xlsx.write(row, 1, index);
|
||||||
xlsx.write(row, 2, ed.runTime);
|
xlsx.write(row, 2, ed.runTime);
|
||||||
xlsx.write(row, 3, ed.sampleTemp);
|
xlsx.write(row, 3, ed.sampleTemp);
|
||||||
@ -667,6 +670,8 @@ void XlsxHandler::writeSmoothnessFile(const QString filePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XlsxHandler::writeXlsxFile(const QString filePath) {
|
void XlsxHandler::writeXlsxFile(const QString filePath) {
|
||||||
|
logde<<"write xlsx file...";
|
||||||
|
|
||||||
if (Global::_curveFileDataVtr.empty()) {
|
if (Global::_curveFileDataVtr.empty()) {
|
||||||
logde << "curve file data vtr empty...";
|
logde << "curve file data vtr empty...";
|
||||||
return;
|
return;
|
||||||
|
@ -413,16 +413,18 @@ void MainWindow::startExperiment() {
|
|||||||
|
|
||||||
SerialPort::instance()->slotSendData(ba);
|
SerialPort::instance()->slotSendData(ba);
|
||||||
|
|
||||||
Global::_mode = Global::Mode::Experiment;
|
Global::_mode = Global::Mode::Experiment;
|
||||||
_manuallyStopTheExperimentFlag = false;
|
_manuallyStopTheExperimentFlag = false;
|
||||||
_centralWidget->startExperiment();
|
_centralWidget->startExperiment();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::startExperimentByDeviceInfo()
|
void MainWindow::startExperimentByDeviceInfo() {
|
||||||
{
|
Global::_mode = Global::Mode::Experiment;
|
||||||
Global::_mode = Global::Mode::Experiment;
|
|
||||||
_manuallyStopTheExperimentFlag = false;
|
_manuallyStopTheExperimentFlag = false;
|
||||||
_centralWidget->startExperiment();
|
_centralWidget->startExperiment();
|
||||||
|
|
||||||
|
// 实验开始,清除上一个实验所有数据。
|
||||||
|
Global::clearExperimentData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionStop_triggered() {
|
void MainWindow::on_actionStop_triggered() {
|
||||||
@ -468,7 +470,7 @@ void MainWindow::on_actionNew_triggered() {
|
|||||||
|
|
||||||
void MainWindow::on_actionStart_triggered() {
|
void MainWindow::on_actionStart_triggered() {
|
||||||
logde << "start experiment,set soft into experiment mode.";
|
logde << "start experiment,set soft into experiment mode.";
|
||||||
logde<<"```````````````````````````````";
|
logde << "```````````````````````````````";
|
||||||
|
|
||||||
if (!SerialPort::instance()->isOpen()) {
|
if (!SerialPort::instance()->isOpen()) {
|
||||||
showMesgBox("设备未连接,请先连接设备。");
|
showMesgBox("设备未连接,请先连接设备。");
|
||||||
@ -500,7 +502,10 @@ void MainWindow::slotSaveExperimentalDataMsgBox() {
|
|||||||
// auto save file.
|
// auto save file.
|
||||||
logde << "slotSaveExperimentalDataMsgBox saveFile ...";
|
logde << "slotSaveExperimentalDataMsgBox saveFile ...";
|
||||||
QString finalFileName;
|
QString finalFileName;
|
||||||
if (saveFile(Global::_experimentInfo.sampleName, Global::Mode::Experiment, finalFileName, true)) {
|
if (saveFile(Global::_experimentInfo.sampleName,
|
||||||
|
Global::Mode::Experiment,
|
||||||
|
finalFileName,
|
||||||
|
true)) {
|
||||||
_leftWidget->reloadFileName();
|
_leftWidget->reloadFileName();
|
||||||
|
|
||||||
QString str = QString("%1 文件保存成功。").arg(finalFileName);
|
QString str = QString("%1 文件保存成功。").arg(finalFileName);
|
||||||
@ -526,6 +531,8 @@ void MainWindow::on_actionConnectToDev_triggered() {
|
|||||||
logde << "connect to device...";
|
logde << "connect to device...";
|
||||||
|
|
||||||
if (SerialPort::instance()->isOpen()) {
|
if (SerialPort::instance()->isOpen()) {
|
||||||
|
logde << "close device.";
|
||||||
|
|
||||||
SerialPort::instance()->closeSp();
|
SerialPort::instance()->closeSp();
|
||||||
|
|
||||||
ui->actionConnectToDev->setIcon(QIcon(":/images/connect.png"));
|
ui->actionConnectToDev->setIcon(QIcon(":/images/connect.png"));
|
||||||
@ -537,29 +544,25 @@ void MainWindow::on_actionConnectToDev_triggered() {
|
|||||||
slotUpdateStatusbarMsg(str);
|
slotUpdateStatusbarMsg(str);
|
||||||
showMesgBox(str);
|
showMesgBox(str);
|
||||||
} else {
|
} else {
|
||||||
|
logde << "open device.";
|
||||||
|
|
||||||
if (SerialPort::instance()->openSp()) {
|
if (SerialPort::instance()->openSp()) {
|
||||||
|
|
||||||
logde << "open serial port success. 1";
|
|
||||||
|
|
||||||
setActionEnable(true);
|
setActionEnable(true);
|
||||||
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||||
Global::_mode = Global::Mode::ConnectedToDev;
|
Global::_mode = Global::Mode::ConnectedToDev;
|
||||||
|
|
||||||
logde << "open serial port success. 2";
|
|
||||||
|
|
||||||
QByteArray ba = DataParser::inquirePhaseInfo();
|
QByteArray ba = DataParser::inquirePhaseInfo();
|
||||||
SerialPort::instance()->sendData(ba);
|
SerialPort::instance()->sendData(ba);
|
||||||
|
|
||||||
ui->actionConnectToDev->setIcon(QIcon(":/images/disconnect.png"));
|
ui->actionConnectToDev->setIcon(QIcon(":/images/disconnect.png"));
|
||||||
ui->actionConnectToDev->setText("断开连接");
|
ui->actionConnectToDev->setText("断开连接");
|
||||||
|
|
||||||
logde << "open serial port.";
|
|
||||||
//
|
//
|
||||||
logde << "open serial port success. 3";
|
|
||||||
|
|
||||||
QString str("设备已连接。");
|
QString str("设备已连接。");
|
||||||
slotUpdateStatusbarMsg(str);
|
slotUpdateStatusbarMsg(str);
|
||||||
showMesgBox(str);
|
showMesgBox(str);
|
||||||
|
|
||||||
|
logde << "open serial port success. ";
|
||||||
} else {
|
} else {
|
||||||
// QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
// QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
||||||
showMesgBox("设备打开失败。");
|
showMesgBox("设备打开失败。");
|
||||||
@ -568,7 +571,7 @@ void MainWindow::on_actionConnectToDev_triggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionStartPoint_triggered() {
|
void MainWindow::on_actionStartPoint_triggered() {
|
||||||
logde<<"start experiment...";
|
logde << "start experiment...";
|
||||||
|
|
||||||
_rightWidget->show();
|
_rightWidget->show();
|
||||||
_centralWidget->setAnalysisMode(CentralWidget::AnalysisMode::StartPoint);
|
_centralWidget->setAnalysisMode(CentralWidget::AnalysisMode::StartPoint);
|
||||||
@ -590,6 +593,11 @@ void MainWindow::on_actionPeakSynthesisAnalysis_triggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionClearAllData_triggered() {
|
void MainWindow::on_actionClearAllData_triggered() {
|
||||||
|
// 实验过程中,不允许清除数据。
|
||||||
|
if(Global::_mode == Global::Mode::Experiment) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
slotUpdateStatusbarMsg("");
|
slotUpdateStatusbarMsg("");
|
||||||
|
|
||||||
_rightWidget->hide();
|
_rightWidget->hide();
|
||||||
|
@ -77,33 +77,28 @@ SerialPort *SerialPort::instance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SerialPort::~SerialPort() {
|
SerialPort::~SerialPort() {
|
||||||
logde<<"serialport destructor.";
|
logde << "serialport destructor.";
|
||||||
|
|
||||||
|
closeSp();
|
||||||
|
|
||||||
if (_sp && _sp->isOpen()) {
|
|
||||||
_sp->clear();
|
|
||||||
_sp->close();
|
|
||||||
}
|
|
||||||
delete _sp;
|
delete _sp;
|
||||||
_sp = nullptr;
|
_sp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::timerEvent(QTimerEvent *event) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerialPort::slotReadData() {
|
void SerialPort::slotReadData() {
|
||||||
QByteArray ba = _sp->readAll();
|
QByteArray ba = _sp->readAll();
|
||||||
if (ba.size() == 0) {
|
if (ba.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
logde << "receive info (hex):" << hexData.toStdString();
|
logde << "receive info (hex):" << hexData.toStdString();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
||||||
if (FRANE_HEAD != spp->head) {
|
if (FRANE_HEAD != spp->head) {
|
||||||
qDebug() << "Data header error.";
|
logde << "Data header error.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,20 +141,40 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
|
|
||||||
// Switch the software mode accord to the serial port data.
|
// Switch the software mode accord to the serial port data.
|
||||||
switch (cd.run_type) {
|
switch (cd.run_type) {
|
||||||
case DeviceRunStatus::Heat:
|
case DeviceRunStatus::Heat:
|
||||||
case DeviceRunStatus::ConstantTemp:
|
case DeviceRunStatus::ConstantTemp:
|
||||||
if (Global::_mode != Global::Mode::Experiment) {
|
if (Global::_mode != Global::Mode::Experiment) {
|
||||||
Global::_mode = Global::Mode::Experiment;
|
Global::_mode = Global::Mode::Experiment;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DeviceRunStatus::Idle:
|
||||||
|
case DeviceRunStatus::Cooling:
|
||||||
|
if (Global::_mode != Global::Mode::Analysis) {
|
||||||
|
Global::_mode = Global::Mode::Analysis;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否根据下位机数据,切换软件实验模式。
|
||||||
|
static Global::Mode preMode = Global::Mode::Analysis;
|
||||||
|
bool sendSaveSignalFlag = false;
|
||||||
|
if (Global::_mode != preMode) {
|
||||||
|
if (preMode == Global::Mode::Experiment
|
||||||
|
&& Global::_mode == Global::Mode::Analysis) {
|
||||||
|
sendSaveSignalFlag = true;
|
||||||
|
} else if (preMode == Global::Mode::Analysis
|
||||||
|
&& Global::_mode == Global::Mode::Experiment) {
|
||||||
|
|
||||||
|
// 根据下位机数据,软件进入实验模式,开始实验。
|
||||||
|
logde << "start experiment, accord to device data...";
|
||||||
|
logde << "---------------------";
|
||||||
|
|
||||||
|
emit sigStartExperiment();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case DeviceRunStatus::Idle:
|
preMode = Global::_mode;
|
||||||
case DeviceRunStatus::Cooling:
|
|
||||||
if (Global::_mode != Global::Mode::Analysis) {
|
|
||||||
Global::_mode = Global::Mode::Analysis;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If phase update, add new phase data to the global param.
|
// If phase update, add new phase data to the global param.
|
||||||
@ -174,11 +189,12 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
ced.phaseIndex = cd.current_phase;
|
ced.phaseIndex = cd.current_phase;
|
||||||
|
|
||||||
Global::_curveExperimentDataVtr.push_back(ced);
|
Global::_curveExperimentDataVtr.push_back(ced);
|
||||||
|
|
||||||
Global::_currentCurveExperimentDataPtr =
|
Global::_currentCurveExperimentDataPtr =
|
||||||
&Global::_curveExperimentDataVtr.last();
|
&Global::_curveExperimentDataVtr.last();
|
||||||
|
|
||||||
Global::_currentCurveExperimentDataPtr->fileName =
|
Global::_currentCurveExperimentDataPtr->fileName =
|
||||||
Global::_experimentInfo.sampleName;
|
Global::_experimentInfo.sampleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,22 +208,22 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
bool experimentEnded = false;
|
bool experimentEnded = false;
|
||||||
QString devRunModeStr;
|
QString devRunModeStr;
|
||||||
switch (cd.run_type) {
|
switch (cd.run_type) {
|
||||||
case DeviceRunStatus::Heat:
|
case DeviceRunStatus::Heat:
|
||||||
devRunModeStr = "升温";
|
devRunModeStr = "升温";
|
||||||
experimentEnded = true;
|
experimentEnded = true;
|
||||||
break;
|
break;
|
||||||
case DeviceRunStatus::ConstantTemp:
|
case DeviceRunStatus::ConstantTemp:
|
||||||
devRunModeStr = "实验";
|
devRunModeStr = "实验";
|
||||||
experimentEnded = true;
|
experimentEnded = true;
|
||||||
break;
|
break;
|
||||||
case DeviceRunStatus::Idle:
|
case DeviceRunStatus::Idle:
|
||||||
case DeviceRunStatus::Cooling:
|
case DeviceRunStatus::Cooling:
|
||||||
devRunModeStr = "冷却";
|
devRunModeStr = "冷却";
|
||||||
experimentEnded = false;
|
experimentEnded = false;
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
@ -219,28 +235,32 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
|
|
||||||
emit sigUpdateStatusbarMsg(msg);
|
emit sigUpdateStatusbarMsg(msg);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
// If save experiment data.
|
// If save experiment data.
|
||||||
static Global::Mode preMode = Global::Mode::Analysis;
|
static Global::Mode preMode = Global::Mode::Analysis;
|
||||||
bool sendSaveSignalFlag = false;
|
bool sendSaveSignalFlag = false;
|
||||||
if (Global::_mode != preMode) {
|
if (Global::_mode != preMode) {
|
||||||
if (preMode == Global::Mode::Experiment
|
if (preMode == Global::Mode::Experiment
|
||||||
&& Global::_mode == Global::Mode::Analysis) {
|
&& Global::_mode == Global::Mode::Analysis) {
|
||||||
sendSaveSignalFlag = true;
|
sendSaveSignalFlag = true;
|
||||||
} else if (preMode == Global::Mode::Analysis
|
} else if (preMode == Global::Mode::Analysis
|
||||||
&& Global::_mode == Global::Mode::Experiment) {
|
&& Global::_mode == Global::Mode::Experiment) {
|
||||||
logde<<"update status accord to device data...";
|
|
||||||
logde<<"--------------------------------------";
|
// 根据下位机数据,软件进入实验模式,开始实验。
|
||||||
|
logde << "start experiment, accord to device data...";
|
||||||
|
logde << "---------------------";
|
||||||
|
|
||||||
emit sigStartExperiment();
|
emit sigStartExperiment();
|
||||||
}
|
}
|
||||||
|
|
||||||
preMode = Global::_mode;
|
preMode = Global::_mode;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 弹出保存数据对话框。
|
||||||
if (sendSaveSignalFlag && !Global::_OITAutoAnalysisModeFlag) {
|
if (sendSaveSignalFlag && !Global::_OITAutoAnalysisModeFlag) {
|
||||||
emit sigSaveExperimentalDataMsgBox();
|
emit sigSaveExperimentalDataMsgBox();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
||||||
@ -256,7 +276,7 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
|||||||
phase.temp_flow = cd.phase_data[index].temp_flow;
|
phase.temp_flow = cd.phase_data[index].temp_flow;
|
||||||
phase.cutoff_temp = cd.phase_data[index].cutoff_temp;
|
phase.cutoff_temp = cd.phase_data[index].cutoff_temp;
|
||||||
phase.constant_temp_time_min =
|
phase.constant_temp_time_min =
|
||||||
cd.phase_data[index].constant_temp_time_min;
|
cd.phase_data[index].constant_temp_time_min;
|
||||||
|
|
||||||
localLength -= phaseByteSize;
|
localLength -= phaseByteSize;
|
||||||
localAddr += phaseByteSize;
|
localAddr += phaseByteSize;
|
||||||
@ -265,82 +285,88 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
|||||||
while (localLength) {
|
while (localLength) {
|
||||||
logde << "localLength:" << localLength;
|
logde << "localLength:" << localLength;
|
||||||
switch (localAddr) {
|
switch (localAddr) {
|
||||||
case offsetof(CommonData, run_type): // 运行状态
|
case offsetof(CommonData, run_type): // 运行状态
|
||||||
{
|
{
|
||||||
switch (cd.run_type) {
|
switch (cd.run_type) {
|
||||||
case DeviceRunStatus::Cooling:
|
case DeviceRunStatus::Cooling:
|
||||||
// Global::instance()->setMode(Global::Mode::Analysis);
|
// Global::instance()->setMode(Global::Mode::Analysis);
|
||||||
Global::_mode = Global::Mode::Analysis;
|
Global::_mode = Global::Mode::Analysis;
|
||||||
logde << "set global mode analysis.common data parser.";
|
logde << "set global mode analysis.common data parser.";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
localAddr += 1;
|
||||||
|
localLength -= 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case offsetof(CommonData, current_gas): // 当前气氛
|
||||||
localAddr += 1;
|
// gas_type_set(dev->temp, msg_data.current_gas);
|
||||||
localLength -= 1;
|
localAddr += 1;
|
||||||
|
localLength -= 1;
|
||||||
break;
|
|
||||||
}
|
|
||||||
case offsetof(CommonData, current_gas): // 当前气氛
|
|
||||||
// gas_type_set(dev->temp, msg_data.current_gas);
|
|
||||||
localAddr += 1;
|
|
||||||
localLength -= 1;
|
|
||||||
break;
|
|
||||||
case offsetof(CommonData, auto_pid_temp_flow): // 自整定升温速率
|
|
||||||
localAddr += 4;
|
|
||||||
localLength -= 4;
|
|
||||||
break;
|
|
||||||
case offsetof(CommonData, run_mode): {
|
|
||||||
DeviceStartMode mode = (DeviceStartMode)cd.run_mode;
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case DeviceStartMode::Stop:
|
|
||||||
Global::_mode = Global::Mode::Analysis;
|
|
||||||
logde << "set global mode analysis.";
|
|
||||||
break;
|
break;
|
||||||
case DeviceStartMode::Start:
|
case offsetof(CommonData, auto_pid_temp_flow): // 自整定升温速率
|
||||||
Global::_mode = Global::Mode::Experiment;
|
localAddr += 4;
|
||||||
|
localLength -= 4;
|
||||||
break;
|
break;
|
||||||
default:
|
case offsetof(CommonData, run_mode): {
|
||||||
|
DeviceStartMode mode = (DeviceStartMode)cd.run_mode;
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case DeviceStartMode::Stop:
|
||||||
|
Global::_mode = Global::Mode::Analysis;
|
||||||
|
logde << "set global mode analysis.";
|
||||||
|
break;
|
||||||
|
case DeviceStartMode::Start:
|
||||||
|
Global::_mode = Global::Mode::Experiment;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
localLength--;
|
||||||
|
localAddr++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//
|
case offsetof(CommonData, phase_data[0].onoff):
|
||||||
localLength--;
|
phaseParserFunc(0);
|
||||||
localAddr++;
|
break;
|
||||||
|
case offsetof(CommonData, phase_data[1].onoff):
|
||||||
break;
|
phaseParserFunc(1);
|
||||||
}
|
break;
|
||||||
case offsetof(CommonData, phase_data[0].onoff):
|
case offsetof(CommonData, phase_data[2].onoff):
|
||||||
phaseParserFunc(0);
|
phaseParserFunc(2);
|
||||||
break;
|
break;
|
||||||
case offsetof(CommonData, phase_data[1].onoff):
|
case offsetof(CommonData, phase_data[3].onoff):
|
||||||
phaseParserFunc(1);
|
phaseParserFunc(3);
|
||||||
break;
|
break;
|
||||||
case offsetof(CommonData, phase_data[2].onoff):
|
case offsetof(CommonData, phase_data[4].onoff):
|
||||||
phaseParserFunc(2);
|
phaseParserFunc(4);
|
||||||
break;
|
break;
|
||||||
case offsetof(CommonData, phase_data[3].onoff):
|
case offsetof(CommonData, phase_data[5].onoff):
|
||||||
phaseParserFunc(3);
|
phaseParserFunc(5);
|
||||||
break;
|
break;
|
||||||
case offsetof(CommonData, phase_data[4].onoff):
|
default:
|
||||||
phaseParserFunc(4);
|
localLength--;
|
||||||
break;
|
break;
|
||||||
case offsetof(CommonData, phase_data[5].onoff):
|
|
||||||
phaseParserFunc(5);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
localLength--;
|
|
||||||
break;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SerialPort::openSp() {
|
bool SerialPort::openSp() {
|
||||||
logde << "openSp 1";
|
logde << "openSp 1";
|
||||||
|
closeSp();
|
||||||
|
QThread::msleep(100);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (_sp != nullptr && _sp->isOpen()) {
|
if (_sp != nullptr && _sp->isOpen()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
logde << "openSp 2";
|
logde << "openSp 2";
|
||||||
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
|
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
|
||||||
u16 pid = info.productIdentifier();
|
u16 pid = info.productIdentifier();
|
||||||
@ -376,7 +402,7 @@ bool SerialPort::openSp() {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// qDebug() << "open succ.";
|
// qDebug() << "open succ.";
|
||||||
logde<<"openSp 5.";
|
logde << "openSp 5.";
|
||||||
// 设置 DTR 信号为就绪状态(true 表示低电平)
|
// 设置 DTR 信号为就绪状态(true 表示低电平)
|
||||||
_sp->setDataTerminalReady(true);
|
_sp->setDataTerminalReady(true);
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,6 @@ public:
|
|||||||
bool openSp();
|
bool openSp();
|
||||||
bool isOpen(){return _sp->isOpen();}
|
bool isOpen(){return _sp->isOpen();}
|
||||||
bool closeSp();
|
bool closeSp();
|
||||||
protected:
|
|
||||||
void timerEvent(QTimerEvent *event);
|
|
||||||
signals:
|
signals:
|
||||||
void sigSendCommonData(const CommonData &);
|
void sigSendCommonData(const CommonData &);
|
||||||
void sigSendCommonDataToRealDataForm(const CommonData &);
|
void sigSendCommonDataToRealDataForm(const CommonData &);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -661,9 +661,9 @@ void ExperimentSettingForm::slotPhaseCheck() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba) {
|
void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba) {
|
||||||
logde << "----------------------- recv";
|
logde << "recv phase info ----------------------- ";
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
qDebug() << "slotRecvPhaseInfo hex:" << hexData;
|
qDebug() << "slotRecvPhaseInfo hex:" << hexData;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user