fix,自动调焦:

1、优化界面对2版自动调焦的兼容,优化界面排版;
2、修复没有关闭自动调焦时,关闭调焦窗口软件崩溃的问题;

add,山地所贡嘎山6:
优化
This commit is contained in:
tangchao0503
2026-07-17 10:34:16 +08:00
parent 245fc7f4ef
commit 3feefe45c1
13 changed files with 560 additions and 390 deletions

View File

@ -10,6 +10,7 @@ const QString AppSettings::kDefaultSLRDataFolder = QString();
const QString AppSettings::kDefaultDepthCameraDataFolder = QString();
const double AppSettings::kDefaultScanSpeed = 1.0;
const double AppSettings::kDefaultReturnSpeed = 5.0;
const int AppSettings::kDefaultGonggaShanRecordPort = 666;
AppSettings::AppSettings()
: m_settings(QSettings::IniFormat, QSettings::UserScope,
@ -137,3 +138,13 @@ void AppSettings::setReturnSpeed(double value)
{
m_settings.setValue("OneMotorControl/ReturnSpeed", value);
}
int AppSettings::gonggaShanRecordPort() const
{
return m_settings.value("GonggaShanRecordCtl/Port", kDefaultGonggaShanRecordPort).toInt();
}
void AppSettings::setGonggaShanRecordPort(int value)
{
m_settings.setValue("GonggaShanRecordCtl/Port", value);
}

View File

@ -45,6 +45,10 @@ public:
// 返回速度
double returnSpeed() const;
void setReturnSpeed(double value);
// 贡嘎山记录端口
int gonggaShanRecordPort() const;
void setGonggaShanRecordPort(int value);
// 在此处添加更多参数的 getter/setter ...
private:
@ -64,4 +68,5 @@ private:
static const QString kDefaultDepthCameraDataFolder;
static const double kDefaultScanSpeed;
static const double kDefaultReturnSpeed;
static const int kDefaultGonggaShanRecordPort;
};

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>557</width>
<height>432</height>
<width>650</width>
<height>530</height>
</rect>
</property>
<property name="windowTitle">
@ -154,7 +154,7 @@ QSlider::handle:horizontal:pressed {
border: 1px solid #2f6bff;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<layout class="QGridLayout" name="gridLayout_10">
<property name="leftMargin">
<number>0</number>
</property>
@ -168,7 +168,7 @@ QSlider::handle:horizontal:pressed {
<number>0</number>
</property>
<property name="spacing">
<number>10</number>
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="titlebarWidget" native="true">
@ -242,23 +242,11 @@ QSlider::handle:horizontal:pressed {
</item>
<item row="1" column="0">
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,3">
<property name="spacing">
<number>10</number>
<number>9</number>
</property>
<item row="0" column="0" rowspan="2">
<item row="0" column="0">
<widget class="QWidget" name="connectFocusModule_widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #connectFocusModule_widget
@ -274,85 +262,120 @@ QRadioButton
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>9</number>
<number>0</number>
</property>
<property name="topMargin">
<number>9</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>9</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>9</number>
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>连接调焦模块</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>线性平台</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="motorPort_comboBox"/>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="ultrasound_radioButton">
<property name="text">
<string>超声</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="ultrasoundPort_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="is_new_version_radioButton">
<property name="text">
<string>新版</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>107</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="connectMotor_btn">
<property name="text">
<string>连接线性平台</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="connectMotor_btn">
<property name="text">
<string>连接线性平台</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>107</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<widget class="QStackedWidget" name="stackedWidget_connetcParm">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_12">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_13">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>线性平台</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="motorPort_comboBox"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="ultrasound_radioButton">
<property name="text">
<string>超声</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ultrasoundPort_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="is_new_version_radioButton">
<property name="text">
<string>新版</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
@ -368,151 +391,147 @@ QRadioButton
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QPushButton" name="moveto_btn">
<property name="text">
<string>移动至</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="logicZero_btn">
<property name="text">
<string>LogicZero</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="move2_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="add_btn">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="updateCurrentLocation_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>34</height>
</size>
</property>
<property name="text">
<string>更新实时位置</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="addStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="rangeMeasurement_btn">
<property name="text">
<string>量程测量</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="currentLocation_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>null</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="subtract_btn">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="max_btn">
<property name="text">
<string>max</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<item row="0" column="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>调整线性平台</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QPushButton" name="updateCurrentLocation_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>34</height>
</size>
</property>
<property name="text">
<string>更新实时位置</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="subtract_btn">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="add_btn">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="logicZero_btn">
<property name="text">
<string>LogicZero</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="move2_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="moveto_btn">
<property name="text">
<string>移动至</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="currentLocation_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>null</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="max_btn">
<property name="text">
<string>max</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="rangeMeasurement_btn">
<property name="text">
<string>量程测量</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="addStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="0" colspan="2">
<widget class="QWidget" name="controlFocus_widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #controlFocus_widget
@ -521,53 +540,53 @@ QRadioButton
border-radius: 5px 5px 5px 5px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="1,2">
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>自动调焦</string>
</property>
<property name="text">
<string>调焦</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>采样率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="sample_ratio_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
<property name="styleSheet">
<string notr="true">QProgressBar {
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>采样数</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="sample_ratio_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="autoFocus_btn">
<property name="text">
<string>自动调焦</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
<property name="styleSheet">
<string notr="true">QProgressBar {
border: 2px solid #08FACE; /* 边框颜色和宽度 */
border-radius: 8px; /* 圆角 */
background-color: #eee; /* 未完成部分颜色 */
@ -579,37 +598,29 @@ QRadioButton
background-color: #08FACE; /* 渐变色进度块 */
border-radius: 8px; /* 保持和整体圆角一致 */
}</string>
</property>
<property name="value">
<number>24</number>
</property>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="autoFocus_btn">
<property name="text">
<string>自动调焦</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="manualFocus_btn">
<property name="text">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>手动调焦</string>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QPushButton" name="manualFocus_btn">
<property name="text">
<string>手动调焦</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>

View File

@ -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::startExposureSignal, this, &FodisWindow::startExposureSignal);
connect(m_JinspFiberImagerOperation, &JinspFiberImager::exposureCompleteSignal, this, &FodisWindow::exposureCompleteSignal);
m_JinspFiberImagerOperation->moveToThread(m_FiberImagerThread);
m_FiberImagerThread->start();

View File

@ -44,7 +44,8 @@ signals:
void spectalCaptured(DeviceAttribute attribute, DataFrame dataFrame);
void exposureCompleteSignal();
void startExposureSignal();
void exposureCompleteSignal(int exposureTime);
private:
Ui::FodisWindow ui;

View File

@ -1,24 +1,82 @@
#include "GonggaShanRecordCtl.h"
#include "GonggaShanRecordCtl.h"
GonggashanTaskScheduler::GonggashanTaskScheduler(QObject* parent)
: QObject(parent)
, m_taskState(TaskState::Idle)
{
}
GonggashanTaskScheduler::~GonggashanTaskScheduler()
{
}
bool GonggashanTaskScheduler::isTaskRunning() const
{
return m_taskState == TaskState::Running;
}
void GonggashanTaskScheduler::setTaskRunning(bool running)
{
m_taskState = running ? TaskState::Running : TaskState::Idle;
Q_EMIT taskStateChanged(m_taskState);
}
void GonggaShanRecordCtl::logStatus(const QString& message)
{
QString timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
ui.status_textEdit->append(QString("[%1] %2").arg(timestamp, message));
if (m_logStream.device()) {
m_logStream << "[" << timestamp << "] " << message << "\n";
m_logStream.flush();
m_logFile.flush();
}
}
GonggaShanRecordCtl::GonggaShanRecordCtl(QWidget* parent)
: QDialog(parent)
, m_taskScheduler(new GonggashanTaskScheduler(this))
{
ui.setupUi(this);
AppSettings& settings = AppSettings::instance();
ui.spinbox_Port->setValue(settings.gonggaShanRecordPort());
connect(ui.btnListen, &QPushButton::clicked, this, &GonggaShanRecordCtl::startListen);
connect(ui.btnDisListen, &QPushButton::clicked, this, &GonggaShanRecordCtl::stopListen);
connect(ui.spinbox_Port, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
AppSettings::instance().setGonggaShanRecordPort(value);
});
}
GonggaShanRecordCtl::~GonggaShanRecordCtl()
{
if (m_logFile.isOpen()) {
m_logStream.flush();
m_logFile.close();
}
tcpServer6005->deleteLater();
}
void GonggaShanRecordCtl::startListen()
{
if (m_logFile.isOpen()) {
m_logStream.flush();
m_logFile.close();
}
QString timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss");
QString logFileName = QString("log%1.txt").arg(timestamp);
m_logFilePath = AppSettings::instance().dataFolder() + QDir::separator() + logFileName;
m_logFile.setFileName(m_logFilePath);
m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
m_logStream.setDevice(&m_logFile);
logStatus("Start listen....");
MotorParams::TCPConnectionParams tcpConnectionParams6005;
tcpConnectionParams6005.port = ui.spinbox_Port->text().toInt();
tcpConnectionParams6005.serverIP = "192.168.1.2";
tcpConnectionParams6005.serverIP = "192.168.1.2";//此ip地址没有使用可以随便填入
tcpServer6005 = new MotorParams::CommunicationViaTCP(tcpConnectionParams6005, this);
connect(tcpServer6005, &MotorParams::CommunicationViaTCP::positionReceived, this, &GonggaShanRecordCtl::startRecord);
@ -26,15 +84,43 @@ void GonggaShanRecordCtl::startListen()
void GonggaShanRecordCtl::stopListen()
{
logStatus("Stop listen");
disconnect(tcpServer6005, &MotorParams::CommunicationViaTCP::positionReceived, this, &GonggaShanRecordCtl::startRecord);
tcpServer6005->deleteLater();
}
void GonggaShanRecordCtl::startRecord(int position)
{
//<2F><>¼λ<C2BC><CEBB>
if (m_taskScheduler->isTaskRunning())
{
logStatus("Data collection has begun....");
//<2F><><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>
return;
}
logStatus("Reach pos: " + QString::number(position));
m_taskScheduler->setTaskRunning(true);
emit startRcordSignal();
}
void GonggaShanRecordCtl::onFiberImagerStartExposureSignal()
{
logStatus("FiberImager: start exposure...");
}
void GonggaShanRecordCtl::onFiberImagerExposureCompleteSignal(int exposureTime)
{
logStatus(QString("FiberImager: exposure finished, %1").arg(exposureTime));
logStatus("Start recording...");
}
void GonggaShanRecordCtl::onRcordFinished()
{
m_taskScheduler->setTaskRunning(false);
logStatus("Record Finished.");
}

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
@ -6,9 +6,39 @@
#include <vector>
#include <QPointer>
#include <QDateTime>
#include <QFile>
#include <QTextStream>
#include <QDir>
#include "ui_gonggashanCtl.h"
#include "CommunicationViaTCP.h"
#include "AppSettings.h"
class GonggashanTaskScheduler : public QObject
{
Q_OBJECT
public:
enum class TaskState
{
Idle,
Running
};
explicit GonggashanTaskScheduler(QObject* parent = nullptr);
~GonggashanTaskScheduler();
bool isTaskRunning() const;
void setTaskRunning(bool running);
Q_SIGNALS:
void taskStateChanged(TaskState state);
private:
TaskState m_taskState;
};
class GonggaShanRecordCtl : public QDialog
{
@ -20,6 +50,9 @@ public:
public Q_SLOTS:
void onFiberImagerStartExposureSignal();
void onRcordFinished();
void onFiberImagerExposureCompleteSignal(int exposureTime);
Q_SIGNALS:
// Emitted when user changes any of the R/G/B wavelength values
@ -32,6 +65,12 @@ private Q_SLOTS:
void startRecord(int position);
private:
void logStatus(const QString& message);
Ui::gongga_control ui;
QPointer<MotorParams::CommunicationViaTCP> tcpServer6005;
GonggashanTaskScheduler* m_taskScheduler;
QString m_logFilePath;
QFile m_logFile;
QTextStream m_logStream;
};

View File

@ -1079,8 +1079,13 @@ void HPPA::initControlTabwidget()
void HPPA::setupGonggashanAutoRecordConnection()
{
connect(m_gonggaShanRecordCtl, &GonggaShanRecordCtl::startRcordSignal, this, &HPPA::onGonggashanRecord);
connect(m_fodisWindow, &FodisWindow::startExposureSignal, m_gonggaShanRecordCtl, &GonggaShanRecordCtl::onFiberImagerStartExposureSignal);
connect(m_fodisWindow, &FodisWindow::exposureCompleteSignal, this, &HPPA::onStartRecordStep1);
connect(m_fodisWindow, &FodisWindow::exposureCompleteSignal, m_gonggaShanRecordCtl, &GonggaShanRecordCtl::onFiberImagerExposureCompleteSignal);
connect(m_omc, &OneMotorControl::sequenceComplete, m_fodisWindow, &FodisWindow::closeFiberImager);
connect(m_omc, &OneMotorControl::sequenceComplete, m_gonggaShanRecordCtl, &GonggaShanRecordCtl::onRcordFinished);
}
void HPPA::onGonggashanRecord()
@ -2010,6 +2015,10 @@ void HPPA::onTabWidgetCurrentChanged(int index)//代码新建一个tab会调
//获取绘图控件
QWidget* currentWidget = m_imageViewerTabWidget->widget(index);
QList<Mapcavas*> currentImageViewer = currentWidget->findChildren<Mapcavas*>();
if (currentImageViewer.size() == 0)
{
return;
}
// Re-apply the current active map tool to the new canvas
Mapcavas* canvas = currentImageViewer[0];
@ -2784,6 +2793,10 @@ void HPPA::onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QSt
//QWidget* currentWidget = m_imageViewerTabWidget->widget(fileNumber);
QList<Mapcavas*> currentImageViewer = currentWidget->findChildren<Mapcavas*>();
if (currentImageViewer.size() == 0)
{
return;
}
currentImageViewer[0]->DisplayFrameNumber(m_Imager->getFrameCounter());//界面中显示已经采集的帧数
cv::Mat rgbImage(*m_Imager->getMatRgbImage(), cv::Range(0, m_Imager->getFrameCounter()), cv::Range::all());
@ -2843,6 +2856,10 @@ void HPPA::onStretchedImageReady(int fileNumber, const QString& filePath, QPixma
QWidget* currentWidget = m_MapLayerStore->widgetForLayer(filePath);
if (!currentWidget) return;
QList<Mapcavas*> currentImageViewer = currentWidget->findChildren<Mapcavas*>();
if (currentImageViewer.size() == 0)
{
return;
}
if (currentImageViewer.isEmpty()) return;
// 在界面中显示拉伸后的图像
currentImageViewer[0]->SetImage(&pixmap);
@ -2864,6 +2881,10 @@ void HPPA::focusPlotSpectralImg(int state)
//显示影像
QWidget* currentWidget = m_imageViewerTabWidget->currentWidget();
QList<Mapcavas*> currentImageViewer = currentWidget->findChildren<Mapcavas*>();
if (currentImageViewer.size() == 0)
{
return;
}
currentImageViewer[0]->DisplayFrameNumber(m_Imager->getFocusFrameCounter());//界面中显示已经采集的帧数
ImageProcessor imageProcessor;
@ -3047,6 +3068,10 @@ void HPPA::newImage(RasterLayer* ml, RasterImageLayer::RendererType type, LayerT
QWidget* mapcavasContainer = onCreateTab(ml->name());
RasterImageLayer* rasterImageLayer = new RasterImageLayer(ml, type);
QList<Mapcavas*> mapcavas = mapcavasContainer->findChildren<Mapcavas*>();
if (mapcavas.size() == 0)
{
return;
}
mapcavas[0]->setImageLayer(rasterImageLayer);
QString title = ml->name();

View File

@ -291,6 +291,8 @@ void JinspFiberImager::autoExpose()
std::cout << "自动曝光达到最大迭代次数,最终曝光时间:"
<< exposureTime << "ms, 最大值:" << maxValue << std::endl;
}
m_iExposureTime = exposureTime;
}
ZZ_S32 JinspFiberImager::GetMaxValue(ZZ_S32 * dark, int number)
@ -326,8 +328,9 @@ void JinspFiberImager::OpenFiberImagerAndRecord()
connectFiberSpectrometer(SN, pixelCount, wavelengthInfo);
//曝光
emit startExposureSignal();
autoExpose();
emit exposureCompleteSignal();
emit exposureCompleteSignal(m_iExposureTime);
//采集
m_record = true;

View File

@ -53,6 +53,8 @@ private:
bool m_record;
int m_captureIntervalMilliseconds;
int m_iExposureTime;
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
public slots:
@ -66,5 +68,6 @@ signals:
void sendExposureTimeSignal(int exposureTime);
void spectalCaptured(DeviceAttribute attribute, DataFrame dataFrame);
void exposureCompleteSignal();
void exposureCompleteSignal(int exposureTime);
void startExposureSignal();
};

View File

@ -288,7 +288,7 @@ QPushButton:pressed
}</string>
</property>
<property name="text">
<string>版本3.1.0</string>
<string>版本3.1.1</string>
</property>
</widget>
</item>

View File

@ -53,6 +53,10 @@ focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
connect(this->ui.closeBtn, SIGNAL(released()), this, SLOT(onExit()));
connect(this->ui.is_new_version_radioButton, &QRadioButton::toggled, this, [this](bool checked) {
ui.stackedWidget_connetcParm->setCurrentIndex(checked ? 0 : 1);
});
//查找可用串口,并显示
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
{
@ -72,7 +76,6 @@ focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
ui.autoFocusProgress_progressBar->reset();
m_dSpeed = 1.0;
}
focusWindow::~focusWindow()

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>229</height>
<width>572</width>
<height>384</height>
</rect>
</property>
<property name="windowTitle">
@ -24,6 +24,22 @@
color: #ACCDFF;
}
QSpinBox
{
font: 10pt &quot;新宋体&quot;;
background-color: #142D7F;
color: white;
border: none;
}
QTextEdit
{
font: 10pt &quot;新宋体&quot;;
background-color: #142D7F;
color: white;
border: none;
}
QPushButton
{
/*width: 172px;
@ -117,7 +133,7 @@ QSlider::handle:horizontal:pressed {
background: #1f4fff;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,3">
<item>
<widget class="QGroupBox" name="groupAdjustments">
<property name="styleSheet">
@ -135,46 +151,30 @@ QSlider::handle:horizontal:pressed {
<property name="horizontalSpacing">
<number>16</number>
</property>
<item row="1" column="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="3">
<widget class="QSpinBox" name="spinbox_Port">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="maximum">
<number>65535</number>
</property>
</spacer>
<property name="value">
<number>666</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelPort">
<property name="text">
<string>端口</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -187,48 +187,18 @@ QSlider::handle:horizontal:pressed {
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="lineEdit_IP">
<property name="text">
<string>192.168.1.2</string>
<item row="0" column="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelIP">
<property name="text">
<string>ip</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelPort">
<property name="text">
<string>端口</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="spinbox_Port">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>666</number>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>
@ -280,6 +250,18 @@ QSlider::handle:horizontal:pressed {
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>系统状态</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTextEdit" name="status_textEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>