@@ -228,9 +228,11 @@ HSI_Motion::HSI_Motion()
{
m_SixEightSubArea [ i ] = 0 ; //六环八区分区功能
}
//日志处理
//删除日志
//DeleteDirectory()
//是否启用日志
CTime tm = CTime : : GetCurrentTime ( ) ;
//CString csTime = tm.Format("%Y-%m-%d_%H-%M-%S"); //构造时间字符串
CString csTime = tm . Format ( " %Y-%m-%d " ) ; //构造时间字符串
@@ -238,6 +240,12 @@ HSI_Motion::HSI_Motion()
g_pLogger = new CLogger ( dir ) ;
g_pLogger2 = new CLogger ( L " \\ Log \\ EF3_SumTime.Log " ) ;
GetAppPath ( m_AppPath ) ; //获取应用程序路径
m_LogIsOpen [ 0 ] = GetPrivateProfileInt ( L " LOG " , L " LOG_IS_OPEN_0 " , 0 , m_AppPath + _T ( " \\ Config \\ EF3_Motion.ini " ) ) ;
g_pLogger - > IsEnabledLog = m_LogIsOpen [ 0 ] = = 1 ? true : false ;
g_pLogger - > SendAndFlushWithTime ( L " \n " ) ;
g_pLogger - > SendAndFlushWithTime ( L " ========================================================== \n " ) ;
//档位参数
for ( int i = 0 ; i < 5 ; i + + )
{
@@ -263,7 +271,7 @@ HSI_Motion::HSI_Motion()
m_Home_AddJogGears [ i ] = 4 ;
m_Home_DecJogGears [ i ] = 3 ;
m_SetPotion_StartSpeed [ i ] = 20 ;
m_SetPotion_DriveSpeed [ i ] = 20 ;
m_SetPotion_Line [ i ] = 150 ;
m_SetPotion_Buffer [ i ] = 40 ;
m_SetPotion_AccCurve [ i ] = 0 ;
@@ -289,12 +297,12 @@ HSI_Motion::HSI_Motion()
m_ijk [ i ] = 0 ;
}
//是否启用日志
GetAppPath ( m_AppPath ) ;
m_LogIsOpen [ 0 ] = GetPrivateProfileInt ( L " LOG " , L " LOG_IS_OPEN_0 " , 0 , m_AppPath + _T ( " \\ Config \\ EF3_Motion.ini " ) ) ;
g_pLogger - > IsEnabledLog = m_LogIsOpen [ 0 ] = = 1 ? true : false ;
g_pLogger - > SendAndFlushWithTime ( L " \n " ) ;
g_pLogger - > SendAndFlushWithTime ( L " ========================================================== \n " ) ;
for ( int j = 0 ; j < 9 ; j + + )
{
m_SetPotion_DriveSpeed [ j ] = 20 ; //设置定位驱动速度
//写日志
g_pLogger - > SendAndFlushWithTime ( L " m_SetPotion_DriveSpeed[%d] = %d \n " , j , m_SetPotion_DriveSpeed [ j ] ) ;
}
m_Set_XYZA_Reserve = 0 ; //XYZA轴方向
m_motorType = 0 ; //电机类型 1为伺服电机 0为步进电机
@@ -416,8 +424,7 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
return HSI_STATUS_NORMAL ;
}
g_pLogger - > SendAndFlushWithTime ( L " [Startup] In \n " ) ;
g_pLogger - > SendAndFlushWithTime ( L " [Startup] HMQ HSI.dll version = %s, date = %s \n " , HSI_VERSION_CSTRING ,
HSI_FILE_CSDESCRIPTION ) ; //输出HSI.dll 版本号
g_pLogger - > SendAndFlushWithTime ( L " [Startup] HMQ HSI_Sevenocean_EF3 .dll version = %s, date = %s \n " , HSI_VERSION_CSTRING , HSI_FILE_CSDESCRIPTION ) ; //输出HSI.dll 版本号
GoogolMotionConfigFile = m_AppPath + _T ( " \\ Config \\ EF3_Config.ini " ) ;
Load_EF3_Config_Inifile ( GoogolMotionConfigFile ) ; //加载 EF3_Config.ini 配置项
@@ -1961,111 +1968,6 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
int RemainPul = 0 ;
int limitSDPul = 0 ;
double time ;
/*GetPositionXyz(1, now_pos[0], now_pos[1], now_pos[2], time);*/
//GetPositionEncPrfMulti(1, now_pos, Prf_pos, 1);
//if (m_DeviceType != 3)
//{
// if (AxisTypes == AXIS_X /*&& m_motorType & 0x01*/)
// {
// if (!bJOGDir) //负方向
// {
// RemainPul = static_cast<int>(now_pos[1] / m_Resolution[1]) - static_cast<int>(m_N_Work_Limit[1] /
// m_Resolution[1]);
// limitSDPul = (DriveSpeed - StartSpeed) * 13;
// if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
// {
// float SpeedRatio = limitSDPul * 2 / RemainPul;
// DriveSpeed = DriveSpeed / SpeedRatio;
// if (DriveSpeed < StartSpeed)
// {
// DriveSpeed = StartSpeed;
// }
// }
// }
// else
// {
// RemainPul = static_cast<int>(m_P_Work_Limit[1] / m_Resolution[1]) - static_cast<int>(now_pos[1] /
// m_Resolution[1]);
// limitSDPul = (DriveSpeed - StartSpeed) * 13;
// if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
// {
// float SpeedRatio = limitSDPul * 2 / RemainPul;
// DriveSpeed = DriveSpeed / SpeedRatio;
// if (DriveSpeed < StartSpeed)
// {
// DriveSpeed = StartSpeed;
// }
// }
// }
// }
// else if (AxisTypes == AXIS_Y /*&& m_motorType & 0x02*/)
// {
// if (!bJOGDir) //负方向
// {
// RemainPul = static_cast<int>(now_pos[2] / m_Resolution[2]) - static_cast<int>(m_N_Work_Limit[2] /
// m_Resolution[2]);
// limitSDPul = (DriveSpeed - StartSpeed) * 13;
// if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
// {
// float SpeedRatio = 1 + limitSDPul * 2 / RemainPul;
// DriveSpeed = DriveSpeed / SpeedRatio;
// if (DriveSpeed < StartSpeed)
// {
// DriveSpeed = StartSpeed;
// }
// }
// }
// else
// {
// RemainPul = static_cast<int>(m_P_Work_Limit[2] / m_Resolution[2]) - static_cast<int>(now_pos[2] /
// m_Resolution[2]);
// limitSDPul = (DriveSpeed - StartSpeed) * 13;
// if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
// {
// float SpeedRatio = limitSDPul * 2 / RemainPul;
// DriveSpeed = DriveSpeed / SpeedRatio;
// if (DriveSpeed < StartSpeed)
// {
// DriveSpeed = StartSpeed;
// }
// }
// }
// }
// if (AxisTypes == AXIS_Z /*&& m_motorType & 0x04*/)
// {
// if (!bJOGDir) //负方向
// {
// RemainPul = static_cast<int>(now_pos[3] / m_Resolution[3]) - static_cast<int>(m_N_Work_Limit[3] /
// m_Resolution[3]);
// limitSDPul = (DriveSpeed - StartSpeed) * 13;
// if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
// {
// float SpeedRatio = limitSDPul * 2 / RemainPul;
// DriveSpeed = DriveSpeed / SpeedRatio;
// if (DriveSpeed < StartSpeed)
// {
// DriveSpeed = StartSpeed;
// }
// }
// }
// else
// {
// RemainPul = static_cast<int>(m_P_Work_Limit[3] / m_Resolution[3]) - static_cast<int>(now_pos[3] /
// m_Resolution[3]);
// limitSDPul = (DriveSpeed - StartSpeed) * 13;
// if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
// {
// float SpeedRatio = limitSDPul * 2 / RemainPul;
// DriveSpeed = DriveSpeed / SpeedRatio;
// if (DriveSpeed < StartSpeed)
// {
// DriveSpeed = StartSpeed;
// }
// }
// }
// }
//}
//速度限制
JogSpeed = abs ( SpeedPercent ( AxisTypes , Speed , DriveSpeed , StartSpeed , AccLine , DecLine , AccCurve , DecCurve ) ) ;
@@ -3631,10 +3533,10 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
//设置速度,对应配置文件中定位合成速度 SET_POTION_DRIVESPEED_1
g_pLogger - > SendAndFlushWithTime ( L " [SetPositionXyz] DriveSpeed[0] = %.4f , DriveSpeed[1] = %.4f , DriveSpeed[2] = %.4f , DriveSpeed[3] = %.4f , DriveSpeed[4] = %.4f \n " ,
g_pLogger - > SendAndFlushWithTime ( L " [SetPositionXyz] DriveSpeed[0] = %d , DriveSpeed[1] = %d , DriveSpeed[2] = %d , DriveSpeed[3] = %d , DriveSpeed[4] = %d \n " ,
m_SetPotion_DriveSpeed [ 0 ] , m_SetPotion_DriveSpeed [ 1 ] , m_SetPotion_DriveSpeed [ 2 ] , m_SetPotion_DriveSpeed [ 3 ] , m_SetPotion_DriveSpeed [ 4 ] ) ;
g_pLogger - > SendAndFlushWithTime ( L " [SetPositionXyz] 设置X轴定位速度 %d \n " , m_SetPotion_DriveSpeed [ 1 ] ) ;
double X_SetmotionParam [ 5 ] = {
m_SetPotion_DriveSpeed [ 1 ] ,
m_SetPotion_DriveSpeed [ 1 ] * 10 ,
@@ -3645,6 +3547,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
SetSingleAxisMotionParams ( ACSC_AXIS_1 , X_SetmotionParam ) ; //设置X轴定位速度
g_pLogger - > SendAndFlushWithTime ( L " [SetPositionXyz] 设置Y轴定位速度 %d \n " , m_SetPotion_DriveSpeed [ 2 ] ) ;
double Y_SetmotionParam [ 5 ] = {
m_SetPotion_DriveSpeed [ 2 ] ,
m_SetPotion_DriveSpeed [ 2 ] * 10 ,
@@ -3656,6 +3559,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
SetSingleAxisMotionParams ( ACSC_AXIS_0 , Y_SetmotionParam ) ; //设置Y轴定位速度
g_pLogger - > SendAndFlushWithTime ( L " [SetPositionXyz] 设置Z轴定位速度 %d \n " , m_SetPotion_DriveSpeed [ 3 ] ) ;
double Z_SetmotionParam [ 5 ] = {
m_SetPotion_DriveSpeed [ 3 ] ,
m_SetPotion_DriveSpeed [ 3 ] * 10 ,
@@ -3765,7 +3669,7 @@ HSI_STATUS HSI_Motion::GetSingleAxisParam(int AXIS, double motionParam[5])
auto rStatus = HSI_STATUS_NORMAL ;
if ( handleACS ! = ACSC_INVALID )
{
g_pLogger - > SendAndFlushWithTime ( L " [GetSingleAxisParam] In \n " ) ;
//g_pLogger->SendAndFlushWithTime(L" [GetSingleAxisParam] In\n");
//依次是 速度
if ( ! acsc_GetVelocity ( handleACS , AXIS , motionParam + 0 , nullptr ) )
@@ -3802,19 +3706,22 @@ HSI_STATUS HSI_Motion::GetSingleAxisParam(int AXIS, double motionParam[5])
rStatus = HSI_ACS_ERROR ;
ErrorsHandler ( ) ;
}
g_pLogger - > SendAndFlushWithTime ( L " [GetSingleAxisParam] Out \n " ) ;
//打印数组 motionParam[5]
g_pLogger - > SendAndFlushWithTime ( L " [GetSingleAxisParam] Vel = %.4f, ACC = %.4f, DCC = %.4f, KillDec = %.4f, Jerk = %.4f \n " ,
motionParam [ 0 ] , motionParam [ 1 ] , motionParam [ 2 ] , motionParam [ 3 ] , motionParam [ 4 ] ) ;
//g_pLogger->SendAndFlushWithTime(L"[GetSingleAxisParam] Out\n");
}
return rStatus ;
}
//===========================================================================
HSI_STATUS HSI_Motion : : SetSingleAxisParam ( int AXIS , double motionParam [ 5 ] )
HSI_STATUS HSI_Motion : : SetSingleAxisParam ( int AXIS , double motionParam [ 5 ] ) //设置单轴运动参数
{
auto rStatus = HSI_STATUS_NORMAL ;
if ( handleACS ! = ACSC_INVALID )
{
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisParam] In \n " ) ;
//g_pLogger->SendAndFlushWithTime(L" [SetSingleAxisParam] In\n");
//依次是 速度
if ( ! acsc_SetVelocity ( handleACS , AXIS , motionParam [ 0 ] , nullptr ) )
@@ -3851,7 +3758,12 @@ HSI_STATUS HSI_Motion::SetSingleAxisParam(int AXIS, double motionParam[5])
// rStatus = HSI_ACS_ERROR;
// ErrorsHandler();
//}
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisParam] Out \n " ) ;
//打印 motionParam[5]
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisParam] Vel = %.4f, ACC = %.4f, DCC = %.4f, KillDec = %.4f, Jerk = %.4f \n " ,
motionParam [ 0 ] , motionParam [ 1 ] , motionParam [ 2 ] , motionParam [ 3 ] , motionParam [ 4 ] ) ;
//g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisParam] Out\n");
}
return rStatus ;
@@ -6755,7 +6667,7 @@ HSI_STATUS HSI_Motion::SendBinResult(int* BinResult)
m_cSendData [ 5 ] = ( ( m_IbinCount > > 8 ) & 0xff ) ;
m_cSendData [ 6 ] = ( m_IbinCount & 0xff ) ;
m_WriteByte = Send_Command ( 0 , ( const char * ) m_cSendData , m_SendDataLength ) ;
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedXyz ] m_IbinCount = %d \n " , m_IbinCount ) ;
g_pLogger - > SendAndFlushWithTime ( L " [SendBinResult ] m_IbinCount = %d \n " , m_IbinCount ) ;
Sleep ( 5 ) ;
}
g_pLogger - > SendAndFlushWithTime ( L " [SendBinResult] out \n " ) ;
@@ -7881,15 +7793,11 @@ HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double& Speed)
{
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedXyz] In \n " ) ;
auto rStatus = HSI_STATUS_NORMAL ;
short AxisNumber = AxisConvertIndex ( AxisNum ) ;
if ( 1 = = m_iSpeedType )
{
Speed = m_SetPotion_DriveSpeed [ AxisNumber ] * ( m_Resolution [ AxisNumber ] * 50 ) ;
}
else
{
Speed = m_SetPotion_DriveSpeed [ AxisNumber ] ;
}
short AxisNumber = AxisConvertIndex ( AxisNum ) ; //将轴号转换为 平台轴号
Speed = m_SetPotion_DriveSpeed [ AxisNumber ] ; //从m_SetPotion_DriveSpeed[AxisNumber]中获取速度
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedXyz] AxisNum = %d, Speed=%d \n " , AxisNumber , m_SetPotion_DriveSpeed [ AxisNumber ] ) ;
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedXyz] Out \n " ) ;
return rStatus ;
}
@@ -7907,30 +7815,35 @@ HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed)
}
else
{
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedXyz] Speed = %f \n " , Speed ) ;
if ( 1 = = m_iSpeedType )
{
m_SetPotion_DriveSpeed [ 1 ] = static_cast < int > ( Speed / ( m_Resolution [ 1 ] * 50 ) ) ;
if ( m_SetPotion_DriveSpeed [ 1 ] > 1000 / ( m_Resolution [ 1 ] * 50 ) )
{
m_SetPotion_DriveSpeed [ 1 ] = 1000 / ( m_Resolution [ 1 ] * 50 ) ;
}
if ( m_SetPotion_DriveSpeed [ 1 ] < 0 )
{
m_SetPotion_DriveSpeed [ 1 ] = 0 ;
}
//m_SetPotion_DriveSpeed[1] = static_cast<int>(Speed / (m_Resolution[1] * 50));
//if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50))
//{
// m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50);
//}
//if (m_SetPotion_DriveSpeed[1] < 0)
//{
// m_SetPotion_DriveSpeed[1] = 0;
//}
m_SetPotion_DriveSpeed [ 1 ] = static_cast < int > ( Speed ) ;
//打印 m_setotion_drivespeed[1]的值
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedXyz] m_iSpeedType=1, m_SetPotion_DriveSpeed[1] = %d \n " , m_SetPotion_DriveSpeed [ 1 ] ) ;
}
else
{
m_SetPotion_DriveSpeed [ 1 ] = static_cast < int > ( Speed ) ;
if ( m_SetPotion_DriveSpeed [ 1 ] > 1000 / ( m_Resolution [ 1 ] * 50 ) )
{
m_SetPotion_DriveSpeed [ 1 ] = 1000 / ( m_Resolution [ 1 ] * 50 ) ;
}
if ( m_SetPotion_DriveSpeed [ 1 ] < 0 )
{
m_SetPotion_DriveSpeed [ 1 ] = 0 ;
}
//if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50))
//{
// m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50);
//}
//if (m_SetPotion_DriveSpeed[1] < 0)
//{
// m_SetPotion_DriveSpeed[1] = 0;
//}
//打印 m_setotion_drivespeed[1]的值
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedXyz] m_SetPotion_DriveSpeed[1] = %d \n " , m_SetPotion_DriveSpeed [ 1 ] ) ;
}
}
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedXyz] Out \n " ) ;
@@ -8058,17 +7971,17 @@ short HSI_Motion::AxisConvertIndex(UINT AxisTypes)
{
case HSI_MOTION_AXIS_X :
{
AxisNumber = 0x01 ;
AxisNumber = 0x01 ; //对应ACS 平台 1轴
break ;
}
case HSI_MOTION_AXIS_Y :
{
AxisNumber = 0x00 ;
AxisNumber = 0x00 ; //对应 ACS 平台 0轴 (龙门轴)
break ;
}
case HSI_MOTION_AXIS_Z :
{
AxisNumber = 0x08 ;
AxisNumber = 0x08 ; //对应 ACS平台 8轴 ( ecat通讯)
break ;
}
case HSI_MOTION_AXIS_R :
@@ -8087,27 +8000,28 @@ short HSI_Motion::AxisConvertIndex(UINT AxisTypes)
}
//===========================================================================
void HSI_Motion : : SetSingleAxisMotionParams ( UINT AxisTypes , double SetmotionParam [ 5 ] ) //设置单轴运动参数
void HSI_Motion : : SetSingleAxisMotionParams ( UINT AxisTypes , double SetMotionParam [ 5 ] ) //设置单轴运动参数
{
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisMotionParams] In \n " ) ;
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisMotionParams] In >>>>>>>>>>>>>>>>>>>>>> \n " ) ;
double getMotionParam [ 5 ] = { 0 } ;
short AxisNumber = AxisConvertIndex ( AxisTypes ) ;
//打印轴当前运动参数
GetSingleAxisParam ( AxisTypes , getMotionParam ) ; //获取单轴运动参数
GetSingleAxisParam ( AxisNumber , getMotionParam ) ; //获取单轴运动参数
g_pLogger - > SendAndFlushWithTime (
L " [before] Axis= %.2f, Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f \n " ,
jogAxisNum , getMotionParam [ 0 ] , getMotionParam [ 1 ] , getMotionParam [ 2 ] , getMotionParam [ 3 ] , getMotionParam [ 4 ] ) ;
AxisNumber , getMotionParam [ 0 ] , getMotionParam [ 1 ] , getMotionParam [ 2 ] , getMotionParam [ 3 ] , getMotionParam [ 4 ] ) ;
//设置单轴参数
SetSingleAxisParam ( AxisTypes , SetmotionParam ) ;
SetSingleAxisParam ( AxisNumber , SetMotionParam ) ;
//打印轴当前运动参数
GetSingleAxisParam ( AxisTypes , getMotionParam ) ; //获取单轴运动参数
GetSingleAxisParam ( AxisNumber , getMotionParam ) ; //获取单轴运动参数
g_pLogger - > SendAndFlushWithTime (
L " [after] Axis= %.2f, Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f \n " ,
jogAxisNum , getMotionParam [ 0 ] , getMotionParam [ 1 ] , getMotionParam [ 2 ] , getMotionParam [ 3 ] , getMotionParam [ 4 ] ) ;
AxisNumber , getMotionParam [ 0 ] , getMotionParam [ 1 ] , getMotionParam [ 2 ] , getMotionParam [ 3 ] , getMotionParam [ 4 ] ) ;
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisMotionParams] Out \n " ) ;
g_pLogger - > SendAndFlushWithTime ( L " [SetSingleAxisMotionParams] Out >>>>>>>>>>>>>>>>>>>>>> \n " ) ;
}
@@ -8156,6 +8070,8 @@ HSI_STATUS HSI_Motion::IsSupportedEx(UINT AxisTypes, UINT& Types)
{
rStatus = HSI_STATUS_NOT_SUPPORTED ;
}
//写日志
g_pLogger - > SendAndFlushWithTime ( L " [IsSupportedEx] AxisNumber = %d, Types = %d \n " , AxisNumber , Types ) ;
return rStatus ;
}
@@ -8178,6 +8094,8 @@ HSI_STATUS HSI_Motion::GetScaleResolutionEx(UINT AxisTypes, double& Scale)
{
Scale = m_Resolution [ AxisNumber ] ;
}
//写日志
g_pLogger - > SendAndFlushWithTime ( L " [GetScaleResolutionEx] AxisNumber = %d, Scale = %f \n " , AxisNumber , Scale ) ;
return rStatus ;
}
@@ -8190,6 +8108,8 @@ HSI_STATUS HSI_Motion::SetScaleResolutionEx(UINT AxisTypes, double Scale)
{
m_Resolution [ AxisNumber ] = static_cast < int > ( Scale * 10000 ) ;
}
//写日志
g_pLogger - > SendAndFlushWithTime ( L " [SetScaleResolutionEx] AxisNumber = %d, Scale = %f \n " , AxisNumber , m_Resolution [ AxisNumber ] ) ;
return rStatus ;
}
@@ -8250,25 +8170,18 @@ HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double& Speed)
{
if ( m_motorType = = 1 )
{
if ( 1 = = m_iSpeedType )
{
Speed = m_SetPotion_DriveSpeed [ 1 ] * ( m_Resolution [ 1 ] * 50 ) ;
}
else
{
Speed = m_SetPotion_DriveSpeed [ 1 ] ;
}
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedEx] m_motorType =1, Speed=%d \n " , Speed ) ;
}
else
{
if ( 1 = = m_iSpeedType )
{
Speed = m_SetPotion_DriveSpeed [ AxisNumber ] * ( m_Resolution [ AxisNumber ] * 50 ) ;
}
else
{
Speed = m_SetPotion_DriveSpeed [ AxisNumber ] ;
}
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedEx] m_iSpeedType=1, Speed=%d \n " , Speed ) ;
}
}
g_pLogger - > SendAndFlushWithTime ( L " [GetSpeedEx] Out \n " ) ;
@@ -8371,74 +8284,18 @@ HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed)
if ( Speed < = 0 )
{
m_SetPotion_DriveSpeed [ AxisNumber ] = 0 ;
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedEx] Speed <= 0 \n " ) ;
}
if ( 1 = = m_iSpeedType )
if ( AxisNumber > = 0 & & AxisNumber < = 8 )
{
if ( Speed > = 65000 * ( m_Resolution [ AxisNumber ] * 50 ) )
{
m_SetPotion_DriveSpeed [ AxisNumber ] = 65000 ;
}
m_SetPotion_DriveSpeed [ 1 ] = static_cast < int > ( Speed ) ;
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedEx] AxisNumber = %d,Speed = %f \n " , AxisNumber , m_SetPotion_DriveSpeed [ 1 ] ) ;
}
else
{
if ( Speed > = 65000 )
{
m_SetPotion_DriveSpeed [ AxisNumber ] = 65000 ;
}
}
if ( AxisNumber > = 1 & & AxisNumber < = 4 )
{
if ( m_ForSoft = = 1 )
{
if ( m_motorType = = 1 )
{
if ( 1 = = m_iSpeedType )
{
m_SetPotion_DriveSpeed [ 1 ] = static_cast < int > ( Speed ) / ( m_Resolution [ 1 ] * 50 ) ;
}
else
{
m_SetPotion_DriveSpeed [ 1 ] = static_cast < int > ( Speed ) ;
}
}
else
{
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedEx] AxisNumber = %d,Speed = %f \n " , AxisNumber , Speed ) ;
//if (!bSaveSpeedFlag)
//{
// bSaveSpeedFlag = true;
// m_SaveAxisNum = AxisNumber;
// m_SaveAxisSpeed = m_SetPotion_DriveSpeed[AxisNumber];
// g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] m_SaveAxisNum = %d,m_SaveAxisSpeed = %d \n", m_SaveAxisNum, m_SaveAxisSpeed);
//}
//if (bSaveSpeedFlag && ((int)Speed == m_SetPotion_DriveSpeed[1] * (m_Resolution[1] * 50)))
//{
// bSaveSpeedFlag = false;
// m_SetPotion_DriveSpeed[m_SaveAxisNum] = m_SaveAxisSpeed;
// return rStatus;
//}
if ( 1 = = m_iSpeedType )
{
m_SetPotion_DriveSpeed [ AxisNumber ] = static_cast < int > ( Speed / ( m_Resolution [ AxisNumber ] * 50 ) ) ;
}
else
{
m_SetPotion_DriveSpeed [ AxisNumber ] = static_cast < int > ( Speed ) ;
}
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedEx] AxisNumber = %d \n " , AxisNumber ) ;
}
}
else
{
if ( m_motorType = = 1 )
{
m_SetPotion_DriveSpeed [ AxisNumber ] = static_cast < int > ( Speed / ( m_Resolution [ AxisNumber ] * 50 ) ) ;
}
else
{
m_SetPotion_DriveSpeed [ AxisNumber ] = static_cast < int > ( Speed / ( m_Resolution [ AxisNumber ] * 50 ) ) ;
}
}
//打印日志 轴号不在1-4之间
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedEx] 轴号不在0-8之间 \n " ) ;
}
g_pLogger - > SendAndFlushWithTime ( L " [SetSpeedEx] Out \n " ) ;
return rStatus ;