From 492b5a9a02d7e1280d95c866312c1dcb77dbf6d8 Mon Sep 17 00:00:00 2001 From: xin Date: Fri, 3 Apr 2026 11:09:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=20=E5=A2=9E=E5=8A=A0gpio?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deb_pack.sh | 2 +- source/CaptureThread/MainDataGrabber.cpp | 7 ++++++- source/FS/ZZ_Types.h | 2 ++ source/Settings/SystemConfigger.cpp | 23 ++++++++++++++++++++++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/deb_pack.sh b/deb_pack.sh index 003d732..059df8f 100755 --- a/deb_pack.sh +++ b/deb_pack.sh @@ -7,7 +7,7 @@ # exit 1 #fi -VERSION=2.2.2 +VERSION=2.2.5 sh install.sh thispwd=$(pwd) diff --git a/source/CaptureThread/MainDataGrabber.cpp b/source/CaptureThread/MainDataGrabber.cpp index 0280967..18fe4b9 100644 --- a/source/CaptureThread/MainDataGrabber.cpp +++ b/source/CaptureThread/MainDataGrabber.cpp @@ -141,11 +141,16 @@ int CMainDataGrabber::InitLS() } else { - DSSOne.strChannelA = qstrChannel.toStdString()[0]; + DSSOne.strChannelA =qstrChannel.toStdString()[0]; DSSOne.strChannelB = qstrChannel.toStdString()[1]; DSSOne.iChannelA = 1; DSSOne.iChannelB = 1; } + if (m_struLinearShutterContext.usGPIOChannelAPin!="null"&& m_struLinearShutterContext.usGPIOChannelBPin!="null") { + DSSOne.strChannelA = m_struLinearShutterContext.usGPIOChannelAPin; + DSSOne.strChannelB = m_struLinearShutterContext.usGPIOChannelBPin; + } + qDebug()<< "Debugging GPIO Init Finished. Channel A Pin:"<< QString::fromStdString(DSSOne.strChannelA) << " Channel B Pin:"<< QString::fromStdString(DSSOne.strChannelB); m_vecDSS.push_back(DSSOne); diff --git a/source/FS/ZZ_Types.h b/source/FS/ZZ_Types.h index 7ea2e98..3957a00 100644 --- a/source/FS/ZZ_Types.h +++ b/source/FS/ZZ_Types.h @@ -215,6 +215,8 @@ namespace ZZ_MISCDEF std::string strInterface; ZZ_U8 ucProtocolType; ZZ_U16 usCmdID; + std::string usGPIOChannelAPin; + std::string usGPIOChannelBPin; }LSContext; typedef struct tagAcquisitionTimeSettings diff --git a/source/Settings/SystemConfigger.cpp b/source/Settings/SystemConfigger.cpp index 2926f09..392d13c 100644 --- a/source/Settings/SystemConfigger.cpp +++ b/source/Settings/SystemConfigger.cpp @@ -27,7 +27,12 @@ //////////////////////////////////////////////////////////////////////////load device settings using namespace ZZ_MISCDEF; QMetaEnum enumDeviceModel = QMetaEnum::fromType(); - + // 先检查物理文件是否存在 + QFile configFile(m_qstrDeviceConfigFilePath); + if (!configFile.exists()) { + qDebug()<< "Device config file does not exist.Please check File in path:" << m_qstrDeviceConfigFilePath; + exit(EXIT_FAILURE); + } if (m_qsDeviceConfig!=NULL) { delete m_qsDeviceConfig; @@ -77,10 +82,26 @@ m_struAcqPosition.iPosition[i] = iPosition; } + //判断 LINEAR SHUTTER 部分的配置项是否存在 m_struLSContext.usCmdID = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/DCID")).toInt(); m_struLSContext.ucProtocolType = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/Type")).toInt(); m_struLSContext.strInterface = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/Port")).toString().toStdString(); + m_struLSContext.usGPIOChannelAPin="null"; + m_struLSContext.usGPIOChannelBPin="null"; + if (m_qsDeviceConfig->value(QString("LINEAR SHUTTER/GPIO_ChannelA")).toString().toStdString()!=""&& m_qsDeviceConfig->value(QString("LINEAR SHUTTER/GPIO_ChannelB")).toString().toStdString()!="") { + + m_struLSContext.usGPIOChannelAPin = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/GPIO_ChannelA")).toString().toStdString(); + m_struLSContext.usGPIOChannelBPin = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/GPIO_ChannelB")).toString().toStdString(); + }else { + m_qsDeviceConfig->setValue("LINEAR SHUTTER/GPIO_ChannelA",QString(QString::number(m_struLSContext.usCmdID).toStdString()[0]) ); + m_qsDeviceConfig->setValue("LINEAR SHUTTER/GPIO_ChannelB",QString(QString::number(m_struLSContext.usCmdID).toStdString()[1]) ); + //保存更改 + m_qsDeviceConfig->sync(); + + } + + //////////////////////////////////////////////////////////////////////////humiture m_struHumitureDeviceInfo.qstrInterfaceName = m_qsDeviceConfig->value(QString("HUMITURE/Port")).toString();