平台阶段性结束
1、新增了加速度,减速度,运行速度读配置档位 2、优化了串口通讯,待继续调试 3、测试用例,新增了 DCCScanStart() 和 DCCScanStop()的调试
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)HSI_SEVENOCEAN_EF1_CsTest\bin\Debug\HSI.dll"
|
||||
copy "$(TargetDir)$(ProjectName).dll" "C:\Hexagon\Metus2020R1\HSI_Sevenocean_EF3.dll"
|
||||
copy "$(TargetDir)$(ProjectName).dll" "C:\Hexagon\Metus-7.10.1 967\HSI_Sevenocean_EF3.dll"
|
||||
copy "$(TargetDir)$(ProjectName).dll" "E:\HexagonProjects\2022-05-直线电机平台\EF3-Interfac\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\HSI_Sevenocean_EF1_WPFTest\bin\x64\Debug\HSI.dll"</Command>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
|
||||
+159
-131
@@ -81,7 +81,7 @@ void ErrorsHandler()
|
||||
{
|
||||
ErrorStr[Received] = '\0';
|
||||
printf("Motion Error: %d [%s]\n", ErrorCode, ErrorStr);
|
||||
g_pLogger->SendAndFlushWithTime(L"[ACS Motion] Motion Error %d%S\n", ErrorCode, ErrorStr);
|
||||
g_pLogger->SendAndFlushWithTime(L"[ACS Motion] Motion Error,Code: %d, %S\n", ErrorCode, ErrorStr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -777,18 +777,19 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
|
||||
//if (m_IsUseRocker == 1)
|
||||
{
|
||||
//软件清空
|
||||
m_cSendData[0] = 0x01;
|
||||
m_cSendData[1] = 0x06;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, 2);
|
||||
Sleep(5);
|
||||
//m_cSendData[0] = 0x01;
|
||||
//m_cSendData[1] = 0x06;
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_cSendData, 2);
|
||||
//Sleep(10);
|
||||
|
||||
//设置锁存频率 1秒钟()
|
||||
m_cSendData[0] = 0x01;
|
||||
m_cSendData[1] = 0x01;
|
||||
m_cSendData[2] = 0x02;
|
||||
m_cSendData[3] = 0x03;
|
||||
m_cSendData[3] = 0x03; // 10000 (0x27 0x10)对应1秒,3-4字节表示锁存周期
|
||||
m_cSendData[4] = 0xE8;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, 5);
|
||||
Sleep(5);
|
||||
Sleep(10);
|
||||
|
||||
g_pLogger->SendAndFlushWithTime(L"[Startup] Set EF3 Timing latch Success\n");
|
||||
}
|
||||
@@ -1935,113 +1936,113 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
|
||||
L"[Jog] Speed: [%d], DriveSpeed: [%d], AccCurve: [%d], AccLine: [%d], DecCurve: [%d], DecLine: [%d]\n",
|
||||
Speed, DriveSpeed, AccCurve, AccLine, DecCurve, DecLine);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//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;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//速度限制
|
||||
g_pLogger->SendAndFlushWithTime(
|
||||
L"[Jog] StartSpeed: [%d], DriveSpeed: [%d], AccCurve: [%d], AccLine: [%d], DecCurve: [%d], DecLine: [%d]\n",
|
||||
StartSpeed, DriveSpeed, AccCurve, AccLine, DecCurve, DecLine);
|
||||
L"[Jog] DriveSpeed: [%d], AccCurve: [%d], AccLine: [%d], DecCurve: [%d], DecLine: [%d]\n",
|
||||
DriveSpeed, AccCurve, AccLine, DecCurve, DecLine);
|
||||
|
||||
// 急停判断
|
||||
if ((StartSpeed < 250) && (DriveSpeed < 6))
|
||||
@@ -2057,16 +2058,33 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
|
||||
double motionParam[5] = {0};
|
||||
GetMotorParam(jogAxisNum, motionParam);
|
||||
g_pLogger->SendAndFlushWithTime(
|
||||
L"[Jog] Axis= %d, Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f\n",
|
||||
L"[Jog] Axis= %d,Current Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f\n",
|
||||
jogAxisNum, motionParam[0], motionParam[1], motionParam[2], motionParam[3], motionParam[4]);
|
||||
|
||||
//开始JOG运动
|
||||
if (!bJOGDir)
|
||||
{
|
||||
StartSpeed = StartSpeed * (-1); // Negative direction : Using - (minus) velocity
|
||||
DriveSpeed = DriveSpeed * (-1); // Negative direction : Using - (minus) velocity
|
||||
}
|
||||
//int acsDirection = bJOGDir ? ACSC_POSITIVE_DIRECTION : ACSC_NEGATIVE_DIRECTION; //正方向,或 负方向
|
||||
if (!acsc_Jog(handleACS, 0, jogAxisNum, StartSpeed, nullptr))
|
||||
|
||||
//设置加速度
|
||||
if(!acsc_SetAccelerationImm(handleACS, jogAxisNum, AccLine, nullptr))
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[Jog] ACS SetAccelerationImm failed, Aixs:[%d] AccCurve:[%d]\n", jogAxisNum,
|
||||
AccLine);
|
||||
ErrorsHandler();
|
||||
}
|
||||
|
||||
//设置减速度
|
||||
if(!acsc_SetDeceleration(handleACS, jogAxisNum, AccLine, nullptr))
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[Jog] ACS SetDeceleration failed, Aixs:[%d] DecCurve:[%d]\n", jogAxisNum,
|
||||
AccLine);
|
||||
ErrorsHandler();
|
||||
}
|
||||
|
||||
if (!acsc_Jog(handleACS, 0, jogAxisNum, DriveSpeed, nullptr))
|
||||
{
|
||||
printf("[Jog] 轴[%d] [%s] 方向移动失败", AxisTypes, bJOGDir ? "正" : "负");
|
||||
g_pLogger->SendAndFlushWithTime(L"[Jog] failed, Aixs:[%d] JOGDir:[%S]\n", AxisTypes,
|
||||
@@ -2076,7 +2094,7 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
|
||||
|
||||
|
||||
jogMoving = true;
|
||||
g_pLogger->SendAndFlushWithTime(L"[Jog] Out, StartSpeed = %d\n", StartSpeed);
|
||||
g_pLogger->SendAndFlushWithTime(L"[Jog] Out, DriveSpeed = %d AccCurve:[%d] DecCurve:[%d]\n", DriveSpeed, AccLine, AccLine);
|
||||
}
|
||||
return rStatus;
|
||||
}
|
||||
@@ -3956,9 +3974,10 @@ HSI_STATUS HSI_Motion::Load_EF3_Motion_Inifile(CString GoogolIniFile)
|
||||
temp.GetBufferSetLength(50), 10, csAppPath);
|
||||
float speed = (atof(T2A(temp)));
|
||||
/*m_JogDriveSpeed[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_DRIVESPEED_" , 10, csAppPath);*/
|
||||
m_JogDriveSpeed[j][i] = speed / (m_Resolution[j] * 50);
|
||||
g_pLogger->SendAndFlushWithTime(L"[Load_EF3_Motion_Inifile] m_JogDriveSpeed[%d][%d]: %.4f %ld\n", i, j,
|
||||
speed, m_JogDriveSpeed[i][j]); //打印配置文件 档位速度
|
||||
//m_JogDriveSpeed[j][i] = speed / (m_Resolution[j] * 50);//速度转换为脉冲
|
||||
m_JogDriveSpeed[j][i] = speed; //直接读取速度
|
||||
g_pLogger->SendAndFlushWithTime(L"[Load_EF3_Motion_Inifile] m_JogDriveSpeed[%d][%d]: %ld %ld\n", i, j,
|
||||
speed, m_JogDriveSpeed[j][i]); //打印配置文件 档位速度
|
||||
|
||||
GetPrivateProfileString(L"JOG_SPEED", L"JOG_STARTSPEED_" + strGear[i] + axisNum[j], L"10",
|
||||
temp.GetBufferSetLength(50), 10, csAppPath);
|
||||
@@ -5057,7 +5076,7 @@ HSI_STATUS HSI_Motion::SetDIO(UINT IOChannel, UINT _Status)
|
||||
m_cSendData[1] = 0x02;
|
||||
m_cSendData[2] = (_Status >> 8) & 0xff;
|
||||
m_cSendData[3] = _Status & 0xff;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);
|
||||
Sleep(5);
|
||||
}
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetDIO] Out\n");
|
||||
@@ -5170,7 +5189,7 @@ HSI_STATUS HSI_Motion::Shutdown()
|
||||
{
|
||||
memset(m_cSendData, 0x00, 64);
|
||||
m_cSendData[0] = CT_SOFTSTOP;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);
|
||||
Sleep(5);
|
||||
}
|
||||
|
||||
@@ -5882,7 +5901,7 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType
|
||||
m_SendDCCData[z++] = (static_cast<long>(dTrigDis[j] / m_Resolution[axisNum]) >> 16) & 0xff;
|
||||
m_SendDCCData[z++] = static_cast<long>(dTrigDis[j] / m_Resolution[axisNum]) >> 24;
|
||||
}
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
Sleep(1);
|
||||
}
|
||||
if ((num > 0) && (lTrigNumber % 14 != 0))
|
||||
@@ -5900,7 +5919,7 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType
|
||||
m_SendDCCData[z++] = (static_cast<long>(limit / m_Resolution[axisNum]) >> 8) & 0xff;
|
||||
m_SendDCCData[z++] = (static_cast<long>(limit / m_Resolution[axisNum]) >> 16) & 0xff;
|
||||
m_SendDCCData[z++] = static_cast<long>(limit / m_Resolution[axisNum]) >> 24;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
Sleep(10);
|
||||
}
|
||||
else if (num == 0)
|
||||
@@ -5918,7 +5937,7 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType
|
||||
m_SendDCCData[z++] = (static_cast<long>(limit / m_Resolution[axisNum]) >> 8) & 0xff;
|
||||
m_SendDCCData[z++] = (static_cast<long>(limit / m_Resolution[axisNum]) >> 16) & 0xff;
|
||||
m_SendDCCData[z++] = static_cast<long>(limit / m_Resolution[axisNum]) >> 24;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
Sleep(10);
|
||||
}
|
||||
break;
|
||||
@@ -6025,7 +6044,7 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType
|
||||
m_SendDCCData[5] = (static_cast<long>(dTrigDis[0] / m_Resolution[axisNum]) >> 8) & 0xff;
|
||||
m_SendDCCData[6] = (static_cast<long>(dTrigDis[0] / m_Resolution[axisNum]) >> 16) & 0xff;
|
||||
m_SendDCCData[7] = static_cast<long>(dTrigDis[0] / m_Resolution[axisNum]) >> 24;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
Sleep(10);
|
||||
break;
|
||||
}
|
||||
@@ -6137,14 +6156,22 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType
|
||||
m_SendDCCData[j++] = (static_cast<long>(dTrigDis[i] / m_Resolution[axisNum]) >> 16) & 0xff;
|
||||
m_SendDCCData[j++] = static_cast<long>(dTrigDis[i] / m_Resolution[axisNum]) >> 24;
|
||||
}
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
g_pLogger->SendAndFlushWithTime(L"[DCCScanSetData] Send_Command: %s\n", (const char*)m_SendDCCData);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
Sleep(10);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//启动定时锁存的同时,启动扫描 外部IO
|
||||
unsigned char m_cSendData[8] = { 0 };
|
||||
|
||||
//清空EF3缓存Flash
|
||||
m_cSendData[0] = 0x01;
|
||||
m_cSendData[1] = 0x04;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, 2);
|
||||
Sleep(20);
|
||||
g_pLogger->SendAndFlushWithTime(L"[DCCScanSetData] Out\n");
|
||||
}
|
||||
ReleaseMutex(g_WR_ToMove_Mutex);
|
||||
@@ -6226,7 +6253,7 @@ HSI_STATUS HSI_Motion::DCCScanStart()
|
||||
m_SetTriggerLightData[0] = CT_LIGHT;
|
||||
m_SetTriggerLightData[1] = 0x03;
|
||||
m_SetTriggerLightData[53] = 0;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SetTriggerLightData, m_SendDataLength);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SetTriggerLightData, m_SendDataLength);
|
||||
Sleep(1);
|
||||
}
|
||||
setLightFlag = false;
|
||||
@@ -6268,12 +6295,13 @@ HSI_STATUS HSI_Motion::DCCScanStart()
|
||||
break;
|
||||
}
|
||||
g_pLogger->SendAndFlushWithTime(
|
||||
L"[DCCScanStart] iaxisNum:%d, iTriggleNum:%d, iMotionDirection:%d,begin_position:%d \n", iaxisNum,
|
||||
iTriggleNum, iMotionDirection, begin_position);
|
||||
L"[DCCScanStart] iaxisNum:%d, iTriggleNum:%d, iMotionDirection:%d, begin_position:%d \n", iaxisNum,
|
||||
iTriggleNum, iMotionDirection, begin_position[1]);
|
||||
//m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength);
|
||||
|
||||
//启动定时锁存的同时,启动扫描 外部IO
|
||||
unsigned char m_cSendData[8] = {0};
|
||||
|
||||
unsigned char m_cSendData[64] = {0};
|
||||
m_cSendData[0] = 0x01;
|
||||
m_cSendData[1] = 0x02;
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, 2);
|
||||
@@ -8802,7 +8830,7 @@ BOOL HSI_Motion::Send_Command(int com, const char* _SendData, DWORD SendDataLeng
|
||||
}
|
||||
|
||||
//打印串口返回值
|
||||
Sleep(10);
|
||||
Sleep(5);
|
||||
m_SO7_Serial.OnReceive();
|
||||
}
|
||||
ReleaseMutex(g_RW_Data_Mutex);
|
||||
|
||||
@@ -215,14 +215,14 @@ void CMMIO::LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter /*= FALSE
|
||||
{
|
||||
if (nbCharAvail != -1)
|
||||
{
|
||||
//TRACE(_T("LineReceive got %d chars \n"),nbCharAvail);
|
||||
TRACE(_T("LineReceive got %d chars \n"),nbCharAvail);
|
||||
char c;
|
||||
for (int i = 0; i < nbCharAvail; i++)
|
||||
{
|
||||
c = s[i];
|
||||
m_InputBuffer[CurrentPointer++] = c;
|
||||
|
||||
// only add a packet if we have a delimiter
|
||||
// only add a packet if we have a delimiter ·Ö¸ô·û
|
||||
if ((!m_usesTerminator && i == nbCharAvail - 1) || (m_usesTerminator && c == m_terminator) ||
|
||||
ignoreDelimiter)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
#define MAX_OUTPUT_BUFFER_SIZE 2048
|
||||
#define MAX_RECIEVE_BUFFER_SIZE 3000
|
||||
#define MAX_RECIEVE_BUFFER_SIZE 30000
|
||||
|
||||
// TCP, serial style routines
|
||||
struct SerialList
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define LONG_TIMEOUT 5000
|
||||
@@ -178,7 +178,8 @@ DWORD CPSerial::Open()
|
||||
// Setup the port according to the stored parameters
|
||||
if (ProgramPort(m_Port, m_Baud, m_Parity, m_Bits, m_StopBits, m_HandShake))
|
||||
{
|
||||
TRACE(_T("CmmIO> Port OPEN %s\n", m_Port), Ok);
|
||||
TRACE(_T("CmmIO> Port OPEN %s, m_Baud\n", m_Port, m_Baud), Ok);
|
||||
printf("m_Baud: %d\n", m_Baud);
|
||||
// Setup the timeouts
|
||||
CommTimeOut.ReadIntervalTimeout = 25;
|
||||
CommTimeOut.ReadTotalTimeoutMultiplier = 1;
|
||||
@@ -486,6 +487,76 @@ int CPSerial::ReadBlock(BYTE* abIn, int MaxLength)
|
||||
// ReceiveTask() : Internal function, this runs as a thread and provides the
|
||||
// OnRecieve and OnTransmit events
|
||||
|
||||
//void CPSerial::ReceiveTask(void)
|
||||
//{
|
||||
// //DWORD BytesWritten;
|
||||
// DWORD Events;
|
||||
// unsigned long State;
|
||||
//
|
||||
// do
|
||||
// {
|
||||
// Sleep(2);
|
||||
// BYTE abIn[MAXBLOCK];
|
||||
// int len;
|
||||
// len = ReadBlock(abIn, MAXBLOCK);
|
||||
// if ((len > 0) && (len < MAX_RECIEVE_BUFFER_SIZE))
|
||||
// {
|
||||
// //memset(m_RecvData, 0, m_iRecvBytes);
|
||||
// memcpy(m_RecvData, abIn, len);
|
||||
// m_iRecvBytes = len;
|
||||
// m_iRecvState = TRUE;
|
||||
// }
|
||||
// // Events=0;
|
||||
// //
|
||||
// // // Wait for a comm event
|
||||
// // State=WaitCommEvent(m_PortHandle,&Events,&m_ReceiveOLap);
|
||||
// // if(!State)
|
||||
// // {
|
||||
// // // Since we are using overlapping IO we may have to wait
|
||||
// // // for the result
|
||||
// // if(GetLastError() == ERROR_IO_PENDING)
|
||||
// // GetOverlappedResult(m_PortHandle,&m_ReceiveOLap,&State,TRUE);
|
||||
// // }
|
||||
// ////m_iRecvState=FALSE;
|
||||
// // // If we have a result then OK otherwise the event was probable
|
||||
// // // the serial port being closed and we shall exit the loop
|
||||
// // if( State && IsOpen( ) )
|
||||
// // {
|
||||
// // // Check the events and act accordingly
|
||||
// // if( Events & EV_RXCHAR )
|
||||
// // {
|
||||
// // OnReceive( );
|
||||
// // }
|
||||
// // //ZH
|
||||
// // /*
|
||||
// // if( Events & EV_TXEMPTY )
|
||||
// // {
|
||||
// // if( m_TXHead )
|
||||
// // {
|
||||
// // GetOverlappedResult(m_PortHandle,&m_TransmitOLap,&BytesWritten,TRUE);
|
||||
// // if( BytesWritten )
|
||||
// // AddToDebug( m_TXHead->Buffer, BytesWritten, 2 );
|
||||
// // OnTransmit( 0, BytesWritten );
|
||||
// // SendBuffer(TRUE);
|
||||
// // }
|
||||
// // }
|
||||
// // */
|
||||
// // if(Events & EV_BREAK)
|
||||
// // TRACE(_T("Break detected\n"));
|
||||
// // if(Events & EV_CTS)
|
||||
// // TRACE(_T("CTS Changed State\n"));
|
||||
// // if(Events & EV_DSR)
|
||||
// // TRACE(_T("DSR Changed State\n"));
|
||||
// // if(Events & EV_ERR)
|
||||
// // TRACE(_T("Line error\n"));
|
||||
// // if(Events & EV_RLSD)
|
||||
// // TRACE(_T("EV_RLSD error\n"));
|
||||
// // }
|
||||
//
|
||||
// // Go round while the port is open
|
||||
// }
|
||||
// while (IsOpen());
|
||||
//}
|
||||
void CPSerial::ReceiveTask(void)
|
||||
{
|
||||
//DWORD BytesWritten;
|
||||
@@ -494,69 +565,56 @@ void CPSerial::ReceiveTask(void)
|
||||
|
||||
do
|
||||
{
|
||||
Sleep(2);
|
||||
BYTE abIn[MAXBLOCK];
|
||||
int len;
|
||||
len = ReadBlock(abIn, MAXBLOCK);
|
||||
if ((len > 0) && (len < MAX_RECIEVE_BUFFER_SIZE))
|
||||
Events = 0;
|
||||
|
||||
// Wait for a comm event
|
||||
State = WaitCommEvent(m_PortHandle, &Events, &m_ReceiveOLap);
|
||||
if (!State)
|
||||
{
|
||||
//memset(m_RecvData, 0, m_iRecvBytes);
|
||||
memcpy(m_RecvData, abIn, len);
|
||||
m_iRecvBytes = len;
|
||||
m_iRecvState = TRUE;
|
||||
// Since we are using overlapping IO we may have to wait
|
||||
// for the result
|
||||
if (GetLastError() == ERROR_IO_PENDING)
|
||||
GetOverlappedResult(m_PortHandle, &m_ReceiveOLap, &State, TRUE);
|
||||
}
|
||||
//m_iRecvState=FALSE;
|
||||
// If we have a result then OK otherwise the event was probable
|
||||
// the serial port being closed and we shall exit the loop
|
||||
if (State && IsOpen())
|
||||
{
|
||||
// Check the events and act accordingly
|
||||
if (Events & EV_RXCHAR)
|
||||
{
|
||||
OnReceive();
|
||||
}
|
||||
//ZH
|
||||
/*
|
||||
if( Events & EV_TXEMPTY )
|
||||
{
|
||||
if( m_TXHead )
|
||||
{
|
||||
GetOverlappedResult(m_PortHandle,&m_TransmitOLap,&BytesWritten,TRUE);
|
||||
if( BytesWritten )
|
||||
AddToDebug( m_TXHead->Buffer, BytesWritten, 2 );
|
||||
OnTransmit( 0, BytesWritten );
|
||||
SendBuffer(TRUE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (Events & EV_BREAK)
|
||||
TRACE(_T("Break detected\n"));
|
||||
if (Events & EV_CTS)
|
||||
TRACE(_T("CTS Changed State\n"));
|
||||
if (Events & EV_DSR)
|
||||
TRACE(_T("DSR Changed State\n"));
|
||||
if (Events & EV_ERR)
|
||||
TRACE(_T("Line error\n"));
|
||||
if (Events & EV_RLSD)
|
||||
TRACE(_T("EV_RLSD error\n"));
|
||||
}
|
||||
// Events=0;
|
||||
//
|
||||
// // Wait for a comm event
|
||||
// State=WaitCommEvent(m_PortHandle,&Events,&m_ReceiveOLap);
|
||||
// if(!State)
|
||||
// {
|
||||
// // Since we are using overlapping IO we may have to wait
|
||||
// // for the result
|
||||
// if(GetLastError() == ERROR_IO_PENDING)
|
||||
// GetOverlappedResult(m_PortHandle,&m_ReceiveOLap,&State,TRUE);
|
||||
// }
|
||||
////m_iRecvState=FALSE;
|
||||
// // If we have a result then OK otherwise the event was probable
|
||||
// // the serial port being closed and we shall exit the loop
|
||||
// if( State && IsOpen( ) )
|
||||
// {
|
||||
// // Check the events and act accordingly
|
||||
// if( Events & EV_RXCHAR )
|
||||
// {
|
||||
// OnReceive( );
|
||||
// }
|
||||
// //ZH
|
||||
// /*
|
||||
// if( Events & EV_TXEMPTY )
|
||||
// {
|
||||
// if( m_TXHead )
|
||||
// {
|
||||
// GetOverlappedResult(m_PortHandle,&m_TransmitOLap,&BytesWritten,TRUE);
|
||||
// if( BytesWritten )
|
||||
// AddToDebug( m_TXHead->Buffer, BytesWritten, 2 );
|
||||
// OnTransmit( 0, BytesWritten );
|
||||
// SendBuffer(TRUE);
|
||||
// }
|
||||
// }
|
||||
// */
|
||||
// if(Events & EV_BREAK)
|
||||
// TRACE(_T("Break detected\n"));
|
||||
// if(Events & EV_CTS)
|
||||
// TRACE(_T("CTS Changed State\n"));
|
||||
// if(Events & EV_DSR)
|
||||
// TRACE(_T("DSR Changed State\n"));
|
||||
// if(Events & EV_ERR)
|
||||
// TRACE(_T("Line error\n"));
|
||||
// if(Events & EV_RLSD)
|
||||
// TRACE(_T("EV_RLSD error\n"));
|
||||
// }
|
||||
|
||||
// Go round while the port is open
|
||||
}
|
||||
while (IsOpen());
|
||||
} while (IsOpen());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// OnReceive() : Default OnReceive()
|
||||
// V114
|
||||
@@ -567,7 +625,12 @@ void CPSerial::OnReceive()
|
||||
char s[MAX_RECIEVE_BUFFER_SIZE] = {0};
|
||||
s[1] = '\0';
|
||||
CurrentPointer = 0;
|
||||
printf("MAX_RECIEVE_BUFFER_SIZE: %d m_HandShake:%d\n", MAX_RECIEVE_BUFFER_SIZE, m_HandShake);
|
||||
int num = 0;
|
||||
printf(" m_HandShake:%d\n", m_HandShake); //打印握手类型
|
||||
|
||||
Sleep(100); //延时100ms ,等待接收
|
||||
|
||||
|
||||
if (m_HandShake == CS_HANDSHAKE_FOR_TRESASTR_E)
|
||||
{
|
||||
int num = ReadPort(s, MAX_RECIEVE_BUFFER_SIZE);
|
||||
@@ -593,8 +656,8 @@ void CPSerial::OnReceive()
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = ReadPort(s, m_iRecvCount);
|
||||
printf("----RECV: %d----\r\n", num);
|
||||
num = ReadPort(s, m_iRecvCount);
|
||||
printf("----Data received:: %d----\r\n", num);
|
||||
if ((num > 0) && (num < MAX_RECIEVE_BUFFER_SIZE))
|
||||
{
|
||||
// memset(m_RecvData,0,m_iRecvBytes);
|
||||
@@ -614,6 +677,92 @@ void CPSerial::OnReceive()
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ReadPort() : Read the specifed number of bytes.
|
||||
//
|
||||
#if 0
|
||||
DWORD CPSerial::ReadPort(char* Buffer, DWORD Bytes)
|
||||
{
|
||||
DWORD recieved, Error;
|
||||
BOOL ReadState;
|
||||
|
||||
long len = 0;
|
||||
int read_loop = 1;
|
||||
// Check the port is open
|
||||
if (IsOpen())
|
||||
{
|
||||
// Enter a critical section incase this is been used from multiple threads
|
||||
// EnterCriticalSection(&m_ReadLock);
|
||||
// Start the read
|
||||
while (read_loop != 0)
|
||||
{
|
||||
//BOOL ReadFile(
|
||||
// HANDLE hFile, //文件的句柄
|
||||
// LPVOID lpBuffer, //用于保存读入数据的一个缓冲区
|
||||
// DWORD nNumberOfBytesToRead, //要读入的字节数
|
||||
// LPDWORD lpNumberOfBytesRead, //指向实际读取字节数的指针
|
||||
// LPOVERLAPPED lpOverlapped
|
||||
// //如文件打开时指定了FILE_FLAG_OVERLAPPED,那么必须,用这个参数引用一个特殊的结构。
|
||||
// //该结构定义了一次异步读取操作。否则,应将这个参数设为NULL
|
||||
//);
|
||||
ReadState = ReadFile(m_PortHandle, Buffer, 1, &recieved, &m_ReadOLap);
|
||||
printf("Bytes: %d\r\n", Bytes);
|
||||
if (!ReadState)
|
||||
{
|
||||
Sleep(3);
|
||||
// the specifed number of bytes were not available so
|
||||
// the read will continue in the background aslong as
|
||||
// GetLastError() returns ERROR_IO_PENDING
|
||||
if (GetLastError() == ERROR_IO_PENDING)
|
||||
{
|
||||
// Wait for the read to complete
|
||||
WaitForSingleObject(m_ReadOLap.hEvent, LONG_TIMEOUT); // GER
|
||||
|
||||
// get the result of the read
|
||||
if (GetOverlappedResult(m_PortHandle, &m_ReadOLap, &recieved, FALSE) == 0)
|
||||
Error = GetLastError();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Gone wrong so clear any erros
|
||||
ClearCommError(m_PortHandle, &Error, nullptr);
|
||||
recieved = 0;
|
||||
}
|
||||
}
|
||||
|
||||
len++;
|
||||
printf("BytesRead:%d %s\r\n", len, std::to_string(recieved));
|
||||
// recieved prompt, so end read loop
|
||||
if ((len == 2) && (Buffer[0] == '6F') && (Buffer[1] == '6B'))
|
||||
{
|
||||
printf("1111");
|
||||
read_loop = 0;
|
||||
}
|
||||
|
||||
// recieve nothing so quit
|
||||
if (len <= 0) { read_loop = 0; }
|
||||
|
||||
if (Buffer[len - 1] != '\r')
|
||||
{
|
||||
printf("%C", Buffer[len - 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0;
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
//ZH
|
||||
/*
|
||||
// Read some bytes so add then to the debug list
|
||||
if( BytesRead )
|
||||
AddToDebug( Buffer, BytesRead, 1 );
|
||||
*/
|
||||
// LeaveCriticalSection( &m_ReadLock );
|
||||
}
|
||||
}
|
||||
|
||||
return (len);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
DWORD CPSerial::ReadPort(char* Buffer, DWORD Bytes)
|
||||
{
|
||||
@@ -630,7 +779,7 @@ DWORD CPSerial::ReadPort(char* Buffer, DWORD Bytes)
|
||||
ReadState = ReadFile(m_PortHandle, Buffer, Bytes, &BytesRead, &m_ReadOLap);
|
||||
if (!ReadState)
|
||||
{
|
||||
Sleep(3);
|
||||
Sleep(5);
|
||||
// the specifed number of bytes were not available so
|
||||
// the read will continue in the background aslong as
|
||||
// GetLastError() returns ERROR_IO_PENDING
|
||||
@@ -658,12 +807,11 @@ DWORD CPSerial::ReadPort(char* Buffer, DWORD Bytes)
|
||||
AddToDebug( Buffer, BytesRead, 1 );
|
||||
*/
|
||||
// LeaveCriticalSection( &m_ReadLock );
|
||||
}
|
||||
}
|
||||
|
||||
return (BytesRead);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ReadPort() : Read the specifed number of bytes into a CString class.
|
||||
//
|
||||
|
||||
@@ -191,9 +191,9 @@ public:
|
||||
|
||||
// BV Nov 2001: Made public
|
||||
// CRITICAL_SECTION m_QueueLock;
|
||||
BOOL m_iRecvState;
|
||||
INT m_iRecvBytes;
|
||||
INT m_iRecvCount;
|
||||
BOOL m_iRecvState; //接收状态
|
||||
INT m_iRecvBytes; //接收字节数
|
||||
INT m_iRecvCount; //接收计数
|
||||
unsigned char m_RecvData[MAX_RECIEVE_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
#define HSI_VERSION_REVNUM
|
||||
#define HSI_VERSION_BUILD_DATE _T(__DATE__ )
|
||||
#define HSI_VERSION_BUILD_TIME _T(__TIME__ )
|
||||
#define HSI_FILE_DESCRIPTION "2022.11.22 / 15:35 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2022.11.22 / 15:35 ")
|
||||
#define HSI_FILE_DESCRIPTION "2022.11.24 / 16:22 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2022.11.24 / 16:22 ")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using static HSI_SEVENOCEAN_EF1_CsTest.HSI.Def;
|
||||
|
||||
namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
|
||||
{
|
||||
@@ -25,7 +26,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
|
||||
//1、返回值不能为void,且需要使用ref关键字(或者ref readonly表示只读)修饰返回类型
|
||||
//2、方法的每一个return语句需要是一个ref引用
|
||||
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_GET_FIREWAREVERION", CharSet = CharSet.Unicode)]
|
||||
public static extern Def.HSI_STATUS MotionGetFirewareVerion( IntPtr firewareVerion);
|
||||
public static extern Def.HSI_STATUS MotionGetFirewareVerion(IntPtr firewareVerion);
|
||||
|
||||
[DllImport("HSI.dll", EntryPoint = "HSI_STARTUP", CharSet = CharSet.Unicode)]
|
||||
public static extern Def.HSI_STATUS Startup(IntPtr hWnd, bool bOfflineOnly);
|
||||
@@ -68,7 +69,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
|
||||
var eventFunctionId = (Def.HSI_EVENT_FUNCTION_ID)eventId;
|
||||
switch (eventFunctionId)
|
||||
{
|
||||
case Def.HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOTION_DCC_HOME://×¼±¸»Ø¼Ò
|
||||
case Def.HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOTION_DCC_HOME: //准备回家
|
||||
{
|
||||
MessageBox.Show(Resources.Interface_Tips_Home_Machine, Resources.Interface_Tips,
|
||||
msgBtn, MessageBoxIcon.Information);
|
||||
@@ -132,6 +133,16 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
|
||||
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_SET_SPEED_XYZ", CharSet = CharSet.Unicode)]
|
||||
public static extern Def.HSI_STATUS SetSpeedXyz(double speed);
|
||||
|
||||
|
||||
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_DCC_SCAN_SET_DATA", CharSet = CharSet.Unicode)]
|
||||
public static extern Def.HSI_STATUS DCCScanSetData(uint axisTypes, Def.HSI_SCAN_MOTION_TYPE eType, uint lTrigNumber, double[] dTrigDis);
|
||||
|
||||
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_DCC_SCAN_START", CharSet = CharSet.Unicode)]
|
||||
public static extern Def.HSI_STATUS DCCScanStart();
|
||||
|
||||
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_DCC_SCAN_STOP", CharSet = CharSet.Unicode)]
|
||||
public static extern Def.HSI_STATUS DCCScanStop();
|
||||
|
||||
//[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_GET_SPEED_R", CharSet = CharSet.Unicode)]
|
||||
//public static extern Def.HSI_STATUS GetSpeedR(ref double speed);
|
||||
|
||||
@@ -367,6 +378,17 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
|
||||
HSI_ILLUMINATION_BULB_GRID = 4
|
||||
}
|
||||
|
||||
public enum HSI_SCAN_MOTION_TYPE
|
||||
{
|
||||
HSI_SCAN_MOTION_LINEAR = 1,
|
||||
HSI_SCAN_MOTION_CIRCULAR,
|
||||
HSI_SCAN_MOTION_SPEC_LOCA = 100,//EF1
|
||||
HSI_SCAN_MOTION_EQ_DIS,
|
||||
HSI_SCAN_MOTION_EQ_DIS_II,
|
||||
HSI_SCAN_MOTION_LINEAR_TEST,//测试使用
|
||||
HSI_SCAN_MOTION_EQ_TEST,//测试使用
|
||||
HSI_SCAN_MOTION_MANUAL_TEST //测试使用
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//Illumination API
|
||||
@@ -437,18 +459,42 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
|
||||
HSI_MOTION_AXIS_Y = 0x0002, // This is the default "Sensor level" Y Axis - use on single Y axis machines
|
||||
HSI_MOTION_AXIS_Z = 0x0004, // This is the default "Sensor level" Z Axis - use on single Z axis machines
|
||||
HSI_MOTION_AXIS_R = 0x0008, // This is the default "Sensor level" R Axis - use on single R axis machines
|
||||
HSI_MOTION_AXIS_X1 = 0x0010, // This is the 1st X Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_Y1 = 0x0020, // This is the 1st Y Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_Z1 = 0x0040, // This is the 1st Z Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_R1 = 0x0080, // This is the 1st R Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_X2 = 0x0100, // This is the 2nd X Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_Y2 = 0x0200, // This is the 2nd Y Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_Z2 = 0x0400, // This is the 2nd Z Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_R2 = 0x0800, // This is the 2nd R Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_X3 = 0x1000, // This is the 3rd X Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_Y3 = 0x2000, // This is the 3rd Y Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_Z3 = 0x4000, // This is the 3rd Z Axis - use on multiple axis machines when specific axis needed
|
||||
HSI_MOTION_AXIS_R3 = 0x8000 // This is the 3rd R Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_X1 =
|
||||
0x0010, // This is the 1st X Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_Y1 =
|
||||
0x0020, // This is the 1st Y Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_Z1 =
|
||||
0x0040, // This is the 1st Z Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_R1 =
|
||||
0x0080, // This is the 1st R Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_X2 =
|
||||
0x0100, // This is the 2nd X Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_Y2 =
|
||||
0x0200, // This is the 2nd Y Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_Z2 =
|
||||
0x0400, // This is the 2nd Z Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_R2 =
|
||||
0x0800, // This is the 2nd R Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_X3 =
|
||||
0x1000, // This is the 3rd X Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_Y3 =
|
||||
0x2000, // This is the 3rd Y Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_Z3 =
|
||||
0x4000, // This is the 3rd Z Axis - use on multiple axis machines when specific axis needed
|
||||
|
||||
HSI_MOTION_AXIS_R3 =
|
||||
0x8000 // This is the 3rd R Axis - use on multiple axis machines when specific axis needed
|
||||
}
|
||||
|
||||
public enum HSI_MOTION_IO_TYPE
|
||||
|
||||
@@ -136,10 +136,20 @@ namespace HSI_SEVENOCEAN_EF1_CsTest
|
||||
{
|
||||
SpeedGear = 0.1;
|
||||
}
|
||||
|
||||
Console.WriteLine("Motion.SpeedGera:{0}", SpeedGear);
|
||||
break;
|
||||
|
||||
case ConsoleKey.NumPad5:
|
||||
Motion.DCCScanStart();
|
||||
break;
|
||||
case ConsoleKey.NumPad7:
|
||||
Motion.DCCScanStop();
|
||||
break;
|
||||
case ConsoleKey.NumPad9:
|
||||
var dPos1 = new double[3];
|
||||
dPos1[0] = 100;
|
||||
Motion.DCCScanSetData(1, Def.HSI_SCAN_MOTION_TYPE.HSI_SCAN_MOTION_EQ_DIS,7, dPos1);
|
||||
break;
|
||||
//case ConsoleKey.LeftArrow:
|
||||
// break;
|
||||
//case ConsoleKey.RightArrow:
|
||||
|
||||
Reference in New Issue
Block a user