diff --git a/HPPA/AppSettings.cpp b/HPPA/AppSettings.cpp index 2aa1025..390584a 100644 --- a/HPPA/AppSettings.cpp +++ b/HPPA/AppSettings.cpp @@ -8,6 +8,8 @@ const int AppSettings::kDefaultIntegrationTime = 1; const int AppSettings::kDefaultGain = 0; const QString AppSettings::kDefaultSLRDataFolder = QString(); const QString AppSettings::kDefaultDepthCameraDataFolder = QString(); +const double AppSettings::kDefaultScanSpeed = 1.0; +const double AppSettings::kDefaultReturnSpeed = 5.0; AppSettings::AppSettings() : m_settings(QSettings::IniFormat, QSettings::UserScope, @@ -115,3 +117,23 @@ void AppSettings::setFiberImagerDataFolder(const QString& path) { m_settings.setValue("General/FiberImagerDataFolder", path); } + +double AppSettings::scanSpeed() const +{ + return m_settings.value("OneMotorControl/ScanSpeed", kDefaultScanSpeed).toDouble(); +} + +void AppSettings::setScanSpeed(double value) +{ + m_settings.setValue("OneMotorControl/ScanSpeed", value); +} + +double AppSettings::returnSpeed() const +{ + return m_settings.value("OneMotorControl/ReturnSpeed", kDefaultReturnSpeed).toDouble(); +} + +void AppSettings::setReturnSpeed(double value) +{ + m_settings.setValue("OneMotorControl/ReturnSpeed", value); +} diff --git a/HPPA/AppSettings.h b/HPPA/AppSettings.h index 09e990b..b0be810 100644 --- a/HPPA/AppSettings.h +++ b/HPPA/AppSettings.h @@ -37,6 +37,14 @@ public: QString FiberImagerDataFolder() const; void setFiberImagerDataFolder(const QString& path); + + // 扫描速度 + double scanSpeed() const; + void setScanSpeed(double value); + + // 返回速度 + double returnSpeed() const; + void setReturnSpeed(double value); // 在此处添加更多参数的 getter/setter ... private: @@ -54,4 +62,6 @@ private: static const int kDefaultGain; static const QString kDefaultSLRDataFolder; static const QString kDefaultDepthCameraDataFolder; + static const double kDefaultScanSpeed; + static const double kDefaultReturnSpeed; }; diff --git a/HPPA/CommunicationViaTCP.cpp b/HPPA/CommunicationViaTCP.cpp index 6fa5937..16f90cb 100644 --- a/HPPA/CommunicationViaTCP.cpp +++ b/HPPA/CommunicationViaTCP.cpp @@ -32,6 +32,7 @@ void CommunicationViaTCP::onNewConnection() m_bConnected = true; m_tcpSocket = m_tcpServer->nextPendingConnection(); connect(m_tcpSocket, SIGNAL(disconnected()), this, SLOT(onTcpSocketDisconnected())); + connect(m_tcpSocket, &QTcpSocket::readyRead, this, &CommunicationViaTCP::receiveData); emit connected(); } @@ -49,6 +50,32 @@ void CommunicationViaTCP::onTcpSocketDisconnected() m_tcpSocket->deleteLater(); } +void CommunicationViaTCP::receiveData() +{ + if (!isConnected()) + { + qWarning() << "receiveData: No client connected"; + return; + } + + QByteArray data = m_tcpSocket->readAll(); + if (data.isEmpty()) + { + return; + } + + bool ok; + int position = QString::fromUtf8(data).toInt(&ok); + if (ok) + { + qDebug() << "Received position:" << position; + emit positionReceived(position); + } else + { + qWarning() << "Failed to parse position data:" << data; + } +} + int CommunicationViaTCP::sendCommand(const QString cmd) { if (!isConnected()) { diff --git a/HPPA/CommunicationViaTCP.h b/HPPA/CommunicationViaTCP.h index 305d961..cb00245 100644 --- a/HPPA/CommunicationViaTCP.h +++ b/HPPA/CommunicationViaTCP.h @@ -37,9 +37,11 @@ namespace MotorParams { public Q_SLOTS: void onNewConnection(); + void receiveData(); void onTcpSocketDisconnected(); signals: void commandSendResult(int bytesWritten, const QString& error = QString()); + void positionReceived(int position); }; } diff --git a/HPPA/FodisWindow.cpp b/HPPA/FodisWindow.cpp index 2547b49..6697c0c 100644 --- a/HPPA/FodisWindow.cpp +++ b/HPPA/FodisWindow.cpp @@ -9,6 +9,7 @@ FodisWindow::FodisWindow(QWidget* parent) m_FiberImagerThread = new QThread(); m_JinspFiberImagerOperation = new JinspFiberImager(false, JinspFiberImagerConfig::instance().portName().toStdString(), "JINSP"); connect(m_JinspFiberImagerOperation, &JinspFiberImager::spectalCaptured, this, &FodisWindow::spectalCaptured); + connect(m_JinspFiberImagerOperation, &JinspFiberImager::exposureCompleteSignal, this, &FodisWindow::exposureCompleteSignal); m_JinspFiberImagerOperation->moveToThread(m_FiberImagerThread); m_FiberImagerThread->start(); diff --git a/HPPA/FodisWindow.h b/HPPA/FodisWindow.h index 953a6c6..9f99557 100644 --- a/HPPA/FodisWindow.h +++ b/HPPA/FodisWindow.h @@ -44,6 +44,8 @@ signals: void spectalCaptured(DeviceAttribute attribute, DataFrame dataFrame); + void exposureCompleteSignal(); + private: Ui::FodisWindow ui; QThread* m_FiberImagerThread; diff --git a/HPPA/GonggaShanRecordCtl.cpp b/HPPA/GonggaShanRecordCtl.cpp index 4752cfc..93b0722 100644 --- a/HPPA/GonggaShanRecordCtl.cpp +++ b/HPPA/GonggaShanRecordCtl.cpp @@ -11,15 +11,30 @@ GonggaShanRecordCtl::GonggaShanRecordCtl(QWidget* parent) GonggaShanRecordCtl::~GonggaShanRecordCtl() { - + tcpServer6005->deleteLater(); } void GonggaShanRecordCtl::startListen() { + MotorParams::TCPConnectionParams tcpConnectionParams6005; + tcpConnectionParams6005.port = ui.spinbox_Port->text().toInt(); + tcpConnectionParams6005.serverIP = "192.168.1.2"; + tcpServer6005 = new MotorParams::CommunicationViaTCP(tcpConnectionParams6005, this); + connect(tcpServer6005, &MotorParams::CommunicationViaTCP::positionReceived, this, &GonggaShanRecordCtl::startRecord); } void GonggaShanRecordCtl::stopListen() { - + disconnect(tcpServer6005, &MotorParams::CommunicationViaTCP::positionReceived, this, &GonggaShanRecordCtl::startRecord); + + tcpServer6005->deleteLater(); +} + +void GonggaShanRecordCtl::startRecord(int position) +{ + //¼λ + + //ź + emit startRcordSignal(); } diff --git a/HPPA/GonggaShanRecordCtl.h b/HPPA/GonggaShanRecordCtl.h index 52d3398..7c6abf9 100644 --- a/HPPA/GonggaShanRecordCtl.h +++ b/HPPA/GonggaShanRecordCtl.h @@ -4,9 +4,12 @@ #include #include #include +#include #include "ui_gonggashanCtl.h" +#include "CommunicationViaTCP.h" + class GonggaShanRecordCtl : public QDialog { Q_OBJECT @@ -20,15 +23,15 @@ public Q_SLOTS: Q_SIGNALS: // Emitted when user changes any of the R/G/B wavelength values - void startRcordHsiSignal(); - void stopRcordHsiSignal(); - - void startRcordFodisSignal(); + void startRcordSignal(); private Q_SLOTS: void startListen(); void stopListen(); + void startRecord(int position); + private: Ui::gongga_control ui; + QPointer tcpServer6005; }; diff --git a/HPPA/HPPA.cpp b/HPPA/HPPA.cpp index 57f59b4..4320bc9 100644 --- a/HPPA/HPPA.cpp +++ b/HPPA/HPPA.cpp @@ -1057,16 +1057,18 @@ void HPPA::initControlTabwidget() m_tmc->setWindowFlags(Qt::Widget); ui.controlTabWidget->addTab(m_tmc, QString::fromLocal8Bit("2轴控制")); + //贡嘎山定时采集 + m_gonggaShanRecordCtl = new GonggaShanRecordCtl(this); + m_gonggaShanRecordCtl->setWindowFlags(Qt::Widget); + ui.controlTabWidget->addTab(m_gonggaShanRecordCtl, QString::fromLocal8Bit("触发采集")); + //is11 m_fodisWindow = new FodisWindow(this); connect(m_fodisWindow, &FodisWindow::spectalCaptured, this, &HPPA::showFiberImagerSpectral); m_fodisWindow->setWindowFlags(Qt::Widget); ui.controlTabWidget->addTab(m_fodisWindow, QString::fromLocal8Bit("FODIS")); - // - m_gonggaShanRecordCtl = new GonggaShanRecordCtl(this); - m_gonggaShanRecordCtl->setWindowFlags(Qt::Widget); - ui.controlTabWidget->addTab(m_gonggaShanRecordCtl, QString::fromLocal8Bit("触发采集")); + setupGonggashanAutoRecordConnection(); // Connect ImageControl band change to re-render (m_ic created in initControlTabwidget) @@ -1074,6 +1076,37 @@ void HPPA::initControlTabwidget() // this, SLOT(onBandSelectionChanged(double, double, double))); } +void HPPA::setupGonggashanAutoRecordConnection() +{ + connect(m_gonggaShanRecordCtl, &GonggaShanRecordCtl::startRcordSignal, this, &HPPA::onGonggashanRecord); + connect(m_fodisWindow, &FodisWindow::exposureCompleteSignal, this, &HPPA::onStartRecordStep1); + connect(m_omc, &OneMotorControl::sequenceComplete, m_fodisWindow, &FodisWindow::closeFiberImager); +} + +void HPPA::onGonggashanRecord() +{ + //设置文件名 + //AppSettings::instance().setFrameRate(f); + //AppSettings::instance().setIntegrationTime(e); + //AppSettings::instance().setDataFolder(filePath); + + QString dateStr = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss"); + //QString fi = AppSettings::instance().fileName() + "_" + dateStr; + AppSettings::instance().setFileName(dateStr); + + this->frame_number->setText("100000"); + + //连接马达和光谱仪 + m_omc->connectMotor(false); + + if (!testImagerVality()) + { + onconnect(); + } + + m_fodisWindow->openFiberImager(); +} + void HPPA::recordFromRobotArm(int fileCounter) { if (!testImagerVality()) diff --git a/HPPA/HPPA.h b/HPPA/HPPA.h index 0b3ed46..b0fa13d 100644 --- a/HPPA/HPPA.h +++ b/HPPA/HPPA.h @@ -362,6 +362,9 @@ private: QChart* m_FiberImagerChart; void showFiberImagerSpectral(DeviceAttribute attribute, DataFrame dataFrame); + void setupGonggashanAutoRecordConnection(); + void onGonggashanRecord(); + public Q_SLOTS: void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath); void focusPlotSpectralImg(int state); diff --git a/HPPA/HPPA.vcxproj b/HPPA/HPPA.vcxproj index ec7084a..6018b95 100644 --- a/HPPA/HPPA.vcxproj +++ b/HPPA/HPPA.vcxproj @@ -60,7 +60,7 @@ Spectral Insight - D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;C:\Program Files\OrbbecSDK 2.7.6\include;D:\cpp_library\EDSDK132010CD(13.20.10)\Windows\EDSDK_64\Header;$(IncludePath) + D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;C:\Program Files\OrbbecSDK 2.7.6\include;D:\cpp_library\EDSDK132010CD(13.20.10)\Windows\EDSDK_64\Header;D:\cpp_project_vs2022\HPPA\JinspSpectralmeterControl;$(IncludePath) D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017_release;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Release;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\IrisMultiMotorController\x64\Release;C:\XIMEA\API\xiAPI;C:\Program Files\OrbbecSDK 2.7.6\lib;D:\cpp_library\EDSDK132010CD(13.20.10)\Windows\EDSDK_64\Library;$(LibraryPath) Spectral Insight @@ -71,11 +71,12 @@ %(PreprocessorDefinitions) + stdcpp14 - opencv_world3411.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;resonon-allied.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++.lib;xiapi64.lib;IrisMultiMotorController.lib;OrbbecSDK.lib;EDSDK.lib;%(AdditionalDependencies) + opencv_world3411.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;resonon-allied.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++.lib;xiapi64.lib;IrisMultiMotorController.lib;OrbbecSDK.lib;EDSDK.lib;JinspSpectralmeterControl.lib;%(AdditionalDependencies) D:\cpp_project_vs2022\HPPA\x64\Release;%(AdditionalLibraryDirectories) diff --git a/HPPA/JinspFiberImager.cpp b/HPPA/JinspFiberImager.cpp index 2fa20a5..d969c29 100644 --- a/HPPA/JinspFiberImager.cpp +++ b/HPPA/JinspFiberImager.cpp @@ -1,6 +1,7 @@ // // Created by 73505 on 2023/5/7. // +#include #include "JinspFiberImager.h" @@ -12,7 +13,7 @@ JinspFiberImager::JinspFiberImager(bool bIsUSBMode, std::string ucPortNumber, st m_record = false; - m_captureIntervalMilliseconds = 5 * 1000; + m_captureIntervalMilliseconds = 1 * 1000; qRegisterMetaType("DeviceAttribute"); qRegisterMetaType("DataFrame"); @@ -188,73 +189,108 @@ void JinspFiberImager::recordTarget(int recordTimes, QString path) void JinspFiberImager::autoExpose() { -// float fPredictedExposureTime; -// m_FiberSpectrometer->PerformAutoExposure(0.6,0.9,fPredictedExposureTime); + int allowMaxExposure = 6000; - //tc DeviceAttribute attribute; getDeviceAttribute(attribute); - int iterations = 0;//记录自动曝光已经迭代的次数 - int maxIterations = 10;//允许最大的迭代次数 + const ZZ_U32 maxPixelValue = m_MaxValueOfFiberSpectrometer; + const double targetMinRatio = 0.80; + const double targetMaxRatio = 0.90; + const ZZ_U32 targetMin = maxPixelValue * targetMinRatio; + const ZZ_U32 targetMax = maxPixelValue * targetMaxRatio; - ZZ_U32 thresholdValue = m_MaxValueOfFiberSpectrometer * 0.8;//最佳线性区间为80% - ZZ_U16 range = 10000; + ZZ_U32 thresholdLow = targetMin; + ZZ_U32 thresholdHigh = targetMax; - //设置初始曝光时间 - int exposureTimeInMS = 200; - setExposureTime(exposureTimeInMS); + // 自适应初始曝光时间:先快速探测亮度水平 + int exposureTime = 10; + setExposureTime(exposureTime); + DataFrame dataFrame; + singleShot(dataFrame); + ZZ_S32 maxValue = GetMaxValue(dataFrame.lData, attribute.iPixels); -// int exposureTime; -// m_FiberSpectrometer->GetExposureTime(exposureTime); - - emit sendExposureTimeSignal(exposureTimeInMS); - - DataFrame integratingSphereData_tmp; - ZZ_S32 maxValue; - while (true) + // 探测阶段:快速逼近目标区间 + if (maxValue > 0) { - if (iterations > maxIterations)//是否超过允许的最大迭代次数 + // 预测达到目标区间所需的曝光时间 + ZZ_U32 targetValue = (targetMin + targetMax) / 2; + double predictedRatio = static_cast(targetValue) / maxValue; + // 曝光时间与亮度为对数关系,使用对数预测更准确 + double logRatio = log(static_cast(targetValue) / maxValue + 0.001); + int predictedExposure = static_cast(exposureTime * pow(predictedRatio, 0.7)); + + if (predictedExposure < 1) + predictedExposure = 1; + if (predictedExposure > allowMaxExposure) + predictedExposure = allowMaxExposure; + //predictedExposure = std::clamp(predictedExposure, 1, allowMaxExposure); + + exposureTime = predictedExposure; + setExposureTime(exposureTime); + singleShot(dataFrame); + maxValue = GetMaxValue(dataFrame.lData, attribute.iPixels); + } + + emit sendExposureTimeSignal(exposureTime); + + // 二分查找阶段:在目标区间内精确查找 + int lowExposure = 1; + int highExposure = allowMaxExposure; + int iterations = 0; + const int maxIterations = 10; + + while (iterations < maxIterations) + { + // 检查是否已在目标区间内 + if (maxValue >= thresholdLow && maxValue <= thresholdHigh) { + std::cout << "自动曝光完成 - 曝光时间:" << exposureTime + << "ms, 最大值:" << maxValue << std::endl; break; } - singleShot(integratingSphereData_tmp); - maxValue = GetMaxValue(integratingSphereData_tmp.lData, attribute.iPixels); + // 获取当前曝光时间 + m_FiberSpectrometer->GetExposureTime(exposureTime); - if (maxValue < thresholdValue && maxValue < (thresholdValue - range))//曝光时间过小 + if (maxValue < thresholdLow) { - double scale = 1 + ((double)(thresholdValue - maxValue) / (double)thresholdValue); - - int exposureTime; - m_FiberSpectrometer->GetExposureTime(exposureTime); - m_FiberSpectrometer->SetExposureTime(exposureTime * scale); - - emit sendExposureTimeSignal(exposureTime); - - std::cout << "自动曝光-----------" << "最大值为" << maxValue << std::endl; - } - else if (maxValue > thresholdValue)//曝光时间过大 + // 曝光不足,增大曝光时间 - 使用二分策略 + lowExposure = exposureTime; + int newExposure = (exposureTime + highExposure) / 2; + if (newExposure <= exposureTime) + { + newExposure = exposureTime * 2; + } + exposureTime = std::min(newExposure, allowMaxExposure); + std::cout << "自动曝光 +++ (" << iterations << ") 曝光时间:" + << exposureTime << "ms, 最大值:" << maxValue << std::endl; + } + else { - double scale = 1 - ((double)(maxValue - thresholdValue) / (double)thresholdValue); - - int exposureTime; - m_FiberSpectrometer->GetExposureTime(exposureTime); - m_FiberSpectrometer->SetExposureTime(exposureTime * scale); - - emit sendExposureTimeSignal(exposureTime); - - std::cout << "自动曝光++++++++++++" << "最大值为" << maxValue << std::endl; - } - else//找到最佳曝光时间,跳出while循环 - { - break; + // 曝光过度,减小曝光时间 - 使用二分策略 + highExposure = exposureTime; + int newExposure = (lowExposure + exposureTime) / 2; + if (newExposure >= exposureTime) { + newExposure = exposureTime / 2; + } + exposureTime = std::max(newExposure, 1); + std::cout << "自动曝光 --- (" << iterations << ") 曝光时间:" + << exposureTime << "ms, 最大值:" << maxValue << std::endl; } + setExposureTime(exposureTime); + singleShot(dataFrame); + maxValue = GetMaxValue(dataFrame.lData, attribute.iPixels); + emit sendExposureTimeSignal(exposureTime); + iterations++; } - int a = 2; + if (iterations >= maxIterations) { + std::cout << "自动曝光达到最大迭代次数,最终曝光时间:" + << exposureTime << "ms, 最大值:" << maxValue << std::endl; + } } ZZ_S32 JinspFiberImager::GetMaxValue(ZZ_S32 * dark, int number) @@ -291,6 +327,7 @@ void JinspFiberImager::OpenFiberImagerAndRecord() //曝光 autoExpose(); + emit exposureCompleteSignal(); //采集 m_record = true; diff --git a/HPPA/JinspFiberImager.h b/HPPA/JinspFiberImager.h index 726d2ed..2d57e41 100644 --- a/HPPA/JinspFiberImager.h +++ b/HPPA/JinspFiberImager.h @@ -65,4 +65,6 @@ public slots: signals: void sendExposureTimeSignal(int exposureTime); void spectalCaptured(DeviceAttribute attribute, DataFrame dataFrame); + + void exposureCompleteSignal(); }; diff --git a/HPPA/OneMotorControl.cpp b/HPPA/OneMotorControl.cpp index ffdbf55..7657cf8 100644 --- a/HPPA/OneMotorControl.cpp +++ b/HPPA/OneMotorControl.cpp @@ -16,6 +16,19 @@ OneMotorControl::OneMotorControl(QWidget* parent) : QDialog(parent) connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart())); connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement())); + + // 从 AppSettings 读取速度参数 + AppSettings& settings = AppSettings::instance(); + ui.speed_lineEdit->setText(QString::number(settings.scanSpeed())); + ui.return_speed_lineEdit->setText(QString::number(settings.returnSpeed())); + + // 连接信号,当控件数值变化时保存到 AppSettings + connect(ui.speed_lineEdit, &QLineEdit::editingFinished, [this]() { + AppSettings::instance().setScanSpeed(ui.speed_lineEdit->text().toDouble()); + }); + connect(ui.return_speed_lineEdit, &QLineEdit::editingFinished, [this]() { + AppSettings::instance().setReturnSpeed(ui.return_speed_lineEdit->text().toDouble()); + }); } OneMotorControl::~OneMotorControl() @@ -25,13 +38,21 @@ OneMotorControl::~OneMotorControl() } void OneMotorControl::onConnectMotor() +{ + connectMotor(true); +} + +void OneMotorControl::connectMotor(bool isNotification) { if (getMotorsConnectionStatus()) { - QMessageBox msgBox; - msgBox.setText(QString::fromLocal8Bit("马达已连接!")); - msgBox.exec(); + if (isNotification) + { + QMessageBox msgBox; + msgBox.setText(QString::fromLocal8Bit("马达已连接!")); + msgBox.exec(); + } return; } diff --git a/HPPA/OneMotorControl.h b/HPPA/OneMotorControl.h index c1ffaf5..ff3a8ca 100644 --- a/HPPA/OneMotorControl.h +++ b/HPPA/OneMotorControl.h @@ -8,6 +8,7 @@ #include "fileOperation.h" #include "CaptureCoordinator.h" #include "MotorWindowBase.h" +#include "AppSettings.h" class OneMotorControl : public QDialog, public MotorWindowBase { @@ -27,6 +28,8 @@ public: bool getMotorsConnectionStatus(); + void connectMotor(bool isNotification); + public Q_SLOTS: void onConnectMotor(); diff --git a/JinspSpectralmeterControl/JinspSpectralmeterControl.vcxproj b/JinspSpectralmeterControl/JinspSpectralmeterControl.vcxproj index 6695cbd..9d1078d 100644 --- a/JinspSpectralmeterControl/JinspSpectralmeterControl.vcxproj +++ b/JinspSpectralmeterControl/JinspSpectralmeterControl.vcxproj @@ -37,7 +37,7 @@ 5.13.2_msvc2017_64 - core + core;serialport release @@ -58,6 +58,7 @@ D:\cpp_library\eigen-3.4-rc1;$(IncludePath) + D:\cpp_library\eigen-3.4-rc1;$(IncludePath)