程序重命名及版本更新

- 程序名从 TowerOptoSifAndSpectral 更名为 AirOptoSifAndSpectral
- 版本从 2.1.5 更新至 2.1.9
- GPIO 控制逻辑修改:引脚 1 和 12 输出改为 0
- 新增 dpkg preinst 脚本处理冲突文件
This commit is contained in:
xin
2026-04-07 10:28:53 +08:00
parent e8db9aa9fe
commit 84787f1006
13 changed files with 559 additions and 597 deletions

View File

@ -7,7 +7,7 @@
# exit 1 # exit 1
#fi #fi
VERSION=2.1.5 VERSION=2.1.9
sh install.sh sh install.sh
thispwd=$(pwd) thispwd=$(pwd)
@ -36,6 +36,7 @@ echo "Version:${VERSION}" >> ./control
echo "echo \"V${VERSION}\" > /home/data/version" >> ./postinst echo "echo \"V${VERSION}\" > /home/data/version" >> ./postinst
chmod +x ./post* chmod +x ./post*
chmod +x ./control chmod +x ./control
chmod +x ./preinst
cd ../ cd ../
#复制root文件 #复制root文件
mkdir -p ./root mkdir -p ./root

7
dpkg/preinst Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
# 删除可能引起冲突的文件
if [ -f /home/data/ChangeLog.md ]; then
echo "Removing conflicting ChangeLog.md file..."
rm -f /home/data/ChangeLog.md
fi

View File

@ -13,9 +13,10 @@ set_time_limit(0);
ob_end_clean();//清空(擦除)缓冲区并关闭输出缓冲 ob_end_clean();//清空(擦除)缓冲区并关闭输出缓冲
ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对 flush() 的显式调用 ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对 flush() 的显式调用
system("sudo gpio mode 1 out"); system("sudo gpio mode 1 out");
system("sudo gpio write 1 1"); system("sudo gpio write 1 0");system("sudo gpio write 12 0");
system("sudo killall Mywathdog.sh"); system("sudo killall Mywathdog.sh");
system("sudo killall TowerOptoSifAndSpectral"); system("sudo killall AirOptoSifAndSpectral");
system("sudo pkill shutter_calibrate"); system("sudo pkill shutter_calibrate");

View File

@ -34,9 +34,10 @@ $numberofFS=0;
system("sudo killall Mywathdog.sh"); system("sudo killall Mywathdog.sh");
system("sudo killall TowerOptoSifAndSpectral"); system("sudo killall ");
system("sudo pkill ocean_optics_calibration_console"); system("sudo pkill ocean_optics_calibration_console");
system("sudo gpio write 1 1"); system("sudo gpio write 1 0");
system("sudo gpio write 12 0");
$cmd=""; $cmd="";

View File

@ -14,7 +14,7 @@ ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐
//$cmd = 'ping 127.0.0.1'; //$cmd = 'ping 127.0.0.1';
//sy"" //sy""
system("sudo killall Mywathdog.sh"); system("sudo killall Mywathdog.sh");
system("sudo killall TowerOptoSifAndSpectral"); system("sudo killall AirOptoSifAndSpectral");
system("sudo pkill movingliner"); system("sudo pkill movingliner");
Echo $a; Echo $a;
$cmd = 'sudo /home/pi/bin/movingliner '.$a; $cmd = 'sudo /home/pi/bin/movingliner '.$a;

View File

@ -2,5 +2,6 @@ mkdir -p build
cd build cd build
cmake ../ cmake ../
make -j4 make -j4
cp AirOptoSifAndSpectral /home/pi/bin
cd ../othersoft cd ../othersoft
sh install.sh sh install.sh

View File

@ -60,12 +60,20 @@ int main(int argc, char *argv[])
iRet0 = system("gpio mode 1 out"); iRet0 = system("gpio mode 1 out");
iRet1 = system("gpio mode 4 out"); iRet1 = system("gpio mode 4 out");
iRet2 = system("gpio mode 5 out"); iRet2 = system("gpio mode 5 out");
iRet1 = system("gpio mode 20 out");
qDebug()<< "set gpio 20 out"<< endl;
iRet2 = system("gpio mode 21 out");
qDebug()<< "set gpio 21 out"<< endl;
iRet1 = system("gpio mode 22 out");
qDebug()<< "set gpio 22 out"<< endl;
iRet2 = system("gpio mode 23 out");
qDebug()<< "set gpio 23 out"<< endl;
system("gpio mode 13 input"); system("gpio mode 13 input");
system("gpio write 13 0"); system("gpio write 13 0");
iRet3 = system("gpio write 1 1");//上电 iRet3 = system("gpio write 1 0");//上电
iRet3 = system("gpio write 12 0");//上电
qDebug() << "gpio 1;4;5; ready"<<" Ret:"<< iRet0<< iRet1<< iRet2<< endl; qDebug() << "gpio 1;4;5; ready"<<" Ret:"<< iRet0<< iRet1<< iRet2<< endl;
qDebug() << "gpio write 1 1......" <<" Ret:"<< iRet3<< endl; qDebug() << "gpio write 1 0......" <<" Ret:"<< iRet3<< endl;
// QString qstrCMD_A, qstrCMD_B, qstrCMD_Temp; // QString qstrCMD_A, qstrCMD_B, qstrCMD_Temp;
// qstrCMD_Temp = QString::fromStdString("4"); // qstrCMD_Temp = QString::fromStdString("4");

View File

