diff --git a/HPPA/FocusDialog.ui b/HPPA/FocusDialog.ui
index 22f5445..12932e3 100644
--- a/HPPA/FocusDialog.ui
+++ b/HPPA/FocusDialog.ui
@@ -6,8 +6,8 @@
0
0
- 453
- 339
+ 1312
+ 752
@@ -74,63 +74,6 @@
- -
-
-
- 调整线性平台
-
-
-
-
-
-
- LogicZero
-
-
-
- -
-
-
- +
-
-
-
- -
-
-
- 50
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- max
-
-
-
- -
-
-
- -
-
-
-
- -
-
-
- 50
-
-
- Qt::AlignCenter
-
-
-
-
-
-
-
@@ -174,6 +117,111 @@
+ -
+
+
+ 调整线性平台
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ 更新
+
+
+
+ -
+
+
+
+ 0
+ 46
+
+
+
+ null
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 移动至
+
+
+
+ -
+
+
+ +
+
+
+
+ -
+
+
+
+ 0
+ 46
+
+
+
+ 50
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ LogicZero
+
+
+
+ -
+
+
+ -
+
+
+
+ -
+
+
+
+ 0
+ 46
+
+
+
+ 50
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ max
+
+
+
+
+
+
diff --git a/HPPA/HPPA.cpp b/HPPA/HPPA.cpp
index 4501959..fd455f3 100644
--- a/HPPA/HPPA.cpp
+++ b/HPPA/HPPA.cpp
@@ -235,6 +235,35 @@ HPPA::HPPA(QWidget *parent)
//
connect(this->ui.action_about, SIGNAL(triggered()), this, SLOT(onAbout()));
+
+ //ļûУʹļ
+ string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
+
+ Configfile configfile;
+ configfile.setConfigfilePath(HPPACfgFile);
+ if (!configfile.isConfigfileExist())
+ configfile.createConfigFile();
+ configfile.parseConfigfile();
+
+ /*int max, min;
+ configfile.getPositionRestriction(max, min);
+
+ string sn;
+ configfile.getSN(sn);
+
+ int coarse, fine;
+ configfile.getTuningStepSize(coarse, fine);
+ float fa, fb;
+ configfile.getFitParams(fa, fb);
+ int max_FocusRange, min_FocusRange;
+ configfile.getAutoFocusRange(max_FocusRange, min_FocusRange);
+
+ float StepAnglemar_x, Lead_x, ScaleFactor_x;
+ int SubdivisionMultiples_x;
+ configfile.getXMotorParm(StepAnglemar_x, Lead_x, SubdivisionMultiples_x, ScaleFactor_x);
+ float StepAnglemar_y, Lead_y, ScaleFactor_y;
+ int SubdivisionMultiples_y;
+ configfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/
}
HPPA::~HPPA()
diff --git a/HPPA/HPPA.h b/HPPA/HPPA.h
index fdcd298..74df8a4 100644
--- a/HPPA/HPPA.h
+++ b/HPPA/HPPA.h
@@ -30,6 +30,9 @@
#include "focusWindow.h"
#include "aboutWindow.h"
+#include "hppaConfigFile.h"
+#include "path_tc.h"
+
#define PI 3.1415926
QT_CHARTS_USE_NAMESPACE//QChartView ʹ ҪӺ꣬ ʹ
diff --git a/HPPA/HPPA.vcxproj b/HPPA/HPPA.vcxproj
index 36946d4..d90fa8f 100644
--- a/HPPA/HPPA.vcxproj
+++ b/HPPA/HPPA.vcxproj
@@ -55,16 +55,16 @@
- D:\cpp_library\vincecontrol_vs2017;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;$(IncludePath)
- D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;$(LibraryPath)
+ D:\cpp_library\vincecontrol_vs2017;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;$(IncludePath)
+ D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;$(LibraryPath)
- D:\cpp_library\vincecontrol_vs2017;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;$(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;$(LibraryPath)
+ D:\cpp_library\vincecontrol_vs2017;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;$(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;$(LibraryPath)
- opencv_world3411.lib;opencv_world3411d.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;%(AdditionalDependencies)
+ opencv_world3411.lib;opencv_world3411d.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;%(AdditionalDependencies)
%(PreprocessorDefinitions)
@@ -72,7 +72,7 @@
- opencv_world3411.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;%(AdditionalDependencies)
+ opencv_world3411.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++.lib;%(AdditionalDependencies)
@@ -103,6 +103,8 @@
+
+
@@ -139,8 +141,10 @@
+
+
diff --git a/HPPA/HPPA.vcxproj.filters b/HPPA/HPPA.vcxproj.filters
index 77b9357..9e8cbea 100644
--- a/HPPA/HPPA.vcxproj.filters
+++ b/HPPA/HPPA.vcxproj.filters
@@ -85,6 +85,12 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
@@ -137,6 +143,12 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
diff --git a/HPPA/QMotorDoubleSlider.cpp b/HPPA/QMotorDoubleSlider.cpp
index 9dc5a96..c86e399 100644
--- a/HPPA/QMotorDoubleSlider.cpp
+++ b/HPPA/QMotorDoubleSlider.cpp
@@ -1,10 +1,6 @@
#include "stdafx.h"
#include "QMotorDoubleSlider.h"
-QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :
-QSlider(pParent),
-//m_Multiplier(0.00054496986),//ϺũԺǰ0.00052734375/5=0.00010546875ĺȷֵΪ0.000544969862759644Ϊ0.00054496986/5=0.000108993972Ϊиеװ1Ҫ5
-m_Multiplier(0.00054496986),//˰ũ
-m_yMultiplier(0.000108993972)//
+QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pParent)
{
connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int)));
@@ -12,6 +8,25 @@ m_yMultiplier(0.000108993972)//
setOrientation(Qt::Horizontal);
setFocusPolicy(Qt::NoFocus);
+
+ //ȡļ
+ string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
+ Configfile configfile;
+ configfile.setConfigfilePath(HPPACfgFile);
+ if (!configfile.isConfigfileExist())
+ configfile.createConfigFile();
+ configfile.parseConfigfile();
+
+ float Lead_x;//
+ float StepAnglemar_x;//
+ float ScaleFactor_x;//еװõԭ
+ int SubdivisionMultiples_x;//ϸ
+ configfile.getXMotorParm(StepAnglemar_x, Lead_x, SubdivisionMultiples_x, ScaleFactor_x);
+
+ //ݹʽ廻Ϊ룺1(m_Multiplier)=/(360/*ϸֱ)ַhttps://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
+ //m_Multiplier(0.00054496986),//ϺũԺǰ0.00052734375/5=0.00010546875ĺȷֵΪ0.000544969862759644Ϊ0.00054496986/5=0.000108993972Ϊиеװ1Ҫ5
+ //m_Multiplier(0.00054496986)//˰ũ
+ m_Multiplier = Lead_x / (360 / StepAnglemar_x * SubdivisionMultiples_x) * ScaleFactor_x;
}
//ⷢ
diff --git a/HPPA/QMotorDoubleSlider.h b/HPPA/QMotorDoubleSlider.h
index da1b88a..de1c43d 100644
--- a/HPPA/QMotorDoubleSlider.h
+++ b/HPPA/QMotorDoubleSlider.h
@@ -2,6 +2,10 @@
#define Q_MOTOR_DOUBLE_SLIDER_H
#include
#include
+
+#include "hppaConfigFile.h"
+#include "path_tc.h"
+
class QMotorDoubleSlider : public QSlider
{
Q_OBJECT
@@ -9,8 +13,7 @@ class QMotorDoubleSlider : public QSlider
public:
QMotorDoubleSlider(QWidget* pParent = NULL);
- double m_Multiplier;//ݹʽ廻Ϊ룺1(m_Multiplier)=/(360/*ϸֱ)ַhttps://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
- double m_yMultiplier;//ǣ1.8135mm
+ double m_Multiplier;
void setRange(double Min, double Max);
void setMinimum(double Min);
diff --git a/HPPA/QYMotorDoubleSlider.cpp b/HPPA/QYMotorDoubleSlider.cpp
index f8f4891..8e4f16b 100644
--- a/HPPA/QYMotorDoubleSlider.cpp
+++ b/HPPA/QYMotorDoubleSlider.cpp
@@ -1,10 +1,6 @@
#include "stdafx.h"
#include "QYMotorDoubleSlider.h"
-QYMotorDoubleSlider::QYMotorDoubleSlider(QWidget* pParent /*= NULL*/) :
-QSlider(pParent),
-//m_Multiplier(0.000108993972),//ϺũԺǰ0.00052734375/5=0.00010546875ĺȷֵΪ0.000544969862759644Ϊ0.00054496986/5=0.000108993972Ϊиеװ1Ҫ5
-m_Multiplier(0.000108993972),//˰ũ
-m_yMultiplier(0.000108993972)//
+QYMotorDoubleSlider::QYMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pParent)
{
connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int)));
@@ -12,6 +8,24 @@ m_yMultiplier(0.000108993972)//
setOrientation(Qt::Horizontal);
setFocusPolicy(Qt::NoFocus);
+
+ //ļ
+ string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
+ Configfile configfile;
+ configfile.setConfigfilePath(HPPACfgFile);
+ if (!configfile.isConfigfileExist())
+ configfile.createConfigFile();
+ configfile.parseConfigfile();
+
+ float StepAnglemar_y;
+ float Lead_y;
+ float ScaleFactor_y;//еװõԭ
+ int SubdivisionMultiples_y;
+ configfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);
+
+ //m_Multiplier(0.000108993972),//ϺũԺǰ0.00052734375/5=0.00010546875ĺȷֵΪ0.000544969862759644Ϊ0.00054496986/5=0.000108993972Ϊиеװ1Ҫ5
+ //m_Multiplier(0.000108993972)//˰ũ
+ m_Multiplier = Lead_y / (360 / StepAnglemar_y * SubdivisionMultiples_y) * ScaleFactor_y;
}
//ⷢ
diff --git a/HPPA/QYMotorDoubleSlider.h b/HPPA/QYMotorDoubleSlider.h
index bf7ff2e..b0854fd 100644
--- a/HPPA/QYMotorDoubleSlider.h
+++ b/HPPA/QYMotorDoubleSlider.h
@@ -2,6 +2,10 @@
#define Q_YMOTOR_DOUBLE_SLIDER_H
#include
#include
+
+#include "hppaConfigFile.h"
+#include "path_tc.h"
+
class QYMotorDoubleSlider : public QSlider//QYMotorDoubleSlider
{
Q_OBJECT
@@ -10,7 +14,6 @@ public:
QYMotorDoubleSlider(QWidget* pParent = NULL);
double m_Multiplier;//ݹʽ廻Ϊ룺1(m_Multiplier)=/(360/*ϸֱ)ַhttps://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
- double m_yMultiplier;//ǣ1.8135mm
void setRange(double Min, double Max);
void setMinimum(double Min);
diff --git a/HPPA/focusWindow.cpp b/HPPA/focusWindow.cpp
index f49bb9d..fca5fa9 100644
--- a/HPPA/focusWindow.cpp
+++ b/HPPA/focusWindow.cpp
@@ -5,6 +5,17 @@ focusWindow::focusWindow(QWidget *parent, ResononImager * imager)
{
ui.setupUi(this);
+ //ȡļ
+ string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
+ Configfile configfile;
+ configfile.setConfigfilePath(HPPACfgFile);
+ if (!configfile.isConfigfileExist())
+ configfile.createConfigFile();
+
+ configfile.parseConfigfile();
+ configfile.getPositionRestriction(m_iMaxPos, m_iMinPos);
+
+
disableBeforeConnect(true);
setAttribute(Qt::WA_DeleteOnClose);//ùرմ͵ô
@@ -24,6 +35,9 @@ focusWindow::focusWindow(QWidget *parent, ResononImager * imager)
connect(this->ui.autoFocus_btn, SIGNAL(clicked()), this, SLOT(onAutoFocus()));
connect(this->ui.manualFocus_btn, SIGNAL(clicked()), this, SLOT(onManualFocus()));
+ connect(this->ui.updateCurrentLocation_btn, SIGNAL(clicked()), this, SLOT(onUpdateCurrentLocation()));
+ connect(this->ui.moveto_btn, SIGNAL(clicked()), this, SLOT(onMoveto()));
+
//ҿôڣʾ
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
{
@@ -93,8 +107,7 @@ void focusWindow::onConnectMotor()
rx.indexIn(ultrasoundPortTmp, 0);
int ultrasoundPort = rx.cap(0).toInt();
- int minPos = 120;
- int maxPos = 1000;
+
if (isUltrasound)
{
@@ -117,11 +130,10 @@ void focusWindow::onConnectMotor()
m_ctrlFocusMotor = new CFocusMotorControl();
- m_ctrlFocusMotor->SetLogicZero(minPos);
- m_ctrlFocusMotor->SetLimit(minPos, maxPos);
- m_iMotorMaxPos = maxPos;
+ m_ctrlFocusMotor->SetLogicZero(m_iMinPos);
+ m_ctrlFocusMotor->SetLimit(m_iMinPos, m_iMaxPos);
m_ctrlFocusMotor->InitSystem(motor, ultrasound, test, this);
- m_ctrlFocusMotor->MoveToLogicZero();
+ //m_ctrlFocusMotor->MoveToLogicZero();
}
else
{
@@ -135,9 +147,8 @@ void focusWindow::onConnectMotor()
m_ctrlFocusMotor = new CFocusMotorControl();
- m_ctrlFocusMotor->SetLogicZero(minPos);
- m_ctrlFocusMotor->SetLimit(minPos, maxPos);
- m_iMotorMaxPos = maxPos;
+ m_ctrlFocusMotor->SetLogicZero(m_iMinPos);
+ m_ctrlFocusMotor->SetLimit(m_iMinPos, m_iMaxPos);
m_ctrlFocusMotor->InitSystem(motor, test, this);
m_ctrlFocusMotor->MoveToLogicZero();
}
@@ -152,7 +163,7 @@ void focusWindow::onMove2MotorLogicZero()
void focusWindow::onMove2MotorMax()
{
- m_ctrlFocusMotor->MoveToPos(m_iMotorMaxPos);
+ m_ctrlFocusMotor->MoveToPos(m_iMaxPos);
}
void focusWindow::onAdd()
@@ -163,10 +174,6 @@ void focusWindow::onAdd()
int stepSize = ui.addStepSize_lineEdit->text().toInt();
m_ctrlFocusMotor->MoveToPos(di.iAbsPosition + stepSize);
-
- m_ctrlFocusMotor->GetDriverStatus(di);
- printf("λã%d", di.iAbsPosition);
- std::cout << "ť" << std::endl;
}
void focusWindow::onSubtract()
@@ -177,9 +184,6 @@ void focusWindow::onSubtract()
int stepSize = ui.subtractStepSize_lineEdit->text().toInt();
m_ctrlFocusMotor->MoveToPos(di.iAbsPosition - stepSize);
-
- m_ctrlFocusMotor->GetDriverStatus(di);
- printf("λã%d", di.iAbsPosition);
}
void focusWindow::onAutoFocus()
@@ -225,9 +229,27 @@ void focusWindow::onManualFocus()
}
}
+void focusWindow::onUpdateCurrentLocation()
+{
+ DriverInfo di;
+ m_ctrlFocusMotor->GetDriverStatus(di);
+ ui.currentLocation_lineEdit->setText(QString::number(di.iAbsPosition));
+}
+
+void focusWindow::onMoveto()
+{
+ int pos = ui.currentLocation_lineEdit->text().toInt();
+ //ҪЧ֤鿴ǷЧΧ
+
+
+ m_ctrlFocusMotor->MoveToPos(pos);
+}
+
void focusWindow::onAutoFocusFinished()
{
this->setDisabled(false);
+
+ onUpdateCurrentLocation();
}
void focusWindow::onAutoFocusProgress(int progress)
@@ -259,14 +281,29 @@ WorkerThread2::WorkerThread2(CFocusMotorControl * ctrlFocusMotor, bool isUltraso
void WorkerThread2::run()
{
+ //ļ
+ string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
+ Configfile configfile;
+ configfile.setConfigfilePath(HPPACfgFile);
+ if (!configfile.isConfigfileExist())
+ configfile.createConfigFile();
+ configfile.parseConfigfile();
+
+ int coarse, fine;
+ configfile.getTuningStepSize(coarse, fine);
+ float fa, fb;
+ configfile.getFitParams(fa, fb);
+ int max_FocusRange, min_FocusRange;
+ configfile.getAutoFocusRange(max_FocusRange, min_FocusRange);
+
if (m_bIsUltrasound)
{
- m_ctrlFocusMotor->SetFitParams(0.0017, 0.3277);
+ m_ctrlFocusMotor->SetFitParams(fa, fb);
m_ctrlFocusMotor->StartAutoFocus(5, 2);
}
else
{
- m_ctrlFocusMotor->StartAutoFocus(820, 910, 10, 2);
+ m_ctrlFocusMotor->StartAutoFocus(min_FocusRange, max_FocusRange, coarse, fine);
}
emit AutoFocusFinishedSignal();
diff --git a/HPPA/focusWindow.h b/HPPA/focusWindow.h
index 29846e8..0110066 100644
--- a/HPPA/focusWindow.h
+++ b/HPPA/focusWindow.h
@@ -23,6 +23,9 @@
#include "resononImager.h"
+#include "hppaConfigFile.h"
+#include "path_tc.h"
+
class focusWindow:public QDialog
{
Q_OBJECT
@@ -40,7 +43,7 @@ private:
QThread *m_AutoFocusThread;
int m_FocusState;
- int m_iMotorMaxPos;
+ int m_iMinPos, m_iMaxPos;
CFocusMotorControl* m_ctrlFocusMotor;
@@ -54,6 +57,8 @@ public Q_SLOTS:
void onSubtract();
void onAutoFocus();
void onManualFocus();
+ void onUpdateCurrentLocation();
+ void onMoveto();
void onAutoFocusFinished();
void onAutoFocusProgress(int progress);
void onUltrasound_radioButton();
diff --git a/HPPA/hppaConfigFile.cpp b/HPPA/hppaConfigFile.cpp
new file mode 100644
index 0000000..d59c644
--- /dev/null
+++ b/HPPA/hppaConfigFile.cpp
@@ -0,0 +1,358 @@
+//
+// Created by tangchao on 2023/3/25.
+//
+
+#include "hppaConfigFile.h"
+
+Configfile::Configfile()
+{
+
+}
+
+void Configfile::setConfigfilePath(string configfilePath)
+{
+ m_configfilePath = configfilePath;
+}
+
+bool Configfile::isConfigfileExist()
+{
+ QFileInfo info(QString::fromStdString(m_configfilePath));
+
+ return info.exists();
+}
+
+bool Configfile::parseConfigfile()
+{
+ // Read the file. If there is an error, report it and exit.
+ try
+ {
+ cfg.readFile(m_configfilePath);
+
+ return true;
+ }
+ catch(const FileIOException &fioex)
+ {
+ std::cerr << "I/O error while reading file." << std::endl;
+ return false;
+ }
+ catch(const ParseException &pex)
+ {
+ std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
+ << " - " << pex.getError() << std::endl;
+ return false;
+ }
+}
+
+bool Configfile::getPositionRestriction(int& max, int& min)
+{
+ const Setting& root = cfg.getRoot();
+
+ try
+ {
+ const Setting& autoFocus = root["autoFocus"];
+ int count = autoFocus.getLength();
+
+ const Setting& positionRestriction = autoFocus["PositionRestriction"];
+ string name = positionRestriction.getName();
+
+ if (!(positionRestriction.lookupValue("max", max)
+ && positionRestriction.lookupValue("min", min)
+ ))
+ {
+ return false;
+ }
+ }
+ catch (const SettingNotFoundException& nfex)
+ {
+ // Ignore.
+ return false;
+ }
+
+ return true;
+}
+
+bool Configfile::getTuningStepSize(int& coarse, int& fine)
+{
+ const Setting& root = cfg.getRoot();
+
+ try
+ {
+ const Setting& autoFocus = root["autoFocus"];
+ int count = autoFocus.getLength();
+
+ const Setting& TuningStepSize = autoFocus["TuningStepSize"];
+ string name = TuningStepSize.getName();
+
+ if (!(TuningStepSize.lookupValue("coarse", coarse)
+ && TuningStepSize.lookupValue("fine", fine)
+ ))
+ {
+ return false;
+ }
+ }
+ catch (const SettingNotFoundException& nfex)
+ {
+ // Ignore.
+ return false;
+ }
+
+ return true;
+}
+
+bool Configfile::getFitParams(float& fa, float& fb)
+{
+ const Setting& root = cfg.getRoot();
+
+ try
+ {
+ const Setting& autoFocus = root["autoFocus"];
+ int count = autoFocus.getLength();
+
+ const Setting& FitParams = autoFocus["FitParams"];
+ string name = FitParams.getName();
+
+ if (!(FitParams.lookupValue("fa", fa)
+ && FitParams.lookupValue("fb", fb)
+ ))
+ {
+ return false;
+ }
+ }
+ catch (const SettingNotFoundException& nfex)
+ {
+ // Ignore.
+ return false;
+ }
+
+ return true;
+}
+
+bool Configfile::getAutoFocusRange(int& max, int& min)
+{
+ const Setting& root = cfg.getRoot();
+
+ try
+ {
+ const Setting& autoFocus = root["autoFocus"];
+ int count = autoFocus.getLength();
+
+ const Setting& AutoFocusRange = autoFocus["AutoFocusRange"];
+ string name = AutoFocusRange.getName();
+
+ if (!(AutoFocusRange.lookupValue("max", max)
+ && AutoFocusRange.lookupValue("min", min)
+ ))
+ {
+ return false;
+ }
+ }
+ catch (const SettingNotFoundException& nfex)
+ {
+ // Ignore.
+ return false;
+ }
+
+ return true;
+}
+
+bool Configfile::getXMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor)
+{
+ const Setting& root = cfg.getRoot();
+
+ try
+ {
+ const Setting& motionPlatform = root["motionPlatform"];
+ int count = motionPlatform.getLength();
+
+ const Setting& x = motionPlatform["x"];
+ string name = x.getName();
+
+ if (!(x.lookupValue("StepAnglemar", StepAnglemar)
+ && x.lookupValue("Lead", Lead) && x.lookupValue("SubdivisionMultiples", SubdivisionMultiples)
+ && x.lookupValue("ScaleFactor", ScaleFactor)
+ ))
+ {
+ return false;
+ }
+ }
+ catch (const SettingNotFoundException& nfex)
+ {
+ // Ignore.
+ return false;
+ }
+
+ return true;
+}
+
+bool Configfile::getYMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor)
+{
+ const Setting& root = cfg.getRoot();
+
+ try
+ {
+ const Setting& motionPlatform = root["motionPlatform"];
+ int count = motionPlatform.getLength();
+
+ const Setting& y = motionPlatform["y"];
+ string name = y.getName();
+
+ if (!(y.lookupValue("StepAnglemar", StepAnglemar)
+ && y.lookupValue("Lead", Lead) && y.lookupValue("SubdivisionMultiples", SubdivisionMultiples)
+ && y.lookupValue("ScaleFactor", ScaleFactor)
+ ))
+ {
+ return false;
+ }
+ }
+ catch (const SettingNotFoundException& nfex)
+ {
+ // Ignore.
+ return false;
+ }
+
+ return true;
+}
+
+bool Configfile::getSN(string &SN)
+{
+ try
+ {
+ std::string SN_tem = cfg.lookup("SN");
+ SN = SN_tem;
+
+ return true;
+ }
+ catch(const SettingNotFoundException &nfex)
+ {
+ cerr << "No 'spectralBin' setting in configuration file." << endl;
+ return false;
+ }
+}
+
+bool Configfile::createConfigFile()
+{
+ using namespace std;
+ using namespace libconfig;
+
+ Config cfg;
+
+ Setting &root = cfg.getRoot();
+
+ // Add some settings to the configuration.
+ Setting &SN = root.add("SN", Setting::TypeString) = "2004";
+
+ //autoFocus
+ Setting & autoFocus = root.add("autoFocus", Setting::TypeGroup);
+ Setting & PositionRestriction = autoFocus.add("PositionRestriction", Setting::TypeGroup);
+ Setting& TuningStepSize = autoFocus.add("TuningStepSize", Setting::TypeGroup);
+ Setting& FitParams = autoFocus.add("FitParams", Setting::TypeGroup);
+ Setting& AutoFocusRange = autoFocus.add("AutoFocusRange", Setting::TypeGroup);
+
+ Setting & PositionRestriction_max = PositionRestriction.add("max", Setting::TypeInt) = 1000;
+ Setting & PositionRestriction_min = PositionRestriction.add("min", Setting::TypeInt) = 120;
+ Setting& TuningStepSize_coarse = TuningStepSize.add("coarse", Setting::TypeInt) = 10;
+ Setting& TuningStepSize_fine = TuningStepSize.add("fine", Setting::TypeInt) = 2;
+ Setting& FitParams_fa = FitParams.add("fa", Setting::TypeFloat) = 0.0017;
+ Setting& FitParams_fb = FitParams.add("fb", Setting::TypeFloat) = 0.3277;
+ Setting& AutoFocusRange_max = AutoFocusRange.add("max", Setting::TypeInt) = 688;
+ Setting& AutoFocusRange_min = AutoFocusRange.add("min", Setting::TypeInt) = 144;
+
+ //motionPlatform
+ Setting& motionPlatform = root.add("motionPlatform", Setting::TypeGroup);
+ Setting& x = motionPlatform.add("x", Setting::TypeGroup);
+ Setting& y = motionPlatform.add("y", Setting::TypeGroup);
+
+ Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//
+ Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//̣λcm
+ Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 128;//ϸֱ
+ Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//
+ Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8;
+ Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5;
+ Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 128;
+ Setting& y_ScaleFactor = y.add("ScaleFactor", Setting::TypeFloat) = 0.2;
+
+ // Write out the new configuration.
+ try
+ {
+ cfg.writeFile(m_configfilePath.c_str());
+ cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
+
+ }
+ catch(const FileIOException &fioex)
+ {
+ cerr << "I/O error while writing configuration file: " << m_configfilePath.c_str() << endl;
+ return true;
+ }
+
+ return true;
+}
+
+bool Configfile::updateConfigFile()
+{
+ using namespace std;
+ using namespace libconfig;
+
+ static const char *output_file = "updated.cfg";
+
+ Config cfg;
+
+ cfg.setOptions(Config::OptionFsync
+ | Config::OptionSemicolonSeparators
+ | Config::OptionColonAssignmentForGroups
+ | Config::OptionOpenBraceOnSeparateLine);
+
+ // Read the file. If there is an error, report it and exit.
+ try
+ {
+ cfg.readFile("example.cfg");
+ }
+ catch(const FileIOException &fioex)
+ {
+ std::cerr << "I/O error while reading file." << std::endl;
+ return false;
+ }
+ catch(const ParseException &pex)
+ {
+ std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
+ << " - " << pex.getError() << std::endl;
+ return false;
+ }
+
+ // Find the 'movies' setting. Add intermediate settings if they don't yet
+ // exist.
+ Setting &root = cfg.getRoot();
+
+ if(! root.exists("inventory"))
+ root.add("inventory", Setting::TypeGroup);
+
+ Setting &inventory = root["inventory"];
+
+ if(! inventory.exists("movies"))
+ inventory.add("movies", Setting::TypeList);
+
+ Setting &movies = inventory["movies"];
+
+ // Create the new movie entry.
+ Setting &movie = movies.add(Setting::TypeGroup);
+
+ movie.add("title", Setting::TypeString) = "Buckaroo Banzai";
+ movie.add("media", Setting::TypeString) = "DVD";
+ movie.add("price", Setting::TypeFloat) = 12.99;
+ movie.add("qty", Setting::TypeInt) = 20;
+
+ // Write out the updated configuration.
+ try
+ {
+ cfg.writeFile(output_file);
+ cerr << "Updated configuration successfully written to: " << output_file
+ << endl;
+
+ }
+ catch(const FileIOException &fioex)
+ {
+ cerr << "I/O error while writing file: " << output_file << endl;
+ return false;
+ }
+
+ return true;
+}
diff --git a/HPPA/hppaConfigFile.h b/HPPA/hppaConfigFile.h
new file mode 100644
index 0000000..ac6e272
--- /dev/null
+++ b/HPPA/hppaConfigFile.h
@@ -0,0 +1,48 @@
+//
+// Created by tangchao on 2023/3/25.
+//
+
+#ifndef XIMEAIMAGERECORDER_CONFIGFILE_H
+#define XIMEAIMAGERECORDER_CONFIGFILE_H
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace libconfig;
+
+class Configfile
+{
+
+public:
+ Configfile();
+ void setConfigfilePath(string configfilePath);
+ bool isConfigfileExist();
+ bool parseConfigfile();
+
+ bool getSN(string& SN);
+
+ bool getPositionRestriction(int& max, int& min);
+ bool getTuningStepSize(int& coarse, int& fine);
+ bool getFitParams(float& fa, float& fb);
+ bool getAutoFocusRange(int& max, int& min);
+
+ bool getXMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor);
+ bool getYMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor);
+
+ bool createConfigFile();
+ bool updateConfigFile();
+
+private:
+ string m_configfilePath;
+ Config cfg;
+};
+#endif //XIMEAIMAGERECORDER_CONFIGFILE_H
diff --git a/HPPA/path_tc.cpp b/HPPA/path_tc.cpp
new file mode 100644
index 0000000..bd1f7ea
--- /dev/null
+++ b/HPPA/path_tc.cpp
@@ -0,0 +1,9 @@
+#include "path_tc.h"
+
+string getPathofEXE()
+{
+ string exePath = _pgmptr;
+ string xx = exePath.substr(0, exePath.find_last_of("\\/"));
+
+ return xx;
+}
\ No newline at end of file
diff --git a/HPPA/path_tc.h b/HPPA/path_tc.h
new file mode 100644
index 0000000..61b9a61
--- /dev/null
+++ b/HPPA/path_tc.h
@@ -0,0 +1,7 @@
+#pragma once
+#include
+//#include
+using namespace std;
+
+
+string getPathofEXE();
\ No newline at end of file