diff --git a/HSI_HexagonMI_EF3/CLMS.cpp b/HSI_HexagonMI_EF3/CLMS.cpp
index a6aee90..b396fbf 100644
--- a/HSI_HexagonMI_EF3/CLMS.cpp
+++ b/HSI_HexagonMI_EF3/CLMS.cpp
@@ -1,6 +1,6 @@
-
#include "stdafx.h"
#include "CLMS.h"
+#include "logger.h"
using namespace std;
#ifdef _DEBUG
@@ -76,55 +76,92 @@ CLM_GetExpirationDateFor m_pCLM_GetExpirationDateFor;
BOOL CheckLicense()
{
- m_hCLM = LoadLibrary(_T("CLMTool.dll"));
- if (m_hCLM)
- {
- //Production
- m_pCLM_Login = (CLM_Login)GetProcAddress(m_hCLM, "CLM_Login");
- m_pCLM_Logout = (CLM_Logout)GetProcAddress(m_hCLM, "CLM_Logout");
- m_pCLM_Login_Scope = (CLM_Login_Scope)GetProcAddress(m_hCLM, "CLM_Login_Scope");
- m_pCLM_ModuleIsLicensed = (CLM_ModuleIsLicensed)GetProcAddress(m_hCLM, "CLM_ModuleIsLicensed");
- m_pCLM_GetExpirationDateFor = (CLM_GetExpirationDateFor)GetProcAddress(m_hCLM, "CLM_GetExpirationDateFor");
- m_pCLM_GetWarrantyExpiration = (CLM_GetWarrantyExpiration)GetProcAddress(m_hCLM, "CLM_GetWarrantyExpiration");
- }
- //////////////////////////////////////////////////////////////////1登陆验证
- BOOL res = FALSE;
- //Metus软件
- char* strLogin = "rsWoGvmINesgabljzJZpTmMRGMLyKxFsaxpLRZSnpsujYlboLaKwSINrFbtddgMYgsXkCLwxfVUALwfQcxWEbvZZHjrrYwRkNCBMsjfxeKyannbTIVxsrQvLUWraoysNJFcYJrYnCSabWnxgezkDbvwHLksNqdWyvrfHqKeBLyyVyVYROgizPCqVaRQLkNrSROgvbAqShNZNuzKGHjOLYiwLaXnPKgvHcXuNeNLyuGMFeDnpiipTVDrvJaoNXDTq";
- res = m_pCLM_Login(strLogin);
- if (!res)
- {
- return res;
+ m_hCLM = LoadLibrary(_T("CLMTool.dll"));
+ if (m_hCLM)
+ {
+ if (g_pLogger)
+ {
+ g_pLogger->SendAndFlushWithTime(L"CLMTool.dll Load Success");
+ }
+
+ //Production
+ m_pCLM_Login = (CLM_Login)GetProcAddress(m_hCLM, "CLM_Login");
+ m_pCLM_Logout = (CLM_Logout)GetProcAddress(m_hCLM, "CLM_Logout");
+ m_pCLM_Login_Scope = (CLM_Login_Scope)GetProcAddress(m_hCLM, "CLM_Login_Scope");
+ m_pCLM_ModuleIsLicensed = (CLM_ModuleIsLicensed)GetProcAddress(m_hCLM, "CLM_ModuleIsLicensed");
+ m_pCLM_GetExpirationDateFor = (CLM_GetExpirationDateFor)GetProcAddress(m_hCLM, "CLM_GetExpirationDateFor");
+ m_pCLM_GetWarrantyExpiration = (CLM_GetWarrantyExpiration)GetProcAddress(m_hCLM, "CLM_GetWarrantyExpiration");
+ }
+ else
+ {
+ if (g_pLogger)
+ {
+ g_pLogger->SendAndFlushWithTime(L"CLMTool.dll Load Failed");
+ }
+
+ return FALSE;
+ }
+ //////////////////////////////////////////////////////////////////1登陆验证
+ BOOL res = FALSE;
+ //Metus软件
+ char* strLogin = "rsWoGvmINesgabljzJZpTmMRGMLyKxFsaxpLRZSnpsujYlboLaKwSINrFbtddgMYgsXkCLwxfVUALwfQcxWEbvZZHjrrYwRkNCBMsjfxeKyannbTIVxsrQvLUWraoysNJFcYJrYnCSabWnxgezkDbvwHLksNqdWyvrfHqKeBLyyVyVYROgizPCqVaRQLkNrSROgvbAqShNZNuzKGHjOLYiwLaXnPKgvHcXuNeNLyuGMFeDnpiipTVDrvJaoNXDTq";
+ res = m_pCLM_Login(strLogin);
+ if (!res)
+ {
+ //登陆验证失败
+ if (g_pLogger) {
+ g_pLogger->SendAndFlushWithTime(L"登陆验证失败");
+ }
+
+ return res;
+ }
- //登陆验证失败
- }
+ //////////////////////////////////////////////////////////////////2检查许可
+ res = m_pCLM_Login_Scope();
+ if (!res)
+ {
+ //检查许可失败
+ if (g_pLogger) {
+ g_pLogger->SendAndFlushWithTime(L"检查许可失败");
+ }
- //////////////////////////////////////////////////////////////////2检查许可
- res = m_pCLM_Login_Scope();
- if (!res)
- {
- return res;
- //检查许可失败
- }
+ return res;
+ }
- //////////////////////////////////////////////////////////////////3获取许可模块
- UINT16 Mod = 0;//
- UINT16 OnLineType = 0;//许可状态
- res = m_pCLM_ModuleIsLicensed(Mod, OnLineType);
- if (!res)
- {
- return res;
- //登陆验证失败
- }
+ //////////////////////////////////////////////////////////////////3获取许可模块
+ UINT16 Mod = 7;// 对应模块ID,8为模块ID-1, 表示直线电机中间件
+ UINT16 OnLineType = 0;//许可状态
+ res = m_pCLM_ModuleIsLicensed(Mod, OnLineType);
+ if (!res)
+ {
+ //登陆验证失败
+ if (g_pLogger) {
+ g_pLogger->SendAndFlushWithTime(L"登陆验证失败");
+ }
- //////////////////////////////////////////////////////////////////4获取许可最早到期日期
- int ModuleID = 2;
- int Year, Month, Day;
- res = m_pCLM_GetWarrantyExpiration(Month, Day, Year);//获取过期时间
- if (!res)
- {
- return res;
- //登陆验证失败
- }
- return res;
-}
+ return res;
+ }
+
+ //////////////////////////////////////////////////////////////////4获取许可最早到期日期
+ int ModuleID = 2;
+ int Year, Month, Day;
+ res = m_pCLM_GetWarrantyExpiration(Month, Day, Year);//获取过期时间
+ if (!res)
+ {
+ //登陆验证失败
+ if (g_pLogger) {
+ g_pLogger->SendAndFlushWithTime(L"获取过期时间失败");
+ }
+
+ return res;
+ }
+ //打印到期时间
+ CString expirationDate;
+ expirationDate.Format(_T("到期时间为:%d年%d月%d日"), Year, Month, Day);
+ if (g_pLogger) {
+ g_pLogger->SendAndFlushWithTime(expirationDate);
+ }
+
+
+ return res;
+}
\ No newline at end of file
diff --git a/HSI_HexagonMI_EF3/HSI.cpp b/HSI_HexagonMI_EF3/HSI.cpp
index c164a2e..3a6a865 100644
--- a/HSI_HexagonMI_EF3/HSI.cpp
+++ b/HSI_HexagonMI_EF3/HSI.cpp
@@ -1119,6 +1119,23 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_COLLECTPOS(bool isEnable, MOTOR_AXISCHOOES_
}
return rStatus;
}
+
+HSI_API HSI_STATUS WINAPI HSI_ILLUMINATION_SHUTDOWN()
+{
+ auto rStatus = HSI_STATUS_NORMAL;
+ //if (g_pHSI_Illumination)
+ //{
+ // rStatus = g_pHSI_Illumination->Shutdown();
+ // delete g_pHSI_Illumination;
+ // g_pHSI_Illumination = nullptr;
+ //}
+ //else
+ //{
+ // rStatus = HSI_STATUS_FAILED;
+ //}
+ return rStatus;
+}
+
#pragma endregion
#endif // DEBUG
diff --git a/HSI_HexagonMI_EF3/HSI.h b/HSI_HexagonMI_EF3/HSI.h
index 00b074e..aa4cb1c 100644
--- a/HSI_HexagonMI_EF3/HSI.h
+++ b/HSI_HexagonMI_EF3/HSI.h
@@ -492,6 +492,7 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_SPEED_EX(UINT AxisTypes, double& Speed)
HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_ACCELERATION_EX(UINT AxisTypes, double& Accel);
HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_ACCELERATION_EX(UINT AxisTypes, double Accel);
+HSI_API HSI_STATUS WINAPI HSI_ILLUMINATION_SHUTDOWN();
//鏆傛湭瀹炵幇
//HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_MAGNIFICATION(UINT AxisTypes, double mag, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear);
diff --git a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj
index db240b2..373ce94 100644
--- a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj
+++ b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj
@@ -72,7 +72,8 @@
copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)HSI_SEVENOCEAN_EF1_CsTest\bin\Debug\HSI.dll"
copy "$(TargetDir)$(ProjectName).dll" "C:\Program Files\Hexagon\Metus\Metus-7.10.1967\HSI_Sevenocean_EF3.dll"
-copy "$(TargetDir)$(ProjectName).dll" "D:\HSI_Sevenocean_EF3.dll"
+copy "$(TargetDir)$(ProjectName).dll" "D:\HSI_Sevenocean_EF3.dll"
+copy "$(TargetDir)$(ProjectName).dll" "D:\HSI.dll"
version.cmd
diff --git a/HSI_HexagonMI_EF3/HSI_Motion.cpp b/HSI_HexagonMI_EF3/HSI_Motion.cpp
index f2da96b..d670748 100644
--- a/HSI_HexagonMI_EF3/HSI_Motion.cpp
+++ b/HSI_HexagonMI_EF3/HSI_Motion.cpp
@@ -248,14 +248,12 @@ HSI_Motion::HSI_Motion()
// CLMS 鎺堟潈楠岃瘉
if (!CheckLicense())
{
- wprintf(L"Can't find license\n");
//寮圭獥鎻愮ず
- AfxMessageBox(_T("acs metus middleware No authorization found, please contact the corresponding sales"), MB_ICONWARNING | MB_OK);
-
- g_pLogger->SendAndFlushWithTime(L"Acs Middleware No authorization found, Please contact the corresponding sales\n");
-
+ AfxMessageBox(_T("[Check License] Acs-Metus Middleware No Authorization Found, Please Contact the Corresponding Sales"), MB_ICONWARNING | MB_OK);
+ g_pLogger->SendAndFlushWithTime(L"[Check License] Acs-Metus Middleware No Authorization Found, Please Contact the Corresponding Sales\n");
+ return;
}
- g_pLogger->SendAndFlushWithTime(L"Acs Middleware Check License OK\n");
+ g_pLogger->SendAndFlushWithTime(L"[Check License] Acs Middleware Check License OK\n");
//妗d綅鍙傛暟
for (int i = 0; i < 5; i++)
@@ -422,6 +420,14 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
hWnd = _hWnd;
bOfflineOnly = _bOfflineOnly;
+ // CLMS 鎺堟潈楠岃瘉
+ if (!CheckLicense())
+ {
+ // 鎺堟潈楠岃瘉澶辫触
+ g_pLogger->SendAndFlushWithTime(L"[Check License] Acs-Metus Middleware No Authorization Found, Please Contact the Corresponding Sales\n");
+ return HSI_STATUS_FAILED; // 杩斿洖閫傚綋鐨勯敊璇姸鎬
+ }
+
if (!bOfflineOnly)
{
CString GoogolMotionConfigFile(_T(""));
@@ -505,8 +511,8 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
}
#endif
//浣胯兘鐢垫満
- int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 }; //鏍规嵁鐢垫皵灞傞潰瀹氫箟锛岃繖閲岀殑0瀵瑰簲X杞达紝1瀵瑰簲Y杞达紝8瀵瑰簲Z杞
- if (!acsc_EnableM(handleACS, Axes, nullptr))
+ //int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 }; //鏍规嵁鐢垫皵灞傞潰瀹氫箟锛岃繖閲岀殑0瀵瑰簲X杞达紝1瀵瑰簲Y杞达紝8瀵瑰簲Z杞
+ if (!acsc_EnableM(handleACS, ACSAxisNumbers, nullptr))
{
g_pLogger->SendAndFlushWithTime(L"[ACS Motion] ACS Motors Enable Failed!\n");
ErrorsHandler();
@@ -1997,8 +2003,8 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
}
//浣胯兘鐢垫満
- int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 }; //鏍规嵁鐢垫皵灞傞潰瀹氫箟锛岃繖閲岀殑0瀵瑰簲X杞达紝1瀵瑰簲Y杞达紝8瀵瑰簲Z杞
- if (!acsc_EnableM(handleACS, Axes, nullptr))
+ //int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 }; //鏍规嵁鐢垫皵灞傞潰瀹氫箟锛岃繖閲岀殑0瀵瑰簲X杞达紝1瀵瑰簲Y杞达紝8瀵瑰簲Z杞
+ if (!acsc_EnableM(handleACS, ACSAxisNumbers, nullptr))
{
g_pLogger->SendAndFlushWithTime(L"[ACS Motion] ACS Motors Enable Failed!\n");
ErrorsHandler();
@@ -2415,10 +2421,10 @@ HSI_STATUS HSI_Motion::StopJog()
m_WriteByte = Send_Command(0, (const char*)m_SendJogData, m_SendDataLength);
}*/
- int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 };
+ //int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 };
if (handleACS != ACSC_INVALID)
{
- if (!acsc_HaltM(handleACS, Axes, nullptr)) //鍋滄JOG杩愬姩
+ if (!acsc_HaltM(handleACS, ACSAxisNumbers, nullptr)) //鍋滄JOG杩愬姩
{
g_pLogger->SendAndFlushWithTime(L"[StopJog] ACS acsc_HaltM error!\n");
ErrorsHandler();
@@ -2589,7 +2595,7 @@ HSI_STATUS HSI_Motion::GetPositionEncPrfMulti(UINT AxisTypes, double* EncPos, do
CString tempStr;
if (g_pHSI_Motion)
{
- g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] In\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] In\n");
if (m_SO7_Serial.m_RecvData[0] == 2)
{
EncPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[
@@ -2647,9 +2653,9 @@ HSI_STATUS HSI_Motion::GetPositionEncPrfMulti(UINT AxisTypes, double* EncPos, do
PrfPos[2] = m_PrfPos[2];
PrfPos[2] = m_PrfPos[3];
PrfPos[4] = m_PrfPos[4];
- g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] failed\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] failed\n");
}
- g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] Out\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] Out\n");
}
return rStatus;
}
@@ -2751,21 +2757,21 @@ HSI_STATUS HSI_Motion::GetPositionXyz(UINT AxisTypes, double& PositionX, double&
if (g_pHSI_Motion && (handleACS != ACSC_INVALID)) //鍙ユ焺鏈夋晥
{
- if (!acsc_GetFPosition(handleACS, ACSC_AXIS_1, &PositionX, nullptr))
+ if (!acsc_GetFPosition(handleACS, ACSAxisNumbers[0], &PositionX, nullptr))
{
g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] get PositionX failed\n");
ErrorsHandler();
bGetPosition = false;
return HSI_ACS_ERROR;
}
- if (!acsc_GetFPosition(handleACS, ACSC_AXIS_0, &PositionY, nullptr))
+ if (!acsc_GetFPosition(handleACS, ACSAxisNumbers[1], &PositionY, nullptr))
{
g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] get PositionY failed\n");
ErrorsHandler();
bGetPosition = false;
return HSI_ACS_ERROR;
}
- if (!acsc_GetFPosition(handleACS, ACSC_AXIS_8, &PositionZ, nullptr))
+ if (!acsc_GetFPosition(handleACS, ACSAxisNumbers[2], &PositionZ, nullptr))
{
g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] get PositionZ failed\n");
ErrorsHandler();
@@ -2929,568 +2935,568 @@ HSI_STATUS HSI_Motion::GetPositionXyzaProbe(UINT AxisTypes, double& PositionX, d
* \param dFlyRadius
* \return
*/
-//HSI_STATUS HSI_Motion::SetPositionXyzOld(UINT AxisTypes, double PositionX, double PositionY, double PositionZ,
-// HSI_MOTION_MOVE_TYPE eType, double dFlyRadius)
-//{
-// WaitForSingleObject(g_WR_ToMove_Mutex, INFINITE);
-// auto rStatus = HSI_STATUS_NORMAL;
-// if (g_pHSI_Motion)
-// {
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] In\n");
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f\n", PositionX,PositionY, PositionZ);
-// unsigned char send_pos_data[64] = { 0 };
-// axis_start = 0;
-// unsigned char direct_pos = 0;
-// unsigned char xyzAxis = 0;
-// //濡傛灉鐘舵侀潪 杩愬姩涓紝璁剧疆涓鸿繍鍔ㄤ腑
-// if (CurrentMotionState != E_SO7_MOTION_MOVETO)
-// {
-// CurrentMotionState = E_SO7_MOTION_MOVETO;
-// LimitOver(HSI_MOTION_AXIS_X, PositionX);
-// LimitOver(HSI_MOTION_AXIS_Y, PositionY);
-// LimitOver(HSI_MOTION_AXIS_Z, PositionZ);
-// LimitOver(HSI_MOTION_AXIS_R, m_PositionA);
-//
-// m_PosThread[1] = PositionX; //SetpositionXyz鐨勭洰鏍囦綅缃
-// m_PosThread[2] = PositionY;
-// m_PosThread[3] = PositionZ;
-// m_PosThread[4] = m_PositionA;
-//
-// targetpos_n[1] = PositionX;
-// targetpos_n[2] = PositionY;
-// targetpos_n[3] = PositionZ;
-// targetpos_n[4] = m_PositionA;
-//
-// int Pos_t[5] = { 0 };
-// int Pos_n[5] = { 0 };
-// int Pos[5] = { 0 };
-// int NowPos[5] = { 0 };
-// int target_pos[5] = { 0 };
-//
-// if (m_SO7_Serial.m_RecvData[0] == 2)
-// {
-// //鏍规嵁璁惧绫诲瀷鑾峰彇鐜板湪浣嶇疆
-// if (m_DeviceType != 1) //璁惧绫诲瀷闈炰笁婵鍏
-// {
-// if (m_IsHavePattern & 0x01 == 0x01)
-// NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.
-// m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]);
-// else
-// NowPos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 |
-// m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]);
-// if (m_IsHavePattern & 0x02)
-// NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.
-// m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]);
-// else
-// NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 |
-// m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]);
-// if (m_IsHavePattern & 0x04)
-// NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial
-// .m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]);
-// else
-// NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 |
-// m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]);
-// if (m_IsHavePattern & 0x08)
-// NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 |
-// m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]);
-// else
-// NowPos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 |
-// m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]);
-// }
-// else
-// {
-// NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.
-// m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]);
-// NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.
-// m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]);
-// NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.
-// m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]);
-// NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.
-// m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]);
-// }
-// //NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]);
-// //NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]);
-// //NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]);
-// //NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]);
-//
-// Pos_t[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.
-// m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]);
-// Pos_t[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.
-// m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]);
-// Pos_t[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.
-// m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]);
-// Pos_t[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.
-// m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]);
-// }
-// else
-// {
-// /* 缂栬瘧鍣ㄩ殣寮忔墽琛岀殑浠讳綍绫诲瀷杞崲閮藉彲浠ョ敱static_cast鏄惧紡瀹屾垚銆
-// static_cast鍙互鐢ㄦ潵灏嗘灇涓剧被鍨嬭浆鎹㈡垚鏁村瀷锛屾垨鑰呮暣鍨嬭浆鎹㈡垚娴偣鍨*/
-// Pos_t[1] = NowPos[1] = static_cast(m_EncPos[1] / m_Resolution[1]);
-// Pos_t[2] = NowPos[2] = static_cast(m_EncPos[2] / m_Resolution[2]);
-// Pos_t[3] = NowPos[3] = static_cast(m_EncPos[3] / m_Resolution[3]);
-// Pos_t[4] = NowPos[4] = static_cast(m_EncPos[4] / m_Resolution[4]);
-// }
-//
-// if (m_motorType & 0x01) //姝ヨ繘鐢垫満
-// Pos[1] = static_cast(PositionX / m_Resolution[1]) - NowPos[1];
-// else
-// Pos[1] = static_cast(PositionX / m_Resolution[1]) - Pos_t[1];
-// if (m_motorType & 0x02) //姝ヨ繘鐢垫満
-// Pos[2] = static_cast(PositionX / m_Resolution[2]) - NowPos[2];
-// else
-// Pos[2] = static_cast(PositionY / m_Resolution[2]) - Pos_t[2];
-// if (m_motorType & 0x04) //姝ヨ繘鐢垫満
-// Pos[3] = static_cast(PositionX / m_Resolution[3]) - NowPos[3];
-// else
-// Pos[3] = static_cast(PositionZ / m_Resolution[3]) - Pos_t[3];
-// if (m_motorType & 0x08) //姝ヨ繘鐢垫満
-// Pos[4] = static_cast(PositionX / m_Resolution[4]) - NowPos[4];
-// else
-// Pos[4] = static_cast(m_PositionA / m_Resolution[4]) - Pos_t[4];
-//
-// /*if (m_motorType==1)
-// {
-// if (m_IsUse_HSICompensation)
-// {
-// }
-// else
-// {
-// Pos[1] = (int)(PositionX / m_Resolution[1]) - NowPos[1];
-// Pos[2] = (int)(PositionY / m_Resolution[2]) - NowPos[2];
-// Pos[3] = (int)(PositionZ / m_Resolution[3]) - NowPos[3];
-// Pos[4] = (int)(m_PositionA / m_Resolution[4]) - NowPos[4];
-// }
-// }
-// else
-// {
-// Pos_n[1] = (int)(targetpos_n[1] / m_Resolution[1]) - NowPos[1];
-// Pos_n[2] = (int)(targetpos_n[2] / m_Resolution[2]) - NowPos[2];
-// Pos_n[3] = (int)(targetpos_n[3] / m_Resolution[3]) - NowPos[3];
-//
-// Pos_t[1] = (int)(targetpos_n[1] / m_Resolution[1]) - (int)(targetpos_l[1] / m_Resolution[1]);
-// Pos_t[2] = (int)(targetpos_n[2] / m_Resolution[2]) - (int)(targetpos_l[2] / m_Resolution[1]);
-// Pos_t[3] = (int)(targetpos_n[3] / m_Resolution[3]) - (int)(targetpos_l[3] / m_Resolution[1]);
-//
-// if (m_IsUse_HSICompensation)
-// {
-// for (int k = 1; k < 4; k++)
-// {
-// if (abs(Pos_n[k] - Pos_t[k]) > m_Compensation_Pluse)
-// {
-// Pos[k] = Pos_n[k];
-// }
-// else
-// {
-// Pos[k] = Pos_t[k];
-// }
-// if (abs(Pos[k]) < m_Compensation_Pluse)
-// {
-// Pos[k] = 0;
-// }
-// }
-// }
-// else
-// {
-// Pos[1] = (int)(PositionX / m_Resolution[1]) - NowPos[1];
-// Pos[2] = (int)(PositionY / m_Resolution[2]) - NowPos[2];
-// Pos[3] = (int)(PositionZ / m_Resolution[3]) - NowPos[3];
-// Pos[4] = (int)(m_PositionA / m_Resolution[4]) - NowPos[4];
-// }
-// }*/
-// target_pos[1] = static_cast(PositionX / m_Resolution[1]); //璁$畻鍒扮洰鏍囦綅缃
-// target_pos[2] = static_cast(PositionY / m_Resolution[2]);
-// target_pos[3] = static_cast(PositionZ / m_Resolution[3]);
-// target_pos[4] = static_cast(m_PositionA / m_Resolution[4]);
-//
-// begin_position[1] = target_pos[1]; //灏嗙洰鏍囦綅缃缃负 寮濮嬩綅缃
-// begin_position[2] = target_pos[2];
-// begin_position[3] = target_pos[3];
-// begin_position[4] = target_pos[4];
-//
-// float scale[4] = { 0 };
-// int Stepdriverspeed[5] = { 0 };
-// int StepStartspeed[5] = { 0 };
-// int StepAcc[5] = { 0 };
-// //if (Pos[1] > 0) direct_pos |= 0x01;
-// //if (Pos[2] > 0) direct_pos |= 0x02;
-// //if (Pos[3] > 0) direct_pos |= 0x04;
-// if (abs(Pos[1]) > 2) axis_start |= 0x01;
-// if (abs(Pos[2]) > 2) axis_start |= 0x02;
-// if (abs(Pos[3]) > 2) axis_start |= 0x04;
-// int MaxPos = abs(Pos[1]);
-// for (int i = 2; i < 5; i++)
-// {
-// if (MaxPos < abs(Pos[i]))
-// {
-// MaxPos = abs(Pos[i]);
-// }
-// }
-// //MaxPos = abs(MaxPos);
-// scale[0] = abs(Pos[1]) / static_cast(MaxPos);
-// scale[1] = abs(Pos[2]) / static_cast(MaxPos);
-// scale[2] = abs(Pos[3]) / static_cast(MaxPos);
-// scale[3] = abs(Pos[4]) / static_cast(MaxPos);
-//
-// g_pLogger->SendAndFlushWithTime(
-// L"[SetPositionXyzNowPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n",
-// NowPos[1] * m_Resolution[1], NowPos[2] * m_Resolution[2], NowPos[3] * m_Resolution[3],
-// NowPos[4] * m_Resolution[4]);
-// g_pLogger->SendAndFlushWithTime(
-// L"[SetPositionXyzTagPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n", PositionX,
-// PositionY, PositionZ, m_PositionA);
-//
-// int stepinterpolation = 0x03;
-// //if (!m_motorType)
-// //{
-// // /*if ((stepinterpolation & 0x01) && m_IsUseManualRunin)
-// // {
-// // Stepdriverspeed[1] = m_SetPotion_DriveSpeed[1] * scale[0];
-// // if (Stepdriverspeed[1] < m_SetPotion_StartSpeed[1])
-// // {
-// // Stepdriverspeed[1] = m_SetPotion_StartSpeed[1];
-// // }
-// // }
-// // else
-// // {
-// // Stepdriverspeed[1] = m_SetPotion_DriveSpeed[1];
-// // }
-// // if ((stepinterpolation & 0x02) && m_IsUseManualRunin)
-// // {
-// // Stepdriverspeed[2] = m_SetPotion_DriveSpeed[2] * scale[1];
-// // if (Stepdriverspeed[2] < m_SetPotion_StartSpeed[2])
-// // {
-// // Stepdriverspeed[2] = m_SetPotion_StartSpeed[2];
-// // }
-// // }
-// // else
-// // {
-// // Stepdriverspeed[2] = m_SetPotion_DriveSpeed[2];
-// // }
-// // if ((stepinterpolation & 0x04) && m_IsUseManualRunin)
-// // {
-// // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3] * scale[2];
-// // if (Stepdriverspeed[3] < m_SetPotion_StartSpeed[3])
-// // {
-// // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3];
-// // }
-// // }
-// // else
-// // {
-// // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3];
-// // }
-// // if ((stepinterpolation & 0x08) && m_IsUseManualRunin)
-// // {
-// // Stepdriverspeed[4] = m_SetPotion_DriveSpeed[4] * scale[3];
-// // if (Stepdriverspeed[4] < m_SetPotion_StartSpeed[4])
-// // {
-// // Stepdriverspeed[4] = m_SetPotion_DriveSpeed[4];
-// // }
-// // }
-// // else
-// // {
-// // Stepdriverspeed[4] = m_SetPotion_DriveSpeed[4];
-// // }*/
-// // for (int i = 1; i < 3; i++)
-// // {
-// // if (abs(Pos[i]) < m_stepPosition_Load[0])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[0];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[0];
-// // StepAcc[i] = m_stepPosition_acc[0];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[1])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[1];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[1];
-// // StepAcc[i] = m_stepPosition_acc[1];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[2])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[2];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[2];
-// // StepAcc[i] = m_stepPosition_acc[2];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[3])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[3];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[3];
-// // StepAcc[i] = m_stepPosition_acc[3];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[4])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[4];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[4];
-// // StepAcc[i] = m_stepPosition_acc[4];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[5])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[5];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[5];
-// // StepAcc[i] = m_stepPosition_acc[5];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[6])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[6];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[6];
-// // StepAcc[i] = m_stepPosition_acc[6];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[7])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[7];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[7];
-// // StepAcc[i] = m_stepPosition_acc[7];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[8])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[8];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[8];
-// // StepAcc[i] = m_stepPosition_acc[8];
-// // }
-// // else if (abs(Pos[i]) < m_stepPosition_Load[9])
-// // {
-// // StepStartspeed[i] = m_stepPosition_L_speed[9];
-// // Stepdriverspeed[i] = m_stepPosition_H_speed[9];
-// // StepAcc[i] = m_stepPosition_acc[9];
-// // }
-// // else
-// // {
-// // StepStartspeed[i] = m_SetPotion_StartSpeed[i];
-// // Stepdriverspeed[i] = m_SetPotion_DriveSpeed[i];
-// // StepAcc[i] = m_SetPotion_Line[i];
-// // }
-// // }
-// // StepStartspeed[3] = m_SetPotion_StartSpeed[3];
-// // StepAcc[3] = m_SetPotion_Line[3];
-// // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3];
-// //}
-//
-// int axisCount = 4;
-// if (fourthAxisFlag) //绗4杞
-// {
-// fourthAxisFlag = false;
-// if (Pos[4] > 0) direct_pos |= 0x08;
-// if (abs(Pos[4]) > 20) axis_start |= 0x08;
-// axisCount = 5;
-// xyzAxis = AXIS_XYZU;
-// }
-// else
-// {
-// xyzAxis = AXIS_XYZ;
-// }
-//
-// //璁剧疆杩愬姩鍙傛暟
-// for (int i = 1; i < axisCount; i++)
-// {
-// int time_out_send = 0;
-//
-// send_pos_data[0] = CT_MOTOR;
-// send_pos_data[1] = CT_MOTOR_SET;
-// send_pos_data[2] = 1 << (i - 1);
-// send_pos_data[3] = POSITION_SPEED_ACC_DEC_POS;
-// /*if (m_motorType == 1)
-// {*/
-// send_pos_data[4] = (m_SetPotion_StartSpeed[i] & 0xff);
-// send_pos_data[5] = ((m_SetPotion_StartSpeed[i] >> 8) & 0xff);
-// send_pos_data[6] = ((m_SetPotion_StartSpeed[i] >> 16) & 0xff);
-// send_pos_data[7] = ((m_SetPotion_StartSpeed[i] >> 24) & 0xff);
-// if ((xyzAxis == AXIS_XYZU) && (m_IsUseFourthSpeed == 1))
-// {
-// send_pos_data[8] = (m_SetPotion_DriveSpeed[4] & 0xff);
-// send_pos_data[9] = ((m_SetPotion_DriveSpeed[4] >> 8) & 0xff);
-// send_pos_data[10] = ((m_SetPotion_DriveSpeed[4] >> 16) & 0xff);
-// send_pos_data[11] = ((m_SetPotion_DriveSpeed[4] >> 24) & 0xff);
-// }
-// else
-// {
-// send_pos_data[8] = (m_SetPotion_DriveSpeed[i] & 0xff);
-// send_pos_data[9] = ((m_SetPotion_DriveSpeed[i] >> 8) & 0xff);
-// send_pos_data[10] = ((m_SetPotion_DriveSpeed[i] >> 16) & 0xff);
-// send_pos_data[11] = ((m_SetPotion_DriveSpeed[i] >> 24) & 0xff);
-// }
-// send_pos_data[12] = (m_SetPotion_Line[i] & 0xff);
-// send_pos_data[13] = ((m_SetPotion_Line[i] >> 8) & 0xff);
-// send_pos_data[14] = ((m_SetPotion_Line[i] >> 16) & 0xff);
-// send_pos_data[15] = ((m_SetPotion_Line[i] >> 24) & 0xff);
-//
-// send_pos_data[16] = (m_SetPotion_Buffer[i] & 0xff);
-// send_pos_data[17] = ((m_SetPotion_Buffer[i] >> 8) & 0xff);
-// send_pos_data[18] = ((m_SetPotion_Buffer[i] >> 16) & 0xff);
-// send_pos_data[19] = ((m_SetPotion_Buffer[i] >> 24) & 0xff);
-//
-// send_pos_data[28] = (target_pos[i] & 0xff);
-// send_pos_data[29] = ((target_pos[i] >> 8) & 0xff);
-// send_pos_data[30] = ((target_pos[i] >> 16) & 0xff);
-// send_pos_data[31] = ((target_pos[i] >> 24) & 0xff);
-//
-// send_pos_data[32] = (Pos[i] & 0xff);
-// send_pos_data[33] = ((Pos[i] >> 8) & 0xff);
-// send_pos_data[34] = ((Pos[i] >> 16) & 0xff);
-// send_pos_data[35] = ((Pos[i] >> 24) & 0xff);
-//
-// g_pLogger->SendAndFlushWithTime(
-// L"[SetPositionXyz] m_SetPotion_StartSpeed[%d] = %d,m_SetPotion_DriveSpeed[%d] = %d\n", i,
-// m_SetPotion_StartSpeed[i], i, m_SetPotion_DriveSpeed[i]);
-// //send_pos_data[32] = 0x21;
-// /*}*/
-//
-// /*else
-// {
-// send_pos_data[4] = (StepStartspeed[i] & 0xff);
-// send_pos_data[5] = ((StepStartspeed[i] >> 8) & 0xff);
-// send_pos_data[6] = ((StepStartspeed[i] >> 16) & 0xff);
-// send_pos_data[7] = ((StepStartspeed[i] >> 24) & 0xff);
-//
-// send_pos_data[8] = (Stepdriverspeed[i] & 0xff);
-// send_pos_data[9] = ((Stepdriverspeed[i] >> 8) & 0xff);
-// send_pos_data[10] = ((Stepdriverspeed[i] >> 16) & 0xff);
-// send_pos_data[11] = ((Stepdriverspeed[i] >> 24) & 0xff);
-//
-// send_pos_data[12] = (StepAcc[i] & 0xff);
-// send_pos_data[13] = ((StepAcc[i] >> 8) & 0xff);
-// send_pos_data[14] = ((StepAcc[i] >> 16) & 0xff);
-// send_pos_data[15] = ((StepAcc[i] >> 24) & 0xff);
-//
-// send_pos_data[16] = (m_SetPotion_Buffer[i] & 0xff);
-// send_pos_data[17] = ((m_SetPotion_Buffer[i] >> 8) & 0xff);
-// send_pos_data[18] = ((m_SetPotion_Buffer[i] >> 16) & 0xff);
-// send_pos_data[19] = ((m_SetPotion_Buffer[i] >> 24) & 0xff);
-//
-// send_pos_data[28] = (target_pos[i] & 0xff);
-// send_pos_data[29] = ((target_pos[i] >> 8) & 0xff);
-// send_pos_data[30] = ((target_pos[i] >> 16) & 0xff);
-// send_pos_data[31] = ((target_pos[i] >> 24) & 0xff);
-//
-// send_pos_data[32] = (Pos[i] & 0xff);
-// send_pos_data[33] = ((Pos[i] >> 8) & 0xff);
-// send_pos_data[34] = ((Pos[i] >> 16) & 0xff);
-// send_pos_data[35] = ((Pos[i] >> 24) & 0xff);
-//
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] m_SetPotion_StartSpeed[%d] = %d,m_SetPotion_DriveSpeed[%d] = %d\n", i, m_SetPotion_StartSpeed[i], i, m_SetPotion_DriveSpeed[i]);
-// }*/
-// m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength);
-// Sleep(6);
-// }
-//
-// //娓呴櫎缂撳瓨浣嶇疆
-// while (m_SO7_Serial.m_RecvData[39])
-// {
-// send_pos_data[0] = CT_ORDER;
-// send_pos_data[1] = CT_POSFLAG_CLEAR;
-// m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength);
-// Sleep(10);
-// }
-//
-// Sleep(10);
-// //鍚姩鎻掕ˉ鍜屽畾浣嶅姛鑳
-// /* if (m_motorType == 1)
-// {
-// send_pos_data[0] = CT_MOTOR;
-// send_pos_data[1] = CT_START_POSITION;
-// send_pos_data[2] = xyzAxis;
-// send_pos_data[3] = 0x53;
-// send_pos_data[4] = INTERPOLATION;
-// }
-// else
-// {*/
-// send_pos_data[0] = CT_MOTOR;
-// send_pos_data[1] = CT_START_POSITION;
-// send_pos_data[2] = axis_start;
-// send_pos_data[3] = 0x53;
-// send_pos_data[4] = m_motorType & 0xff;
-// /* }*/
-// for (int j = 1; j < axisCount; j++)
-// {
-// send_pos_data[9 + 4 * (j - 1)] = (target_pos[j] & 0xff);
-// send_pos_data[10 + 4 * (j - 1)] = ((target_pos[j] >> 8) & 0xff);
-// send_pos_data[11 + 4 * (j - 1)] = ((target_pos[j] >> 16) & 0xff);
-// send_pos_data[12 + 4 * (j - 1)] = ((target_pos[j] >> 24) & 0xff);
-// }
-// //send_pos_data[25] = direct_pos;
-// int stepmotoracc = 0;
-// stepmotoracc = CaculateStepMotorACC(Pos[1], m_SetPotion_Line[1], 10);
-// send_pos_data[25] = stepmotoracc;
-// stepmotoracc = CaculateStepMotorACC(Pos[2], m_SetPotion_Line[2], 10);
-// send_pos_data[26] = stepmotoracc;
-// stepmotoracc = CaculateStepMotorACC(Pos[3], m_SetPotion_Line[3], 10);
-// send_pos_data[27] = stepmotoracc;
-// stepmotoracc = CaculateStepMotorACC(Pos[4], m_SetPotion_Line[4], 10);
-// /*send_pos_data[25] = m_SetPotion_Line[1];
-// send_pos_data[26] = m_SetPotion_Line[2];
-// send_pos_data[27] = m_SetPotion_Line[3];
-// send_pos_data[28] = m_SetPotion_Line[4];*/
-//
-// send_pos_data[29] = m_SpeedAdjustPeriod[1];
-// send_pos_data[30] = m_SpeedAdjustPeriod[2];
-// send_pos_data[31] = m_SpeedAdjustPeriod[3];
-// send_pos_data[32] = m_SpeedAdjustPeriod[4];
-//
-// for (size_t i = 1; i < 5; i++)
-// {
-// Stepdriverspeed[i] = m_SetPotion_DriveSpeed[i] * m_Resolution[i] * 50;
-// }
-//
-// send_pos_data[33] = (Stepdriverspeed[1] >> 8) & 0xff;
-// send_pos_data[34] = Stepdriverspeed[1] & 0xff;
-// send_pos_data[35] = (Stepdriverspeed[2] >> 8) & 0xff;
-// send_pos_data[36] = Stepdriverspeed[2] & 0xff;
-// send_pos_data[37] = (Stepdriverspeed[3] >> 8) & 0xff;
-// send_pos_data[38] = Stepdriverspeed[3] & 0xff;
-// send_pos_data[39] = (Stepdriverspeed[4] >> 8) & 0xff;
-// send_pos_data[40] = Stepdriverspeed[4] & 0xff;
-//
-// if (bCircleRun) //鍦嗗姬鎻掕ˉ
-// {
-// bCircleRun = false;
-// send_pos_data[1] = CT_CIRCLERUN_POSITION;
-// send_pos_data[2] = 0x03;
-// send_pos_data[4] = CIRCLER;
-// for (size_t i = 1; i < 3; i++)
-// {
-// iCircleRunPnt[i] = iCircleRunPnt[i] - NowPos[i];
-// send_pos_data[26 + 4 * (i - 1)] = (iCircleRunPnt[i] & 0xff);
-// send_pos_data[27 + 4 * (i - 1)] = ((iCircleRunPnt[i] >> 8) & 0xff);
-// send_pos_data[28 + 4 * (i - 1)] = ((iCircleRunPnt[i] >> 16) & 0xff);
-// send_pos_data[29 + 4 * (i - 1)] = ((iCircleRunPnt[i] >> 24) & 0xff);
-// }
-// }
-// g_IsClose = false;
-// m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength);
-// set_start = GetTickCount();
-// Sleep(3); //
-// if (eType == HSI_MOTION_MOVE_NOWAIT)
-// {
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Nowait SetEvent\n");
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Nowait move!\n");
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out Success Nowait\n");
-// m_IsExMotion = 0;
-// bRunGlueDispenser = HSI_THREAD_PAUSED;
-// m_Thread_State = HSI_THREAD_RUNNING;
-// SetEvent(m_hTriggerEvent);
-// }
-// if (eType == HSI_MOTION_MOVE_WAIT)
-// {
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out Success Wait Mode\n");
-// m_Thread_State = HSI_THREAD_RUNNING;
-// m_IsExMotion = 0;
-// UpdateMotionState();
-// m_Thread_State = HSI_THREAD_PAUSED;
-// }
-// }
-// else
-// {
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] HSI_STATUS_MOTION_MOVING\n");
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out\n");
-// rStatus = HSI_STATUS_MOTION_MOVING;
-// }
-// g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out\n");
-// targetpos_l[1] = PositionX;
-// targetpos_l[2] = PositionY;
-// targetpos_l[3] = PositionZ;
-// }
-// ReleaseMutex(g_WR_ToMove_Mutex);
-// return rStatus;
-//}
+ //HSI_STATUS HSI_Motion::SetPositionXyzOld(UINT AxisTypes, double PositionX, double PositionY, double PositionZ,
+ // HSI_MOTION_MOVE_TYPE eType, double dFlyRadius)
+ //{
+ // WaitForSingleObject(g_WR_ToMove_Mutex, INFINITE);
+ // auto rStatus = HSI_STATUS_NORMAL;
+ // if (g_pHSI_Motion)
+ // {
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] In\n");
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f\n", PositionX,PositionY, PositionZ);
+ // unsigned char send_pos_data[64] = { 0 };
+ // axis_start = 0;
+ // unsigned char direct_pos = 0;
+ // unsigned char xyzAxis = 0;
+ // //濡傛灉鐘舵侀潪 杩愬姩涓紝璁剧疆涓鸿繍鍔ㄤ腑
+ // if (CurrentMotionState != E_SO7_MOTION_MOVETO)
+ // {
+ // CurrentMotionState = E_SO7_MOTION_MOVETO;
+ // LimitOver(HSI_MOTION_AXIS_X, PositionX);
+ // LimitOver(HSI_MOTION_AXIS_Y, PositionY);
+ // LimitOver(HSI_MOTION_AXIS_Z, PositionZ);
+ // LimitOver(HSI_MOTION_AXIS_R, m_PositionA);
+ //
+ // m_PosThread[1] = PositionX; //SetpositionXyz鐨勭洰鏍囦綅缃
+ // m_PosThread[2] = PositionY;
+ // m_PosThread[3] = PositionZ;
+ // m_PosThread[4] = m_PositionA;
+ //
+ // targetpos_n[1] = PositionX;
+ // targetpos_n[2] = PositionY;
+ // targetpos_n[3] = PositionZ;
+ // targetpos_n[4] = m_PositionA;
+ //
+ // int Pos_t[5] = { 0 };
+ // int Pos_n[5] = { 0 };
+ // int Pos[5] = { 0 };
+ // int NowPos[5] = { 0 };
+ // int target_pos[5] = { 0 };
+ //
+ // if (m_SO7_Serial.m_RecvData[0] == 2)
+ // {
+ // //鏍规嵁璁惧绫诲瀷鑾峰彇鐜板湪浣嶇疆
+ // if (m_DeviceType != 1) //璁惧绫诲瀷闈炰笁婵鍏
+ // {
+ // if (m_IsHavePattern & 0x01 == 0x01)
+ // NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.
+ // m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]);
+ // else
+ // NowPos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 |
+ // m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]);
+ // if (m_IsHavePattern & 0x02)
+ // NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.
+ // m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]);
+ // else
+ // NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 |
+ // m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]);
+ // if (m_IsHavePattern & 0x04)
+ // NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial
+ // .m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]);
+ // else
+ // NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 |
+ // m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]);
+ // if (m_IsHavePattern & 0x08)
+ // NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 |
+ // m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]);
+ // else
+ // NowPos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 |
+ // m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]);
+ // }
+ // else
+ // {
+ // NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.
+ // m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]);
+ // NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.
+ // m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]);
+ // NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.
+ // m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]);
+ // NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.
+ // m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]);
+ // }
+ // //NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]);
+ // //NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]);
+ // //NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]);
+ // //NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]);
+ //
+ // Pos_t[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.
+ // m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]);
+ // Pos_t[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.
+ // m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]);
+ // Pos_t[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.
+ // m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]);
+ // Pos_t[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.
+ // m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]);
+ // }
+ // else
+ // {
+ // /* 缂栬瘧鍣ㄩ殣寮忔墽琛岀殑浠讳綍绫诲瀷杞崲閮藉彲浠ョ敱static_cast鏄惧紡瀹屾垚銆
+ // static_cast鍙互鐢ㄦ潵灏嗘灇涓剧被鍨嬭浆鎹㈡垚鏁村瀷锛屾垨鑰呮暣鍨嬭浆鎹㈡垚娴偣鍨*/
+ // Pos_t[1] = NowPos[1] = static_cast(m_EncPos[1] / m_Resolution[1]);
+ // Pos_t[2] = NowPos[2] = static_cast(m_EncPos[2] / m_Resolution[2]);
+ // Pos_t[3] = NowPos[3] = static_cast(m_EncPos[3] / m_Resolution[3]);
+ // Pos_t[4] = NowPos[4] = static_cast(m_EncPos[4] / m_Resolution[4]);
+ // }
+ //
+ // if (m_motorType & 0x01) //姝ヨ繘鐢垫満
+ // Pos[1] = static_cast(PositionX / m_Resolution[1]) - NowPos[1];
+ // else
+ // Pos[1] = static_cast(PositionX / m_Resolution[1]) - Pos_t[1];
+ // if (m_motorType & 0x02) //姝ヨ繘鐢垫満
+ // Pos[2] = static_cast(PositionX / m_Resolution[2]) - NowPos[2];
+ // else
+ // Pos[2] = static_cast(PositionY / m_Resolution[2]) - Pos_t[2];
+ // if (m_motorType & 0x04) //姝ヨ繘鐢垫満
+ // Pos[3] = static_cast(PositionX / m_Resolution[3]) - NowPos[3];
+ // else
+ // Pos[3] = static_cast(PositionZ / m_Resolution[3]) - Pos_t[3];
+ // if (m_motorType & 0x08) //姝ヨ繘鐢垫満
+ // Pos[4] = static_cast(PositionX / m_Resolution[4]) - NowPos[4];
+ // else
+ // Pos[4] = static_cast(m_PositionA / m_Resolution[4]) - Pos_t[4];
+ //
+ // /*if (m_motorType==1)
+ // {
+ // if (m_IsUse_HSICompensation)
+ // {
+ // }
+ // else
+ // {
+ // Pos[1] = (int)(PositionX / m_Resolution[1]) - NowPos[1];
+ // Pos[2] = (int)(PositionY / m_Resolution[2]) - NowPos[2];
+ // Pos[3] = (int)(PositionZ / m_Resolution[3]) - NowPos[3];
+ // Pos[4] = (int)(m_PositionA / m_Resolution[4]) - NowPos[4];
+ // }
+ // }
+ // else
+ // {
+ // Pos_n[1] = (int)(targetpos_n[1] / m_Resolution[1]) - NowPos[1];
+ // Pos_n[2] = (int)(targetpos_n[2] / m_Resolution[2]) - NowPos[2];
+ // Pos_n[3] = (int)(targetpos_n[3] / m_Resolution[3]) - NowPos[3];
+ //
+ // Pos_t[1] = (int)(targetpos_n[1] / m_Resolution[1]) - (int)(targetpos_l[1] / m_Resolution[1]);
+ // Pos_t[2] = (int)(targetpos_n[2] / m_Resolution[2]) - (int)(targetpos_l[2] / m_Resolution[1]);
+ // Pos_t[3] = (int)(targetpos_n[3] / m_Resolution[3]) - (int)(targetpos_l[3] / m_Resolution[1]);
+ //
+ // if (m_IsUse_HSICompensation)
+ // {
+ // for (int k = 1; k < 4; k++)
+ // {
+ // if (abs(Pos_n[k] - Pos_t[k]) > m_Compensation_Pluse)
+ // {
+ // Pos[k] = Pos_n[k];
+ // }
+ // else
+ // {
+ // Pos[k] = Pos_t[k];
+ // }
+ // if (abs(Pos[k]) < m_Compensation_Pluse)
+ // {
+ // Pos[k] = 0;
+ // }
+ // }
+ // }
+ // else
+ // {
+ // Pos[1] = (int)(PositionX / m_Resolution[1]) - NowPos[1];
+ // Pos[2] = (int)(PositionY / m_Resolution[2]) - NowPos[2];
+ // Pos[3] = (int)(PositionZ / m_Resolution[3]) - NowPos[3];
+ // Pos[4] = (int)(m_PositionA / m_Resolution[4]) - NowPos[4];
+ // }
+ // }*/
+ // target_pos[1] = static_cast(PositionX / m_Resolution[1]); //璁$畻鍒扮洰鏍囦綅缃
+ // target_pos[2] = static_cast(PositionY / m_Resolution[2]);
+ // target_pos[3] = static_cast(PositionZ / m_Resolution[3]);
+ // target_pos[4] = static_cast(m_PositionA / m_Resolution[4]);
+ //
+ // begin_position[1] = target_pos[1]; //灏嗙洰鏍囦綅缃缃负 寮濮嬩綅缃
+ // begin_position[2] = target_pos[2];
+ // begin_position[3] = target_pos[3];
+ // begin_position[4] = target_pos[4];
+ //
+ // float scale[4] = { 0 };
+ // int Stepdriverspeed[5] = { 0 };
+ // int StepStartspeed[5] = { 0 };
+ // int StepAcc[5] = { 0 };
+ // //if (Pos[1] > 0) direct_pos |= 0x01;
+ // //if (Pos[2] > 0) direct_pos |= 0x02;
+ // //if (Pos[3] > 0) direct_pos |= 0x04;
+ // if (abs(Pos[1]) > 2) axis_start |= 0x01;
+ // if (abs(Pos[2]) > 2) axis_start |= 0x02;
+ // if (abs(Pos[3]) > 2) axis_start |= 0x04;
+ // int MaxPos = abs(Pos[1]);
+ // for (int i = 2; i < 5; i++)
+ // {
+ // if (MaxPos < abs(Pos[i]))
+ // {
+ // MaxPos = abs(Pos[i]);
+ // }
+ // }
+ // //MaxPos = abs(MaxPos);
+ // scale[0] = abs(Pos[1]) / static_cast(MaxPos);
+ // scale[1] = abs(Pos[2]) / static_cast(MaxPos);
+ // scale[2] = abs(Pos[3]) / static_cast(MaxPos);
+ // scale[3] = abs(Pos[4]) / static_cast(MaxPos);
+ //
+ // g_pLogger->SendAndFlushWithTime(
+ // L"[SetPositionXyzNowPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n",
+ // NowPos[1] * m_Resolution[1], NowPos[2] * m_Resolution[2], NowPos[3] * m_Resolution[3],
+ // NowPos[4] * m_Resolution[4]);
+ // g_pLogger->SendAndFlushWithTime(
+ // L"[SetPositionXyzTagPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n", PositionX,
+ // PositionY, PositionZ, m_PositionA);
+ //
+ // int stepinterpolation = 0x03;
+ // //if (!m_motorType)
+ // //{
+ // // /*if ((stepinterpolation & 0x01) && m_IsUseManualRunin)
+ // // {
+ // // Stepdriverspeed[1] = m_SetPotion_DriveSpeed[1] * scale[0];
+ // // if (Stepdriverspeed[1] < m_SetPotion_StartSpeed[1])
+ // // {
+ // // Stepdriverspeed[1] = m_SetPotion_StartSpeed[1];
+ // // }
+ // // }
+ // // else
+ // // {
+ // // Stepdriverspeed[1] = m_SetPotion_DriveSpeed[1];
+ // // }
+ // // if ((stepinterpolation & 0x02) && m_IsUseManualRunin)
+ // // {
+ // // Stepdriverspeed[2] = m_SetPotion_DriveSpeed[2] * scale[1];
+ // // if (Stepdriverspeed[2] < m_SetPotion_StartSpeed[2])
+ // // {
+ // // Stepdriverspeed[2] = m_SetPotion_StartSpeed[2];
+ // // }
+ // // }
+ // // else
+ // // {
+ // // Stepdriverspeed[2] = m_SetPotion_DriveSpeed[2];
+ // // }
+ // // if ((stepinterpolation & 0x04) && m_IsUseManualRunin)
+ // // {
+ // // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3] * scale[2];
+ // // if (Stepdriverspeed[3] < m_SetPotion_StartSpeed[3])
+ // // {
+ // // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3];
+ // // }
+ // // }
+ // // else
+ // // {
+ // // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3];
+ // // }
+ // // if ((stepinterpolation & 0x08) && m_IsUseManualRunin)
+ // // {
+ // // Stepdriverspeed[4] = m_SetPotion_DriveSpeed[4] * scale[3];
+ // // if (Stepdriverspeed[4] < m_SetPotion_StartSpeed[4])
+ // // {
+ // // Stepdriverspeed[4] = m_SetPotion_DriveSpeed[4];
+ // // }
+ // // }
+ // // else
+ // // {
+ // // Stepdriverspeed[4] = m_SetPotion_DriveSpeed[4];
+ // // }*/
+ // // for (int i = 1; i < 3; i++)
+ // // {
+ // // if (abs(Pos[i]) < m_stepPosition_Load[0])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[0];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[0];
+ // // StepAcc[i] = m_stepPosition_acc[0];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[1])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[1];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[1];
+ // // StepAcc[i] = m_stepPosition_acc[1];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[2])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[2];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[2];
+ // // StepAcc[i] = m_stepPosition_acc[2];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[3])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[3];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[3];
+ // // StepAcc[i] = m_stepPosition_acc[3];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[4])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[4];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[4];
+ // // StepAcc[i] = m_stepPosition_acc[4];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[5])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[5];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[5];
+ // // StepAcc[i] = m_stepPosition_acc[5];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[6])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[6];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[6];
+ // // StepAcc[i] = m_stepPosition_acc[6];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[7])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[7];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[7];
+ // // StepAcc[i] = m_stepPosition_acc[7];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[8])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[8];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[8];
+ // // StepAcc[i] = m_stepPosition_acc[8];
+ // // }
+ // // else if (abs(Pos[i]) < m_stepPosition_Load[9])
+ // // {
+ // // StepStartspeed[i] = m_stepPosition_L_speed[9];
+ // // Stepdriverspeed[i] = m_stepPosition_H_speed[9];
+ // // StepAcc[i] = m_stepPosition_acc[9];
+ // // }
+ // // else
+ // // {
+ // // StepStartspeed[i] = m_SetPotion_StartSpeed[i];
+ // // Stepdriverspeed[i] = m_SetPotion_DriveSpeed[i];
+ // // StepAcc[i] = m_SetPotion_Line[i];
+ // // }
+ // // }
+ // // StepStartspeed[3] = m_SetPotion_StartSpeed[3];
+ // // StepAcc[3] = m_SetPotion_Line[3];
+ // // Stepdriverspeed[3] = m_SetPotion_DriveSpeed[3];
+ // //}
+ //
+ // int axisCount = 4;
+ // if (fourthAxisFlag) //绗4杞
+ // {
+ // fourthAxisFlag = false;
+ // if (Pos[4] > 0) direct_pos |= 0x08;
+ // if (abs(Pos[4]) > 20) axis_start |= 0x08;
+ // axisCount = 5;
+ // xyzAxis = AXIS_XYZU;
+ // }
+ // else
+ // {
+ // xyzAxis = AXIS_XYZ;
+ // }
+ //
+ // //璁剧疆杩愬姩鍙傛暟
+ // for (int i = 1; i < axisCount; i++)
+ // {
+ // int time_out_send = 0;
+ //
+ // send_pos_data[0] = CT_MOTOR;
+ // send_pos_data[1] = CT_MOTOR_SET;
+ // send_pos_data[2] = 1 << (i - 1);
+ // send_pos_data[3] = POSITION_SPEED_ACC_DEC_POS;
+ // /*if (m_motorType == 1)
+ // {*/
+ // send_pos_data[4] = (m_SetPotion_StartSpeed[i] & 0xff);
+ // send_pos_data[5] = ((m_SetPotion_StartSpeed[i] >> 8) & 0xff);
+ // send_pos_data[6] = ((m_SetPotion_StartSpeed[i] >> 16) & 0xff);
+ // send_pos_data[7] = ((m_SetPotion_StartSpeed[i] >> 24) & 0xff);
+ // if ((xyzAxis == AXIS_XYZU) && (m_IsUseFourthSpeed == 1))
+ // {
+ // send_pos_data[8] = (m_SetPotion_DriveSpeed[4] & 0xff);
+ // send_pos_data[9] = ((m_SetPotion_DriveSpeed[4] >> 8) & 0xff);
+ // send_pos_data[10] = ((m_SetPotion_DriveSpeed[4] >> 16) & 0xff);
+ // send_pos_data[11] = ((m_SetPotion_DriveSpeed[4] >> 24) & 0xff);
+ // }
+ // else
+ // {
+ // send_pos_data[8] = (m_SetPotion_DriveSpeed[i] & 0xff);
+ // send_pos_data[9] = ((m_SetPotion_DriveSpeed[i] >> 8) & 0xff);
+ // send_pos_data[10] = ((m_SetPotion_DriveSpeed[i] >> 16) & 0xff);
+ // send_pos_data[11] = ((m_SetPotion_DriveSpeed[i] >> 24) & 0xff);
+ // }
+ // send_pos_data[12] = (m_SetPotion_Line[i] & 0xff);
+ // send_pos_data[13] = ((m_SetPotion_Line[i] >> 8) & 0xff);
+ // send_pos_data[14] = ((m_SetPotion_Line[i] >> 16) & 0xff);
+ // send_pos_data[15] = ((m_SetPotion_Line[i] >> 24) & 0xff);
+ //
+ // send_pos_data[16] = (m_SetPotion_Buffer[i] & 0xff);
+ // send_pos_data[17] = ((m_SetPotion_Buffer[i] >> 8) & 0xff);
+ // send_pos_data[18] = ((m_SetPotion_Buffer[i] >> 16) & 0xff);
+ // send_pos_data[19] = ((m_SetPotion_Buffer[i] >> 24) & 0xff);
+ //
+ // send_pos_data[28] = (target_pos[i] & 0xff);
+ // send_pos_data[29] = ((target_pos[i] >> 8) & 0xff);
+ // send_pos_data[30] = ((target_pos[i] >> 16) & 0xff);
+ // send_pos_data[31] = ((target_pos[i] >> 24) & 0xff);
+ //
+ // send_pos_data[32] = (Pos[i] & 0xff);
+ // send_pos_data[33] = ((Pos[i] >> 8) & 0xff);
+ // send_pos_data[34] = ((Pos[i] >> 16) & 0xff);
+ // send_pos_data[35] = ((Pos[i] >> 24) & 0xff);
+ //
+ // g_pLogger->SendAndFlushWithTime(
+ // L"[SetPositionXyz] m_SetPotion_StartSpeed[%d] = %d,m_SetPotion_DriveSpeed[%d] = %d\n", i,
+ // m_SetPotion_StartSpeed[i], i, m_SetPotion_DriveSpeed[i]);
+ // //send_pos_data[32] = 0x21;
+ // /*}*/
+ //
+ // /*else
+ // {
+ // send_pos_data[4] = (StepStartspeed[i] & 0xff);
+ // send_pos_data[5] = ((StepStartspeed[i] >> 8) & 0xff);
+ // send_pos_data[6] = ((StepStartspeed[i] >> 16) & 0xff);
+ // send_pos_data[7] = ((StepStartspeed[i] >> 24) & 0xff);
+ //
+ // send_pos_data[8] = (Stepdriverspeed[i] & 0xff);
+ // send_pos_data[9] = ((Stepdriverspeed[i] >> 8) & 0xff);
+ // send_pos_data[10] = ((Stepdriverspeed[i] >> 16) & 0xff);
+ // send_pos_data[11] = ((Stepdriverspeed[i] >> 24) & 0xff);
+ //
+ // send_pos_data[12] = (StepAcc[i] & 0xff);
+ // send_pos_data[13] = ((StepAcc[i] >> 8) & 0xff);
+ // send_pos_data[14] = ((StepAcc[i] >> 16) & 0xff);
+ // send_pos_data[15] = ((StepAcc[i] >> 24) & 0xff);
+ //
+ // send_pos_data[16] = (m_SetPotion_Buffer[i] & 0xff);
+ // send_pos_data[17] = ((m_SetPotion_Buffer[i] >> 8) & 0xff);
+ // send_pos_data[18] = ((m_SetPotion_Buffer[i] >> 16) & 0xff);
+ // send_pos_data[19] = ((m_SetPotion_Buffer[i] >> 24) & 0xff);
+ //
+ // send_pos_data[28] = (target_pos[i] & 0xff);
+ // send_pos_data[29] = ((target_pos[i] >> 8) & 0xff);
+ // send_pos_data[30] = ((target_pos[i] >> 16) & 0xff);
+ // send_pos_data[31] = ((target_pos[i] >> 24) & 0xff);
+ //
+ // send_pos_data[32] = (Pos[i] & 0xff);
+ // send_pos_data[33] = ((Pos[i] >> 8) & 0xff);
+ // send_pos_data[34] = ((Pos[i] >> 16) & 0xff);
+ // send_pos_data[35] = ((Pos[i] >> 24) & 0xff);
+ //
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] m_SetPotion_StartSpeed[%d] = %d,m_SetPotion_DriveSpeed[%d] = %d\n", i, m_SetPotion_StartSpeed[i], i, m_SetPotion_DriveSpeed[i]);
+ // }*/
+ // m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength);
+ // Sleep(6);
+ // }
+ //
+ // //娓呴櫎缂撳瓨浣嶇疆
+ // while (m_SO7_Serial.m_RecvData[39])
+ // {
+ // send_pos_data[0] = CT_ORDER;
+ // send_pos_data[1] = CT_POSFLAG_CLEAR;
+ // m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength);
+ // Sleep(10);
+ // }
+ //
+ // Sleep(10);
+ // //鍚姩鎻掕ˉ鍜屽畾浣嶅姛鑳
+ // /* if (m_motorType == 1)
+ // {
+ // send_pos_data[0] = CT_MOTOR;
+ // send_pos_data[1] = CT_START_POSITION;
+ // send_pos_data[2] = xyzAxis;
+ // send_pos_data[3] = 0x53;
+ // send_pos_data[4] = INTERPOLATION;
+ // }
+ // else
+ // {*/
+ // send_pos_data[0] = CT_MOTOR;
+ // send_pos_data[1] = CT_START_POSITION;
+ // send_pos_data[2] = axis_start;
+ // send_pos_data[3] = 0x53;
+ // send_pos_data[4] = m_motorType & 0xff;
+ // /* }*/
+ // for (int j = 1; j < axisCount; j++)
+ // {
+ // send_pos_data[9 + 4 * (j - 1)] = (target_pos[j] & 0xff);
+ // send_pos_data[10 + 4 * (j - 1)] = ((target_pos[j] >> 8) & 0xff);
+ // send_pos_data[11 + 4 * (j - 1)] = ((target_pos[j] >> 16) & 0xff);
+ // send_pos_data[12 + 4 * (j - 1)] = ((target_pos[j] >> 24) & 0xff);
+ // }
+ // //send_pos_data[25] = direct_pos;
+ // int stepmotoracc = 0;
+ // stepmotoracc = CaculateStepMotorACC(Pos[1], m_SetPotion_Line[1], 10);
+ // send_pos_data[25] = stepmotoracc;
+ // stepmotoracc = CaculateStepMotorACC(Pos[2], m_SetPotion_Line[2], 10);
+ // send_pos_data[26] = stepmotoracc;
+ // stepmotoracc = CaculateStepMotorACC(Pos[3], m_SetPotion_Line[3], 10);
+ // send_pos_data[27] = stepmotoracc;
+ // stepmotoracc = CaculateStepMotorACC(Pos[4], m_SetPotion_Line[4], 10);
+ // /*send_pos_data[25] = m_SetPotion_Line[1];
+ // send_pos_data[26] = m_SetPotion_Line[2];
+ // send_pos_data[27] = m_SetPotion_Line[3];
+ // send_pos_data[28] = m_SetPotion_Line[4];*/
+ //
+ // send_pos_data[29] = m_SpeedAdjustPeriod[1];
+ // send_pos_data[30] = m_SpeedAdjustPeriod[2];
+ // send_pos_data[31] = m_SpeedAdjustPeriod[3];
+ // send_pos_data[32] = m_SpeedAdjustPeriod[4];
+ //
+ // for (size_t i = 1; i < 5; i++)
+ // {
+ // Stepdriverspeed[i] = m_SetPotion_DriveSpeed[i] * m_Resolution[i] * 50;
+ // }
+ //
+ // send_pos_data[33] = (Stepdriverspeed[1] >> 8) & 0xff;
+ // send_pos_data[34] = Stepdriverspeed[1] & 0xff;
+ // send_pos_data[35] = (Stepdriverspeed[2] >> 8) & 0xff;
+ // send_pos_data[36] = Stepdriverspeed[2] & 0xff;
+ // send_pos_data[37] = (Stepdriverspeed[3] >> 8) & 0xff;
+ // send_pos_data[38] = Stepdriverspeed[3] & 0xff;
+ // send_pos_data[39] = (Stepdriverspeed[4] >> 8) & 0xff;
+ // send_pos_data[40] = Stepdriverspeed[4] & 0xff;
+ //
+ // if (bCircleRun) //鍦嗗姬鎻掕ˉ
+ // {
+ // bCircleRun = false;
+ // send_pos_data[1] = CT_CIRCLERUN_POSITION;
+ // send_pos_data[2] = 0x03;
+ // send_pos_data[4] = CIRCLER;
+ // for (size_t i = 1; i < 3; i++)
+ // {
+ // iCircleRunPnt[i] = iCircleRunPnt[i] - NowPos[i];
+ // send_pos_data[26 + 4 * (i - 1)] = (iCircleRunPnt[i] & 0xff);
+ // send_pos_data[27 + 4 * (i - 1)] = ((iCircleRunPnt[i] >> 8) & 0xff);
+ // send_pos_data[28 + 4 * (i - 1)] = ((iCircleRunPnt[i] >> 16) & 0xff);
+ // send_pos_data[29 + 4 * (i - 1)] = ((iCircleRunPnt[i] >> 24) & 0xff);
+ // }
+ // }
+ // g_IsClose = false;
+ // m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength);
+ // set_start = GetTickCount();
+ // Sleep(3); //
+ // if (eType == HSI_MOTION_MOVE_NOWAIT)
+ // {
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Nowait SetEvent\n");
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Nowait move!\n");
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out Success Nowait\n");
+ // m_IsExMotion = 0;
+ // bRunGlueDispenser = HSI_THREAD_PAUSED;
+ // m_Thread_State = HSI_THREAD_RUNNING;
+ // SetEvent(m_hTriggerEvent);
+ // }
+ // if (eType == HSI_MOTION_MOVE_WAIT)
+ // {
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out Success Wait Mode\n");
+ // m_Thread_State = HSI_THREAD_RUNNING;
+ // m_IsExMotion = 0;
+ // UpdateMotionState();
+ // m_Thread_State = HSI_THREAD_PAUSED;
+ // }
+ // }
+ // else
+ // {
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] HSI_STATUS_MOTION_MOVING\n");
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out\n");
+ // rStatus = HSI_STATUS_MOTION_MOVING;
+ // }
+ // g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Out\n");
+ // targetpos_l[1] = PositionX;
+ // targetpos_l[2] = PositionY;
+ // targetpos_l[3] = PositionZ;
+ // }
+ // ReleaseMutex(g_WR_ToMove_Mutex);
+ // return rStatus;
+ //}
HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double PositionY, double PositionZ,
HSI_MOTION_MOVE_TYPE eType, double dFlyRadius)
@@ -3540,8 +3546,8 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
m_SetPotion_DriveSpeed[1] * 100
};
- SetSingleAxisMotionParams(ACSC_AXIS_1, X_SetmotionParam);//璁剧疆X杞村畾浣嶉熷害
- m_SetPotion_DriveSpeed[ACSC_AXIS_1] = X_SetmotionParam[0];// 璁板綍X杞撮熷害
+ SetSingleAxisMotionParams(ACSAxisNumbers[0], X_SetmotionParam);//璁剧疆X杞村畾浣嶉熷害
+ m_SetPotion_DriveSpeed[ACSAxisNumbers[0]] = X_SetmotionParam[0];// 璁板綍X杞撮熷害
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] 璁剧疆Y杞村畾浣嶉熷害 %d\n", m_SetPotion_DriveSpeed[2]);
double Y_SetmotionParam[5] = {
@@ -3552,8 +3558,8 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
m_SetPotion_DriveSpeed[2] * 100
};
- SetSingleAxisMotionParams(ACSC_AXIS_0, Y_SetmotionParam);//璁剧疆Y杞村畾浣嶉熷害
- m_SetPotion_DriveSpeed[ACSC_AXIS_0] = Y_SetmotionParam[0];// 璁板綍Y杞撮熷害
+ SetSingleAxisMotionParams(ACSAxisNumbers[1], Y_SetmotionParam);//璁剧疆Y杞村畾浣嶉熷害
+ m_SetPotion_DriveSpeed[ACSAxisNumbers[1]] = Y_SetmotionParam[0];// 璁板綍Y杞撮熷害
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] 璁剧疆Z杞村畾浣嶉熷害 %d\n", m_SetPotion_DriveSpeed[3]);
double Z_SetmotionParam[5] = {
@@ -3564,12 +3570,12 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
m_SetPotion_DriveSpeed[3] * 100 //鍑忓噺閫熷害
};
- SetSingleAxisMotionParams(ACSC_AXIS_8, Z_SetmotionParam);//璁剧疆Z杞村畾浣嶉熷害
- m_SetPotion_DriveSpeed[ACSC_AXIS_8] = Z_SetmotionParam[0]; //璁板綍Z杞撮熷害
+ SetSingleAxisMotionParams(ACSAxisNumbers[2], Z_SetmotionParam);//璁剧疆Z杞村畾浣嶉熷害
+ m_SetPotion_DriveSpeed[ACSAxisNumbers[2]] = Z_SetmotionParam[0]; //璁板綍Z杞撮熷害
//浣胯兘鐢垫満
- int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 }; //鏍规嵁鐢垫皵灞傞潰瀹氫箟锛岃繖閲岀殑0瀵瑰簲X杞达紝1瀵瑰簲Y杞达紝8瀵瑰簲Z杞
- if (!acsc_EnableM(handleACS, Axes, nullptr))
+ //int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 }; //鏍规嵁鐢垫皵灞傞潰瀹氫箟锛岃繖閲岀殑0瀵瑰簲X杞达紝1瀵瑰簲Y杞达紝8瀵瑰簲Z杞
+ if (!acsc_EnableM(handleACS, ACSAxisNumbers, nullptr))
{
g_pLogger->SendAndFlushWithTime(L"[ACS Motion] ACS Motors Enable Failed!\n");
ErrorsHandler();
@@ -3581,7 +3587,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
//寮濮嬭繍鍔ㄥ埌鎸囧畾浣嶇疆锛屽杞磋繍鍔
double Points[] = { PositionX, PositionY, PositionZ }; //鐩爣浣嶇疆鐐
- if (!acsc_ToPointM(handleACS, 0, Axes, Points, nullptr)) //绉诲姩鍒扮粷瀵逛綅缃
+ if (!acsc_ToPointM(handleACS, 0, ACSAxisNumbers, Points, nullptr)) //绉诲姩鍒扮粷瀵逛綅缃
{
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] ACS Multi Motion Error\n");
ErrorsHandler();
@@ -4324,6 +4330,18 @@ HSI_STATUS HSI_Motion::Load_EF3_Config_Inifile(CString GoogolIniFile)
}
m_EF3COMPort = GetPrivateProfileInt(L"EF3COM", L"COMPORT", 0, csAppPath);
+
+ // 鍔犺浇ACS 杞村彿瀹氫箟
+ int x = GetPrivateProfileInt(L"ACS_AXIS", L"ACS_AXIS_X", 0, csAppPath);
+ int y = GetPrivateProfileInt(L"ACS_AXIS", L"ACS_AXIS_Y", 0, csAppPath);
+ int z = GetPrivateProfileInt(L"ACS_AXIS", L"ACS_AXIS_Z", 0, csAppPath);
+
+ ACSAxisNumbers[0] = ACSAxisDefault[x];
+ ACSAxisNumbers[1] = ACSAxisDefault[y];
+ ACSAxisNumbers[2] = ACSAxisDefault[z];
+ ACSAxisNumbers[3] = -1;
+ g_pLogger->SendAndFlushWithTime(L"[Load_EF3_Config_Inifile] 鍔犺浇ACS杞村畾涔 ACSAxisNumbers[0]: %d, ACSAxisNumbers[1]: %d, ACSAxisNumbers[2]: %d, ACSAxisNumbers[3]: %d\n",
+ ACSAxisNumbers[0], ACSAxisNumbers[1], ACSAxisNumbers[2], ACSAxisNumbers[3]);
}
return rStatus;
}
@@ -4447,9 +4465,9 @@ void HSI_Motion::UpdateMotionState()
g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Now wait Run End\n");
printf("\nWaiting for motion end\n");
- acsc_WaitMotionEnd(handleACS, ACSC_AXIS_1, INFINITE);//渚濇绛夊緟 X,Y,Z杞磋繍鍔ㄥ埌浣
- acsc_WaitMotionEnd(handleACS, ACSC_AXIS_0, INFINITE);
- acsc_WaitMotionEnd(handleACS, ACSC_AXIS_8, INFINITE);
+ acsc_WaitMotionEnd(handleACS, ACSAxisNumbers[0], INFINITE);//渚濇绛夊緟 X,Y,Z杞磋繍鍔ㄥ埌浣
+ acsc_WaitMotionEnd(handleACS, ACSAxisNumbers[1], INFINITE);
+ acsc_WaitMotionEnd(handleACS, ACSAxisNumbers[2], INFINITE);
printf("\nMotion end\n");
//鍥炲璇樊
@@ -4563,21 +4581,21 @@ void HSI_Motion::UpdateMotionState()
}
switch (CurrentMotionState)
{
- case E_SO7_MOTION_MOVETO:
- {
- g_pLogger->SendAndFlushWithTime(
- L"[UpdateMotionState] Nowait CurrentMotionState E_SO7_MOTION_MOVETO\n");
- m_Thread_State = HSI_THREAD_PAUSED;
- CurrentMotionState = E_SO7_MOTION_NONE;
- m_IsExMotion = 2;
- SendMsgMotionFinished(); //瀹氫綅瀹屾垚
- break;
- }
- default:
- {
- g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Nowait CurrentMotionState default\n");
- break;
- }
+ case E_SO7_MOTION_MOVETO:
+ {
+ g_pLogger->SendAndFlushWithTime(
+ L"[UpdateMotionState] Nowait CurrentMotionState E_SO7_MOTION_MOVETO\n");
+ m_Thread_State = HSI_THREAD_PAUSED;
+ CurrentMotionState = E_SO7_MOTION_NONE;
+ m_IsExMotion = 2;
+ SendMsgMotionFinished(); //瀹氫綅瀹屾垚
+ break;
+ }
+ default:
+ {
+ g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Nowait CurrentMotionState default\n");
+ break;
+ }
}
}
g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Out\n");
@@ -5081,7 +5099,7 @@ HSI_STATUS HSI_Motion::GetDIO(UINT IOChannel, UINT& _Status)
auto rStatus = HSI_STATUS_NORMAL;
if (g_pHSI_Motion)
{
- g_pLogger->SendAndFlushWithTime(L"[GetDIO] In\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetDIO] In\n");
if (m_SO7_Serial.m_RecvData[0] == 2)
{
if (IOChannel == HSI_MOTION_INPUT_LIMIT_SWITCH)
@@ -5124,9 +5142,9 @@ HSI_STATUS HSI_Motion::GetDIO(UINT IOChannel, UINT& _Status)
}
else
{
- g_pLogger->SendAndFlushWithTime(L"[GetDIO] failed\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetDIO] failed\n");
}
- g_pLogger->SendAndFlushWithTime(L"[GetDIO] Out\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetDIO] Out\n");
}
//-----------TEST Begin------------------
_Status = 0;
@@ -5201,7 +5219,7 @@ HSI_STATUS HSI_Motion::SetDIO(UINT IOChannel, UINT _Status)
auto rStatus = HSI_STATUS_NORMAL;
if (g_pHSI_Motion)
{
- g_pLogger->SendAndFlushWithTime(L"[SetDIO] In\n");
+ //g_pLogger->SendAndFlushWithTime(L"[SetDIO] In\n");
if (m_bISUseMoreLights > 0 && (m_ForStatus != _Status))
{
if (m_Led8MotionFlag[m_selectedIndex])
@@ -5247,7 +5265,7 @@ HSI_STATUS HSI_Motion::SetDIO(UINT IOChannel, UINT _Status)
//m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);
Sleep(5);
}
- g_pLogger->SendAndFlushWithTime(L"[SetDIO] Out\n");
+ //g_pLogger->SendAndFlushWithTime(L"[SetDIO] Out\n");
}
//-----------TEST Begin------------------
@@ -5320,10 +5338,10 @@ HSI_STATUS HSI_Motion::AbortMotion() //闇瑕佽繍鍔ㄥ疄鐜
g_IsClose = true;
g_pLogger->SendAndFlushWithTime(L"[AbortMotion] In\n");
- int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 };
+ //int Axes[] = { ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1 };
if (handleACS != ACSC_INVALID)
{
- if (!acsc_HaltM(handleACS, Axes, nullptr)) //鍋滄JOG杩愬姩
+ if (!acsc_HaltM(handleACS, ACSAxisNumbers, nullptr)) //鍋滄JOG杩愬姩
{
g_pLogger->SendAndFlushWithTime(L"[AbortMotion] ACS acsc_HaltM error!\n");
ErrorsHandler();
@@ -7814,8 +7832,8 @@ HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double& Speed)
short AxisNumber = AxisConvertIndex(AxisNum); //灏嗚酱鍙疯浆鎹负 骞冲彴杞村彿
//鎵撳嵃杞村彿鎹㈢畻鍚庣殑鍊
g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] AxisNum = %d, AxisNumber = %d\n", AxisNum, AxisNumber);
-
- // 鏂瑰紡1
+
+ // 鏂瑰紡1
for (int j = 0;j < 9;j++)
{
//鍐欐棩蹇
@@ -7823,8 +7841,6 @@ HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double& Speed)
}
Speed = m_SetPotion_DriveSpeed[AxisNumber]; //浠巑_SetPotion_DriveSpeed[AxisNumber]涓幏鍙栭熷害
-
-
//鏂瑰紡2锛屼粠搴曞眰鏌ヨ
double getMotionParam[5] = { 0 };
GetSingleAxisParam(AxisNumber, getMotionParam); //鑾峰彇鍗曡酱杩愬姩鍙傛暟
@@ -7834,7 +7850,6 @@ HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double& Speed)
Speed = getMotionParam[0]; //浠巊etMotionParam[0]涓幏鍙栭熷害
-
g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] AxisNum = %d, Speed=%.2f\n", AxisNumber, Speed);
g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] Out ================================ \n");
return rStatus;
@@ -7949,7 +7964,6 @@ HSI_STATUS HSI_Motion::SetFocusSpeed(double Speed)
g_pLogger->SendAndFlushWithTime(L"[SetFocusSpeed] Speed = %f\n", Speed);
if (Speed >= -1 && Speed <= 0)
{
-
m_JogDriveSpeed[3][4] = static_cast(fabs(Speed * m_Jog_Auto_Focus));
g_pLogger->SendAndFlushWithTime(L"[SetFocusSpeed] m_Jog_SpeedZ[3][4] = %d\n", m_JogDriveSpeed[3][4]);
}
@@ -8053,37 +8067,37 @@ double HSI_Motion::LimitOver(UINT AxisTypes, double& LimitPos) //鍗曡酱杞檺浣
//===========================================================================
short HSI_Motion::AxisConvertIndex(UINT AxisTypes)
{
- short AxisNumber(0);
+ short m_Axis(0);
switch (AxisTypes)
{
case HSI_MOTION_AXIS_X:
{
- AxisNumber = 0x01; //瀵瑰簲ACS 骞冲彴 1杞
+ m_Axis = ACSAxisNumbers[0]; //瀵瑰簲ACS 骞冲彴 1杞
break;
}
case HSI_MOTION_AXIS_Y:
{
- AxisNumber = 0x00; //瀵瑰簲 ACS 骞冲彴 0杞 (榫欓棬杞)
+ m_Axis = ACSAxisNumbers[1]; //瀵瑰簲 ACS 骞冲彴 0杞 (榫欓棬杞)
break;
}
case HSI_MOTION_AXIS_Z:
{
- AxisNumber = 0x08;//瀵瑰簲 ACS骞冲彴 8杞 锛坋cat閫氳锛
+ m_Axis = ACSAxisNumbers[2];//瀵瑰簲 ACS骞冲彴 8杞 锛坋cat閫氳锛
break;
}
case HSI_MOTION_AXIS_R:
{
- AxisNumber = 0x04;
+ m_Axis = 0x04;
break;
}
default:
{
g_pLogger->SendAndFlushWithTime(L"[AxisConvertIndex] failed, AxisTypes = %d,AxisNumber = %d\n", AxisTypes,
- AxisNumber);
+ m_Axis);
break;
}
}
- return AxisNumber;
+ return m_Axis;
}
//===========================================================================
@@ -8092,7 +8106,6 @@ void HSI_Motion::SetSingleAxisMotionParams(UINT AxisTypes, double SetMotionParam
g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisMotionParams] In >>>>>>>>>>>>>>>>>>>>>> \n");
double getMotionParam[5] = { 0 };
-
GetSingleAxisParam(AxisTypes, getMotionParam); //鑾峰彇鍗曡酱杩愬姩鍙傛暟
g_pLogger->SendAndFlushWithTime(
L"[before] Axis= %d, Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f\n",
@@ -8208,7 +8221,7 @@ HSI_STATUS HSI_Motion::GetPositionEx(UINT AxisTypes, double& Position, double& T
double position[4] = { 0.0 };
short AxisNumber = AxisConvertIndex(AxisTypes);
Position = m_PosForAllAxis[AxisNumber];
- g_pLogger->SendAndFlushWithTime(L"[GetPositionEx] Position: %d\n", Position);
+ //g_pLogger->SendAndFlushWithTime(L"[GetPositionEx] Position: %d\n", Position);
}
return rStatus;
}
diff --git a/HSI_HexagonMI_EF3/HSI_Motion.h b/HSI_HexagonMI_EF3/HSI_Motion.h
index d637193..9194c81 100644
--- a/HSI_HexagonMI_EF3/HSI_Motion.h
+++ b/HSI_HexagonMI_EF3/HSI_Motion.h
@@ -14,7 +14,7 @@
#define THREAD_EXIT -1
#define MAX_BUFF_SIZE 0x200
const double SCALE_UNITS = 1000.0;
-static CLogger* g_pLogger;
+
static CLogger* g_pLogger2;
static bool g_IsClose; //鐢ㄤ簬DoEvents()鐨勯鍑猴紝鑰屼笉寮傚父
@@ -554,6 +554,26 @@ public:
unsigned char m_cSendData[64];
unsigned char m_direct_pos;
unsigned char axis_start;
+
+ // ACS杞村彿瀹氫箟
+ static const int MAX_AXES = 10; // 瀹氫箟杞寸殑鏈澶ф暟閲
+
+ // ACS杞村彿
+ int ACSAxisDefault[MAX_AXES] =
+ {
+ ACSC_AXIS_0, // 榛樿鍊
+ ACSC_AXIS_1, // 榛樿鍊
+ ACSC_AXIS_2, // 榛樿鍊
+ ACSC_AXIS_3, // 榛樿鍊
+ ACSC_AXIS_4, // 榛樿鍊
+ ACSC_AXIS_5, // 榛樿鍊
+ ACSC_AXIS_6, // 榛樿鍊
+ ACSC_AXIS_7, // 榛樿鍊
+ ACSC_AXIS_8, // 榛樿鍊
+ ACSC_AXIS_9, // 榛樿鍊
+ };
+
+ int ACSAxisNumbers[3];
CPSerial m_SO7_Serial;
DWORD m_WriteByte;
diff --git a/HSI_HexagonMI_EF3/logger.h b/HSI_HexagonMI_EF3/logger.h
index 555afcd..d227528 100644
--- a/HSI_HexagonMI_EF3/logger.h
+++ b/HSI_HexagonMI_EF3/logger.h
@@ -84,5 +84,5 @@ public:
CRITICAL_SECTION m_lockLogger;//涓寸晫鍖
};
-
+extern CLogger* g_pLogger;
#endif // !defined(LOGGER_H__5142BB38_5565_4124_88A4_56EA08298154__INCLUDED_)
diff --git a/HSI_HexagonMI_EF3/version.cmd b/HSI_HexagonMI_EF3/version.cmd
index 740421b..6baf6c4 100644
--- a/HSI_HexagonMI_EF3/version.cmd
+++ b/HSI_HexagonMI_EF3/version.cmd
@@ -5,7 +5,7 @@ echo Generate release version
::闇瑕佷汉宸ヨ缃殑鐗堟湰鍙----------------------------------------------------------------------------------
set major_ver=0
set minor_ver=0
-set revsion_ver=2
+set revsion_ver=3
::------------------------------------------------------------------------------------------------------
set revfile="%~dp0version.h"
diff --git a/HSI_HexagonMI_EF3/version.h b/HSI_HexagonMI_EF3/version.h
index 582ed31..7cedd3e 100644
--- a/HSI_HexagonMI_EF3/version.h
+++ b/HSI_HexagonMI_EF3/version.h
@@ -4,13 +4,13 @@
#define HSI_VERSION_NUM
#define HSI_VERSION_SET _T("")
///
-#define HSI_VERSION "0.0.2"
-#define HSI_VERSION_CSTRING _T("0.0.2")
+#define HSI_VERSION "0.0.3"
+#define HSI_VERSION_CSTRING _T("0.0.3")
#define HSI_VERSION_MAJOR 0
#define HSI_VERSION_MINOR 0
-#define HSI_VERSION_REVISION 2
+#define HSI_VERSION_REVISION 3
#define HSI_VERSION_REVNUM
#define HSI_VERSION_BUILD_DATE _T(__DATE__ )
#define HSI_VERSION_BUILD_TIME _T(__TIME__ )
-#define HSI_FILE_DESCRIPTION "2025.02.17 / 11:10 "
-#define HSI_FILE_CSDESCRIPTION _T("2025.02.17 / 11:10 ")
+#define HSI_FILE_DESCRIPTION "2025.02.18 / 17:09 "
+#define HSI_FILE_CSDESCRIPTION _T("2025.02.18 / 17:09 ")