@ -12,6 +12,7 @@ DataLogger::DataLogger(const QString &filePath, QObject *parent)
bool DataLogger::openFile() bool DataLogger::openFile()
{ {
if (m_file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { if (m_file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
m_stream.setRealNumberPrecision(8);
qDebug() << "Data log file opened: " << m_filePath; qDebug() << "Data log file opened: " << m_filePath;
return true; return true;
} else { } else {

View File

@ -1,14 +1,14 @@
#include "AbstractFSController.h" #include "AbstractFSController.h"
#include "ZZ_Math_HDRONLY.h" #include "ZZ_Math_HDRONLY.h"
#include <math.h> #include <math.h>
void Delay_MSec(ZZ_U16 usMS)
{ void Delay_MSec(ZZ_U16 usMS) {
QEventLoop qeLoop; QEventLoop qeLoop;
QTimer::singleShot(usMS, &qeLoop, SLOT(quit())); QTimer::singleShot(usMS, &qeLoop, SLOT(quit()));
qeLoop.exec(); qeLoop.exec();
} }
CAbstractFSController::CAbstractFSController(QObject* parent /*= nullptr*/)
{ CAbstractFSController::CAbstractFSController(QObject *parent /*= nullptr*/) {
iFlagInit = 0; iFlagInit = 0;
m_pFSCtrl = NULL; m_pFSCtrl = NULL;
m_iThreadID = -1; m_iThreadID = -1;
@ -19,24 +19,20 @@ CAbstractFSController::CAbstractFSController(QObject* parent /*= nullptr*/)
m_qstrCalFilePath = "/home/data/Cal"; m_qstrCalFilePath = "/home/data/Cal";
m_vecNonLinearCalP.clear(); m_vecNonLinearCalP.clear();
for (int i=0;i<10;i++) { for (int i = 0; i < 10; i++) {
m_taginfolast.ITtimeChange[i] =true; m_taginfolast.ITtimeChange[i] = true;
m_taginfolast.LastMAXValue[i] = 0; m_taginfolast.LastMAXValue[i] = 0;
m_taginfolast.lastITTIME[i] = 0; m_taginfolast.lastITTIME[i] = 0;
} }
} }
CAbstractFSController::~CAbstractFSController() CAbstractFSController::~CAbstractFSController() {
{ if (m_pFSCtrl != 0) {
if (m_pFSCtrl!= 0 )
{
delete m_pFSCtrl; delete m_pFSCtrl;
} }
} }
int CAbstractFSController::SetRunParas(int iThreadID, FSInfo fsInfo) int CAbstractFSController::SetRunParas(int iThreadID, FSInfo fsInfo) {
{
connect(this, &CAbstractFSController::SignalInit_Self, this, &CAbstractFSController::InitializeFSControl); connect(this, &CAbstractFSController::SignalInit_Self, this, &CAbstractFSController::InitializeFSControl);
m_iThreadID = iThreadID; m_iThreadID = iThreadID;
m_fsInfo = fsInfo; m_fsInfo = fsInfo;
@ -44,44 +40,36 @@ int CAbstractFSController::SetRunParas(int iThreadID, FSInfo fsInfo)
} }
int CAbstractFSController::InitializeFSControl() {
int CAbstractFSController::InitializeFSControl()
{
using namespace ZZ_MISCDEF::IRIS; using namespace ZZ_MISCDEF::IRIS;
int iRes = 0; int iRes = 0;
if (m_iThreadID == -1/*|| m_iDeviceType == -1*/) if (m_iThreadID == -1/*|| m_iDeviceType == -1*/) {
{
qDebug() << "Params Err. Call SetRunParas first"; qDebug() << "Params Err. Call SetRunParas first";
return 1; return 1;
} }
switch (m_fsInfo.ucDeviceModel) switch (m_fsInfo.ucDeviceModel) {
{
case DeviceModel::OSIFAlpha: case DeviceModel::OSIFAlpha:
m_pFSCtrl = new OceanOptics_lib; m_pFSCtrl = new OceanOptics_lib;
if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) {
{
qDebug() << "OSIFAlpha Not Opened"; qDebug() << "OSIFAlpha Not Opened";
return 2; return 2;
} }
iRes = LoadQEProLinearCalibrationFile(); iRes = LoadQEProLinearCalibrationFile();
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "LoadQEProLinearCalibrationFile Failed" << iRes; qDebug() << "LoadQEProLinearCalibrationFile Failed" << iRes;
//return 5; //return 5;
} }
break; break;
case DeviceModel::OSIFBeta: case DeviceModel::OSIFBeta:
m_pFSCtrl = new OceanOptics_lib; m_pFSCtrl = new OceanOptics_lib;
if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) !=0) if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) {
{
qDebug() << "OSIFBeta Not Opened"; qDebug() << "OSIFBeta Not Opened";
return 2; return 2;
} }
iRes = LoadQEProLinearCalibrationFile(); iRes = LoadQEProLinearCalibrationFile();
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "LoadQEProLinearCalibrationFile Failed" << iRes; qDebug() << "LoadQEProLinearCalibrationFile Failed" << iRes;
//return 5; //return 5;
} }
@ -89,8 +77,7 @@ int CAbstractFSController::InitializeFSControl()
case DeviceModel::ISIF: case DeviceModel::ISIF:
m_pFSCtrl = new ZZ_ATPControl_Serial_Qt; m_pFSCtrl = new ZZ_ATPControl_Serial_Qt;
//m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, NULL); //m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, NULL);
if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) {
{
qDebug() << "ISIF Not Opened"; qDebug() << "ISIF Not Opened";
return 3; return 3;
} }
@ -98,8 +85,7 @@ int CAbstractFSController::InitializeFSControl()
case DeviceModel::IS1: case DeviceModel::IS1:
m_pFSCtrl = new ZZ_ATPControl_Serial_Qt; m_pFSCtrl = new ZZ_ATPControl_Serial_Qt;
//m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, NULL); //m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, NULL);
if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) {
{
qDebug() << "IS1 Not Opened"; qDebug() << "IS1 Not Opened";
return 3; return 3;
} }
@ -107,8 +93,7 @@ int CAbstractFSController::InitializeFSControl()
case DeviceModel::IS2: case DeviceModel::IS2:
m_pFSCtrl = new ZZ_ATPControl_Serial_Qt; m_pFSCtrl = new ZZ_ATPControl_Serial_Qt;
//m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, NULL); //m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, NULL);
if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) if (m_pFSCtrl->Initialize(false, m_fsInfo.strInterface, m_fsInfo.strSN) != 0) {
{
qDebug() << "IS2 Not Opened"; qDebug() << "IS2 Not Opened";
return 3; return 3;
} }
@ -118,15 +103,13 @@ int CAbstractFSController::InitializeFSControl()
} }
iRes = m_pFSCtrl->GetDeviceAttribute(m_daDeviceAttr); iRes = m_pFSCtrl->GetDeviceAttribute(m_daDeviceAttr);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "GetDeviceAttribute Failed" << iRes; qDebug() << "GetDeviceAttribute Failed" << iRes;
return 4; return 4;
} }
iRes = m_pFSCtrl->SetDeviceTemperature(0); iRes = m_pFSCtrl->SetDeviceTemperature(0);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "SetDeviceTemperature Failed" << iRes; qDebug() << "SetDeviceTemperature Failed" << iRes;
//return 5; //return 5;
} }
@ -134,36 +117,30 @@ int CAbstractFSController::InitializeFSControl()
return 0; return 0;
} }
int CAbstractFSController::InitializeFSControl_Self() int CAbstractFSController::InitializeFSControl_Self() {
{
//InitializeFSControl(); //InitializeFSControl();
emit SignalInit_Self(); emit SignalInit_Self();
return 0; return 0;
} }
int CAbstractFSController::GetDeviceAttr(DeviceAttribute &daAttr) int CAbstractFSController::GetDeviceAttr(DeviceAttribute &daAttr) {
{
daAttr = m_daDeviceAttr; daAttr = m_daDeviceAttr;
return 0; return 0;
} }
int CAbstractFSController::PerformAutoExposure(int position) int CAbstractFSController::PerformAutoExposure(int position) {
{ if (position != 0) {
if (position!=0) {
// m_taginfolast.ITtimeChange[position] = true; // m_taginfolast.ITtimeChange[position] = true;
m_taginfolast.lastITTIME[position] = m_taginfolast.lastITTIME[0]*0.5 ; m_taginfolast.lastITTIME[position] = m_taginfolast.lastITTIME[0] * 0.5;
m_pFSCtrl->SetExposureTime(m_taginfolast.lastITTIME[position] ); m_pFSCtrl->SetExposureTime(m_taginfolast.lastITTIME[position]);
return 0; return 0;
} }
qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID; qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID;
using namespace ZZ_MATH; using namespace ZZ_MATH;
float fPredictedExposureTime; float fPredictedExposureTime;
int iDeviceDepth = (int)m_fsInfo.lDepth; int iDeviceDepth = (int) m_fsInfo.lDepth;
qDebug() << "MAX---Min" << m_fsInfo.fMaxFactor << "---" << m_fsInfo.fMinFactor << " Thread ID:" << m_iThreadID; qDebug() << "MAX---Min" << m_fsInfo.fMaxFactor << "---" << m_fsInfo.fMinFactor << " Thread ID:" << m_iThreadID;
@ -183,18 +160,15 @@ int CAbstractFSController::PerformAutoExposure(int position)
//int iRes = m_pFSCtrl->SetExposureTime(1000);//need change to load from files //int iRes = m_pFSCtrl->SetExposureTime(1000);//need change to load from files
int iRes = 0; int iRes = 0;
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1" << " Thread ID:" << m_iThreadID; qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1" << " Thread ID:" << m_iThreadID;
return 1; return 1;
} }
while (!bFlagIsAutoExposureOK && !bFlagIsAutoExposureFailed) while (!bFlagIsAutoExposureOK && !bFlagIsAutoExposureFailed) {
{
DataFrame dfTemp; DataFrame dfTemp;
if (iRepeatCount++ > 30) if (iRepeatCount++ > 30) {
{
bFlagIsAutoExposureFailed = true; bFlagIsAutoExposureFailed = true;
bFlagIsOverTrying = true; bFlagIsOverTrying = true;
break; break;
@ -208,8 +182,7 @@ int CAbstractFSController::PerformAutoExposure(int position)
iRes = m_pFSCtrl->SingleShot(dfTemp); iRes = m_pFSCtrl->SingleShot(dfTemp);
//iRes = m_pFSCtrl->SingleShot(dfTemp); //iRes = m_pFSCtrl->SingleShot(dfTemp);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2" << " Thread ID:" << m_iThreadID; qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2" << " Thread ID:" << m_iThreadID;
return 2; return 2;
} }
@ -218,99 +191,75 @@ int CAbstractFSController::PerformAutoExposure(int position)
double dSum = 0; double dSum = 0;
int iCount = m_daDeviceAttr.iPixels / 200; int iCount = m_daDeviceAttr.iPixels / 200;
for (int i = 0; i < iCount; i++) for (int i = 0; i < iCount; i++) {
{
dSum += dfTemp.lData[i]; dSum += dfTemp.lData[i];
} }
double dTemp = dSum / iCount; double dTemp = dSum / iCount;
qDebug() << "Avg " << dTemp << " Thread ID:" << m_iThreadID; qDebug() << "Avg " << dTemp << " Thread ID:" << m_iThreadID;
if (dTemp >= iDeviceDepth * 0.99) if (dTemp >= iDeviceDepth * 0.99) {
{
bIsValueOverflow = true; bIsValueOverflow = true;
if (!bIsLastValueOverflow) if (!bIsLastValueOverflow) {
{ iExposureTime = (float) (fLastExposureTime + iExposureTime) / 2;
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2; } else {
}
else
{
iExposureTime = iExposureTime / 2; iExposureTime = iExposureTime / 2;
} }
} } else if (iDeviceDepth * m_fsInfo.fMaxFactor >= dTemp && dTemp >= iDeviceDepth * m_fsInfo.fMinFactor) {
else if (iDeviceDepth * m_fsInfo.fMaxFactor >= dTemp && dTemp >= iDeviceDepth * m_fsInfo.fMinFactor)
{
qDebug() << "trace bFlagIsAutoExposureOK =1 " << iExposureTime << " Thread ID:" << m_iThreadID; qDebug() << "trace bFlagIsAutoExposureOK =1 " << iExposureTime << " Thread ID:" << m_iThreadID;
bFlagIsAutoExposureOK = 1; bFlagIsAutoExposureOK = 1;
} } else if (dTemp > iDeviceDepth * m_fsInfo.fMaxFactor) {
else if (dTemp > iDeviceDepth * m_fsInfo.fMaxFactor)
{
bIsValueOverflow = true; bIsValueOverflow = true;
if (!bIsLastValueOverflow) if (!bIsLastValueOverflow) {
{ iExposureTime = (float) (fLastExposureTime + iExposureTime) / 2;
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2; } else {
}
else
{
iExposureTime = iExposureTime * 3 / 4; iExposureTime = iExposureTime * 3 / 4;
} }
} } else if (dTemp < iDeviceDepth * m_fsInfo.fMinFactor) {
else if (dTemp < iDeviceDepth * m_fsInfo.fMinFactor)
{
bIsValueOverflow = false; bIsValueOverflow = false;
if (bIsLastValueOverflow) if (bIsLastValueOverflow) {
{ iExposureTime = (float) (fLastExposureTime + iExposureTime) / 2;
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2; } else {
}
else
{
double dFactor; double dFactor;
dFactor = dTemp / (iDeviceDepth * m_fsInfo.fMaxFactor); dFactor = dTemp / (iDeviceDepth * m_fsInfo.fMaxFactor);
iExposureTime = (float)(iExposureTime / dFactor); iExposureTime = (float) (iExposureTime / dFactor);
} }
} }
bIsLastValueOverflow = bIsValueOverflow; bIsLastValueOverflow = bIsValueOverflow;
fLastExposureTime = fTempExposureTime; fLastExposureTime = fTempExposureTime;
if (/*fExposureTime > 100 || */iExposureTime <= m_daDeviceAttr.iMinIntegrationTimeInMS) {
if (/*fExposureTime > 100 || */iExposureTime <= m_daDeviceAttr.iMinIntegrationTimeInMS)
{
bFlagIsAutoExposureOK = false; bFlagIsAutoExposureOK = false;
bFlagIsAutoExposureFailed = true; bFlagIsAutoExposureFailed = true;
bFlagIsLowerMinExposureTime = true; bFlagIsLowerMinExposureTime = true;
// qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " << m_daDeviceAttr.iMinIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID; // qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " << m_daDeviceAttr.iMinIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID;
// iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime); // iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime);
// if (iRes != 0) // if (iRes != 0)
// { // {
// qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID; // qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID;
// return 3; // return 3;
// } // }
// else // else
// { // {
// qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID; // qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID;
// } // }
m_taginfolast.ITtimeChange[position] = true; m_taginfolast.ITtimeChange[position] = true;
m_taginfolast.lastITTIME[position] = m_daDeviceAttr.iMinIntegrationTimeInMS; m_taginfolast.lastITTIME[position] = m_daDeviceAttr.iMinIntegrationTimeInMS;
iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS); iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID; qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID;
return 3; return 3;
} } else {
else qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " <<
{ m_daDeviceAttr.iMinIntegrationTimeInMS << "MS" << " Thread ID:" << m_iThreadID;
qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " << m_daDeviceAttr.iMinIntegrationTimeInMS << "MS" << " Thread ID:" << m_iThreadID;
} }
break; break;
} }
if (iExposureTime > m_daDeviceAttr.iMaxIntegrationTimeInMS-1) if (iExposureTime > m_daDeviceAttr.iMaxIntegrationTimeInMS - 1) {
{
bFlagIsAutoExposureOK = false; bFlagIsAutoExposureOK = false;
bFlagIsAutoExposureFailed = true; bFlagIsAutoExposureFailed = true;
bFlagIsOverMaxExposureTime = true; bFlagIsOverMaxExposureTime = true;
@ -326,30 +275,25 @@ int CAbstractFSController::PerformAutoExposure(int position)
//qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to 30sec"; //qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to 30sec";
//} //}
m_taginfolast.ITtimeChange[position] = true; m_taginfolast.ITtimeChange[position] = true;
m_taginfolast.lastITTIME[position] =m_daDeviceAttr.iMaxIntegrationTimeInMS - 1; m_taginfolast.lastITTIME[position] = m_daDeviceAttr.iMaxIntegrationTimeInMS - 1;
iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMaxIntegrationTimeInMS - 1); iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMaxIntegrationTimeInMS - 1);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID; qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID;
return 3; return 3;
} } else {
else qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " <<
{ m_daDeviceAttr.iMaxIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID;
qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID;
} }
break; break;
} }
m_taginfolast.ITtimeChange[position] = true; m_taginfolast.ITtimeChange[position] = true;
m_taginfolast.lastITTIME[position] =(int)iExposureTime; m_taginfolast.lastITTIME[position] = (int) iExposureTime;
iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime); iRes = m_pFSCtrl->SetExposureTime((int) iExposureTime);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID; qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID;
return 3; return 3;
} } else {
else
{
qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID; qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID;
} }
} }
@ -362,64 +306,58 @@ int CAbstractFSController::PerformAutoExposure(int position)
} }
int CAbstractFSController::ComputExposure(int position) { int CAbstractFSController::ComputExposure(int position) {
if (position==0) { if (position == 0) {
int lastittime = m_taginfolast.lastITTIME[position];
int lastmaxvalue = m_taginfolast.LastMAXValue[position];
int maxallowvalue = m_fsInfo.lDepth * m_fsInfo.fMaxFactor;
int lastittime=m_taginfolast.lastITTIME[position]; int minallowvalue = m_fsInfo.lDepth * m_fsInfo.fMinFactor;
int lastmaxvalue=m_taginfolast.LastMAXValue[position]; if (lastmaxvalue > maxallowvalue) {
if (lastmaxvalue >= m_fsInfo.lDepth) {
int maxallowvalue=m_fsInfo.lDepth * m_fsInfo.fMaxFactor; lastittime = lastittime / 2;
int minallowvalue=m_fsInfo.lDepth * m_fsInfo.fMinFactor; } else {
if (lastmaxvalue>maxallowvalue) { lastittime = lastittime * (maxallowvalue * 1.0 / lastmaxvalue) * 0.95;
if (lastmaxvalue>=m_fsInfo.lDepth) {
lastittime=lastittime/2;
}else {
lastittime=lastittime*(maxallowvalue*1.0/lastmaxvalue)*0.95;
} }
m_taginfolast.ITtimeChange[position]=true; m_taginfolast.ITtimeChange[position] = true;
m_taginfolast.lastITTIME[position]=lastittime; m_taginfolast.lastITTIME[position] = lastittime;
m_pFSCtrl->SetExposureTime(lastittime); m_pFSCtrl->SetExposureTime(lastittime);
qDebug()<< "Set exposure time for position"<<position<<" to "<<lastittime; qDebug() << "Set exposure time for position" << position << " to " << lastittime;
return lastittime;
}
if (lastmaxvalue<minallowvalue) {
lastittime=lastittime*(minallowvalue*1.0/lastmaxvalue)*1.05;
if (lastittime>=60000) {
lastittime=60000;
}
m_taginfolast.ITtimeChange[position]=true;
m_taginfolast.lastITTIME[position]=lastittime;
m_pFSCtrl->SetExposureTime(lastittime);
qDebug()<< "Set exposure time for position"<<position<<" to "<<lastittime;
return lastittime; return lastittime;
} }
m_taginfolast.ITtimeChange[position]=false; if (lastmaxvalue < minallowvalue) {
lastittime = lastittime * (minallowvalue * 1.0 / lastmaxvalue) * 1.05;
if (lastittime >= 60000) {
lastittime = 60000;
}
m_taginfolast.ITtimeChange[position] = true;
m_taginfolast.lastITTIME[position] = lastittime;
m_pFSCtrl->SetExposureTime(lastittime); m_pFSCtrl->SetExposureTime(lastittime);
qDebug()<< "Set exposure time for position"<<position<<" to "<<lastittime; qDebug() << "Set exposure time for position" << position << " to " << lastittime;
return lastittime; return lastittime;
} }
int lasttimeindev=0; m_taginfolast.ITtimeChange[position] = false;
m_pFSCtrl->SetExposureTime(lastittime);
qDebug() << "Set exposure time for position" << position << " to " << lastittime;
return lastittime;
}
int lasttimeindev = 0;
m_pFSCtrl->GetExposureTime(lasttimeindev); m_pFSCtrl->GetExposureTime(lasttimeindev);
float scalofit = 1.5;
m_pFSCtrl->SetExposureTime(m_taginfolast.lastITTIME[0]*0.5); m_pFSCtrl->SetExposureTime(m_taginfolast.lastITTIME[0] * scalofit);
if (lasttimeindev!=m_taginfolast.lastITTIME[0]*0.5) { if (lasttimeindev != m_taginfolast.lastITTIME[0] * scalofit) {
Delay_MSec(lasttimeindev); Delay_MSec(lasttimeindev);
} }
qDebug()<< "Set exposure time for position"<<position<<" to "<<m_taginfolast.lastITTIME[0]*0.5; qDebug() << "Set exposure time for position" << position << " to " << m_taginfolast.lastITTIME[0] * scalofit;
return m_taginfolast.lastITTIME[0]*0.5; return m_taginfolast.lastITTIME[0] * scalofit;
} }
int CAbstractFSController::TakeDarkFrame(int position) int CAbstractFSController::TakeDarkFrame(int position) {
{
int shuttertime = 0; int shuttertime = 0;
m_pFSCtrl->GetExposureTime(shuttertime); m_pFSCtrl->GetExposureTime(shuttertime);
qDebug() << "Starting TakeDarkFrame" << " position ID:" << position<<" ITtime:"<<shuttertime<<"\n"; qDebug() << "Starting TakeDarkFrame" << " position ID:" << position << " ITtime:" << shuttertime << "\n";
if (m_taginfolast.ITtimeChange[0]) { if (m_taginfolast.ITtimeChange[0]) {
m_taginfolast.LastDarkframe[position]=TakeOneFrame(); m_taginfolast.LastDarkframe[position] = TakeOneFrame();
} }
@ -435,10 +373,10 @@ int CAbstractFSController::TakeDarkFrame(int position)
int CAbstractFSController::ComputeMaxValue(DataFrame Data) { int CAbstractFSController::ComputeMaxValue(DataFrame Data) {
ZZ_S32 *pData = Data.lData; ZZ_S32 *pData = Data.lData;
int number = 4096; int number = 4096;
int maxvalue=0; int maxvalue = 0;
for (int i=0;i<number-1;i++) { for (int i = 0; i < number - 1; i++) {
if (pData[i]>maxvalue) { if (pData[i] > maxvalue) {
maxvalue=pData[i]; maxvalue = pData[i];
} }
} }
return maxvalue; return maxvalue;
@ -467,8 +405,6 @@ int CAbstractFSController::ComputeMaxValue(DataFrame Data) {
// return sum / 10; // return sum / 10;
// int maxvalue[10]={0}; // int maxvalue[10]={0};
// ZZ_S32 *pData=Data.lData; // ZZ_S32 *pData=Data.lData;
// int number=4096; // int number=4096;
@ -486,62 +422,53 @@ int CAbstractFSController::ComputeMaxValue(DataFrame Data) {
// } // }
// } // }
// } // }
} }
int CAbstractFSController::TakeSignalFrame(int position)
{ int CAbstractFSController::TakeSignalFrame(int position) {
int shuttertime = 0; int shuttertime = 0;
m_pFSCtrl->GetExposureTime(shuttertime); m_pFSCtrl->GetExposureTime(shuttertime);
qDebug() << "Starting TakeSignal" << " position" << position<<" ITtime:"<<shuttertime<<"\n"; qDebug() << "Starting TakeSignal" << " position" << position << " ITtime:" << shuttertime << "\n";
m_vecDataFrameSignal.push_back(TakeOneFrame()); m_vecDataFrameSignal.push_back(TakeOneFrame());
// todo: compute max ten value 计算前10个值平均值 // todo: compute max ten value 计算前10个值平均值
m_taginfolast.LastMAXValue[position]=ComputeMaxValue(m_vecDataFrameSignal.at(m_vecDataFrameSignal.size()-1)); m_taginfolast.LastMAXValue[position] = ComputeMaxValue(m_vecDataFrameSignal.at(m_vecDataFrameSignal.size() - 1));
if (m_taginfolast.LastMAXValue[position]>=65535) { if (m_taginfolast.LastMAXValue[position] >= 65535) {
m_vecDataFrameSignal.at(m_vecDataFrameSignal.size()-1).bIsValid=false; m_vecDataFrameSignal.at(m_vecDataFrameSignal.size() - 1).bIsValid = false;
} }
qDebug() << "Stop TakeSignal" << " Thread ID:" << m_iThreadID; qDebug() << "Stop TakeSignal" << " Thread ID:" << m_iThreadID;
qDebug()<< "Max 10 Average Value:" << m_taginfolast.LastMAXValue[position] << " Thread ID:" << m_iThreadID; qDebug() << "Max 10 Average Value:" << m_taginfolast.LastMAXValue[position] << " Thread ID:" << m_iThreadID;
//emit SignalAcqFinished(m_iThreadID, 1); //emit SignalAcqFinished(m_iThreadID, 1);
return 0; return 0;
} }
DataFrame CAbstractFSController::TakeOneFrame() DataFrame CAbstractFSController::TakeOneFrame() {
{
using namespace ZZ_MISCDEF::IRIS; using namespace ZZ_MISCDEF::IRIS;
//int iExpTime = 0; //int iExpTime = 0;
DataFrame dfTemp; DataFrame dfTemp;
// m_pFSCtrl->GetExposureTime(iExpTime); // m_pFSCtrl->GetExposureTime(iExpTime);
// dfTemp.usExposureTimeInMS = iExpTime; // dfTemp.usExposureTimeInMS = iExpTime;
// m_pFSCtrl->GetDeviceTemperature(dfTemp.fTemperature); // m_pFSCtrl->GetDeviceTemperature(dfTemp.fTemperature);
if (m_fsInfo.ucDeviceModel== DeviceModel::ISIF) if (m_fsInfo.ucDeviceModel == DeviceModel::ISIF) {
{
float fTemp; float fTemp;
m_pFSCtrl->GetDeviceTemperature(fTemp); m_pFSCtrl->GetDeviceTemperature(fTemp);
dfTemp.fTemperature = fTemp; dfTemp.fTemperature = fTemp;
} } else if (m_fsInfo.ucDeviceModel == DeviceModel::IS1) {
else if(m_fsInfo.ucDeviceModel == DeviceModel::IS1)
{
dfTemp.fTemperature = 0; dfTemp.fTemperature = 0;
} }
int iRes = m_pFSCtrl->SingleShot(dfTemp); int iRes = m_pFSCtrl->SingleShot(dfTemp);
if (iRes != 0) if (iRes != 0) {
{
qDebug() << "Err. SingleShot" << " Thread ID:" << m_iThreadID; qDebug() << "Err. SingleShot" << " Thread ID:" << m_iThreadID;
} }
if (m_fsInfo.ucDeviceModel == DeviceModel::OSIFAlpha|| m_fsInfo.ucDeviceModel == DeviceModel::OSIFBeta) if (m_fsInfo.ucDeviceModel == DeviceModel::OSIFAlpha || m_fsInfo.ucDeviceModel == DeviceModel::OSIFBeta) {
{ if (m_vecNonLinearCalP.size() != 8) {
if (m_vecNonLinearCalP.size() != 8)
{
qDebug() << "Err.Non Linear calibration parameters not fit.Skip..." << " Thread ID:" << m_iThreadID; qDebug() << "Err.Non Linear calibration parameters not fit.Skip..." << " Thread ID:" << m_iThreadID;
return dfTemp; return dfTemp;
} }
for (int i=0;i<m_daDeviceAttr.iPixels;i++) for (int i = 0; i < m_daDeviceAttr.iPixels; i++) {
{ dfTemp.lData[i] = dfTemp.lData[i] / (m_vecNonLinearCalP[0] +
dfTemp.lData[i] = dfTemp.lData[i] / ( m_vecNonLinearCalP[0] +
m_vecNonLinearCalP[1] * dfTemp.lData[i] + m_vecNonLinearCalP[1] * dfTemp.lData[i] +
m_vecNonLinearCalP[2] * pow(dfTemp.lData[i], 2) + m_vecNonLinearCalP[2] * pow(dfTemp.lData[i], 2) +
m_vecNonLinearCalP[3] * pow(dfTemp.lData[i], 3) + m_vecNonLinearCalP[3] * pow(dfTemp.lData[i], 3) +
@ -555,75 +482,67 @@ DataFrame CAbstractFSController::TakeOneFrame()
return dfTemp; return dfTemp;
// DataFrame dfTemp; // DataFrame dfTemp;
// int iRes = m_pFSCtrl->SingleShot(dfTemp); // int iRes = m_pFSCtrl->SingleShot(dfTemp);
// if (iRes != 0) // if (iRes != 0)
// { // {
// qDebug() << "Err. SingleShot" << " Thread ID:" << m_iThreadID; // qDebug() << "Err. SingleShot" << " Thread ID:" << m_iThreadID;
// } // }
// //
// return dfTemp; // return dfTemp;
} }
int CAbstractFSController::SaveDataFile() {
int CAbstractFSController::SaveDataFile()
{
return 0; return 0;
} }
int CAbstractFSController::LoadQEProLinearCalibrationFile() int CAbstractFSController::LoadQEProLinearCalibrationFile() {
{
m_vecNonLinearCalP.clear(); m_vecNonLinearCalP.clear();
QDir qdirPath(m_qstrCalFilePath); QDir qdirPath(m_qstrCalFilePath);
if (!qdirPath.exists()) if (!qdirPath.exists()) {
{
qDebug() << "Non-Linear Calibration Folder not exist" << " Thread ID:" << m_iThreadID; qDebug() << "Non-Linear Calibration Folder not exist" << " Thread ID:" << m_iThreadID;
return 1; return 1;
} }
QString qstrFilePath; QString qstrFilePath;
qstrFilePath = m_qstrCalFilePath + QString("/")+QString::fromStdString(m_fsInfo.strSN)+ QString(".NLC"); qstrFilePath = m_qstrCalFilePath + QString("/") + QString::fromStdString(m_fsInfo.strSN) + QString(".NLC");
QFile qfCalFile(qstrFilePath); QFile qfCalFile(qstrFilePath);
bool bRes = qfCalFile.open(QFile::ReadOnly); bool bRes = qfCalFile.open(QFile::ReadOnly);
if (!bRes) if (!bRes) {
{
qDebug() << "Non-Linear Calibration File open Failed" << " Thread ID:" << m_iThreadID; qDebug() << "Non-Linear Calibration File open Failed" << " Thread ID:" << m_iThreadID;
return 2; return 2;
} }
while (!qfCalFile.atEnd()) while (!qfCalFile.atEnd()) {
{
QByteArray qbData = qfCalFile.readLine(); QByteArray qbData = qfCalFile.readLine();
qbData.remove(qbData.size()-1, 1); qbData.remove(qbData.size() - 1, 1);
m_vecNonLinearCalP.push_back(qbData.toDouble()); m_vecNonLinearCalP.push_back(qbData.toDouble());
//qDebug() << qbData; //qDebug() << qbData;
} }
qfCalFile.close(); qfCalFile.close();
qDebug() <<"Non-Linear Calibration Params:"<< m_vecNonLinearCalP.size() << " Thread ID:" << m_iThreadID; qDebug() << "Non-Linear Calibration Params:" << m_vecNonLinearCalP.size() << " Thread ID:" << m_iThreadID;
return 0; return 0;
} }
int CAbstractFSController::StartAcquisitionSignal(int position) int CAbstractFSController::StartAcquisitionSignal(int position) {
{
// //
qDebug() << "Starting acq Signal" << " Thread ID:" << m_iThreadID; qDebug() << "Starting acq Signal" << " Thread ID:" << m_iThreadID;
// DataFrame struDF; // DataFrame struDF;
// int iii; // int iii;
// m_pFSCtrl->SetExposureTime(10000000); // m_pFSCtrl->SetExposureTime(10000000);
// m_pFSCtrl->GetExposureTime(iii); // m_pFSCtrl->GetExposureTime(iii);
// m_pFSCtrl->SingleShot(struDF); // m_pFSCtrl->SingleShot(struDF);
if (m_taginfolast.lastITTIME[position]==0) { if (m_taginfolast.lastITTIME[position] == 0) {
PerformAutoExposure(position); PerformAutoExposure(position);
}else { } else {
ComputExposure(position); ComputExposure(position);
} }
@ -635,35 +554,30 @@ int CAbstractFSController::StartAcquisitionSignal(int position)
return 0; return 0;
} }
int CAbstractFSController::StartAcquisitionDark(int position) int CAbstractFSController::StartAcquisitionDark(int position) {
{
qDebug() << "Starting acq Dark" << " Thread ID:" << m_iThreadID; qDebug() << "Starting acq Dark" << " Thread ID:" << m_iThreadID;
TakeDarkFrame(position); TakeDarkFrame(position);
qDebug() << "Stop acq Dark"<< " Thread ID:" << m_iThreadID; qDebug() << "Stop acq Dark" << " Thread ID:" << m_iThreadID;
emit SignalAcqFinished_Dark(m_iThreadID, 1); emit SignalAcqFinished_Dark(m_iThreadID, 1);
return 0; return 0;
} }
int CAbstractFSController::StopAcquisition() int CAbstractFSController::StopAcquisition() {
{
return 0; return 0;
} }
int CAbstractFSController::ClearBuffer() int CAbstractFSController::ClearBuffer() {
{
m_vecDataFrameDark.clear(); m_vecDataFrameDark.clear();
m_vecDataFrameSignal.clear(); m_vecDataFrameSignal.clear();
return 0; return 0;
} }
int CAbstractFSController::GetBuffer(std::vector<DataFrame> &pvecDataFrameDark, std::vector<DataFrame> &pvecDataFrameSignal) int CAbstractFSController::GetBuffer(std::vector<DataFrame> &pvecDataFrameDark,
{ std::vector<DataFrame> &pvecDataFrameSignal) {
for (size_t i=0; i < m_vecDataFrameSignal.size(); i++) for (size_t i = 0; i < m_vecDataFrameSignal.size(); i++) {
{
pvecDataFrameSignal.push_back(m_vecDataFrameSignal[i]); pvecDataFrameSignal.push_back(m_vecDataFrameSignal[i]);
pvecDataFrameDark.push_back(m_vecDataFrameDark[i]); pvecDataFrameDark.push_back(m_vecDataFrameDark[i]);
} }
return 0; return 0;
} }

View File

@ -146,6 +146,13 @@ int CMainDataGrabber::InitLS()
DSSOne.iChannelA = 1; DSSOne.iChannelA = 1;
DSSOne.iChannelB = 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); m_vecDSS.push_back(DSSOne);

View File

@ -85,8 +85,9 @@ int Scheduler::OnTimeCounter()
m_iFlagIsOnRestart = 1; m_iFlagIsOnRestart = 1;
} }
emit SignalZeroHoldCurrent(); emit SignalZeroHoldCurrent();
system("gpio write 1 0");//<2F><EFBFBD>ϵ<EFBFBD> system("gpio write 1 1");//<2F><EFBFBD>ϵ<EFBFBD>
qDebug() << "gpio write 1 0......"<<endl; system("gpio write 12 1");//<2F><EFBFBD>ϵ<EFBFBD>
qDebug() << "gpio write 1 1......"<<endl;
qDebug() << "Non working time. Idling......"; qDebug() << "Non working time. Idling......";
return 0; return 0;
} }

View File

@ -216,6 +216,8 @@ namespace ZZ_MISCDEF
std::string strInterface; std::string strInterface;
ZZ_U8 ucProtocolType; ZZ_U8 ucProtocolType;
ZZ_U16 usCmdID; ZZ_U16 usCmdID;
std::string usGPIOChannelAPin;
std::string usGPIOChannelBPin;
}LSContext; }LSContext;
typedef struct tagAcquisitionTimeSettings typedef struct tagAcquisitionTimeSettings

View File

@ -9,6 +9,7 @@
#else #else
m_qstrDeviceConfigFilePath = "/home/data/Setting/DeviceSettings.ini"; m_qstrDeviceConfigFilePath = "/home/data/Setting/DeviceSettings.ini";
m_qstrJSONConfigFilePath = ("/home/data/Setting/config.json"); m_qstrJSONConfigFilePath = ("/home/data/Setting/config.json");
qDebug()<< "Load Device Config File Path:" << m_qstrDeviceConfigFilePath;
#endif // DEBUG #endif // DEBUG
m_qsDeviceConfig = NULL; m_qsDeviceConfig = NULL;
@ -24,6 +25,9 @@
int ZZ_SysConfigger::Initialize() int ZZ_SysConfigger::Initialize()
{ {
qDebug()<< "Load Device Config File Path:" ;
qDebug()<< "Load Device Config File Path:" << m_qstrDeviceConfigFilePath;
qDebug()<< "Load Device Config File Path:" << m_qstrDeviceConfigFilePath;
//////////////////////////////////////////////////////////////////////////load device settings //////////////////////////////////////////////////////////////////////////load device settings
using namespace ZZ_MISCDEF; using namespace ZZ_MISCDEF;
QMetaEnum enumDeviceModel = QMetaEnum::fromType<ConfiggerDeviceModel>(); QMetaEnum enumDeviceModel = QMetaEnum::fromType<ConfiggerDeviceModel>();
@ -32,6 +36,8 @@
{ {
delete m_qsDeviceConfig; delete m_qsDeviceConfig;
} }
m_qsDeviceConfig = new QSettings(m_qstrDeviceConfigFilePath, QSettings::IniFormat); m_qsDeviceConfig = new QSettings(m_qstrDeviceConfigFilePath, QSettings::IniFormat);
////FS ////FS
m_struFSContext.ucDeviceNumber = m_qsDeviceConfig->value(QString("DEVICE INFO/TotalSpectrometer"),-1).toInt(); m_struFSContext.ucDeviceNumber = m_qsDeviceConfig->value(QString("DEVICE INFO/TotalSpectrometer"),-1).toInt();
@ -81,7 +87,19 @@
m_struLSContext.usCmdID = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/DCID")).toInt(); m_struLSContext.usCmdID = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/DCID")).toInt();
m_struLSContext.ucProtocolType = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/Type")).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.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 //////////////////////////////////////////////////////////////////////////humiture
m_struHumitureDeviceInfo.qstrInterfaceName = m_qsDeviceConfig->value(QString("HUMITURE/Port")).toString(); m_struHumitureDeviceInfo.qstrInterfaceName = m_qsDeviceConfig->value(QString("HUMITURE/Port")).toString();
//////////////////////////////////////////////////////////////////////////load json settings //////////////////////////////////////////////////////////////////////////load json settings