新增光栅尺、限位位置设置。
This commit is contained in:
@@ -511,16 +511,6 @@ CSO7_Proto::CSO7_Proto()
|
||||
g_machine.Light_Size=0;
|
||||
g_machine.Light_Switch=0;
|
||||
g_machine.SEQ_NUMBER=0;
|
||||
g_machine.s_machine_config.x_axis._scale_resolution=0.5;
|
||||
g_machine.s_machine_config.y_axis._scale_resolution=0.5;
|
||||
g_machine.s_machine_config.z_axis._scale_resolution=0.5;
|
||||
|
||||
g_machine.s_machine_config.x_axis._neg_working_limit=0;
|
||||
g_machine.s_machine_config.x_axis._pos_working_limit=400;
|
||||
g_machine.s_machine_config.y_axis._neg_working_limit=0;
|
||||
g_machine.s_machine_config.y_axis._pos_working_limit=300;
|
||||
g_machine.s_machine_config.z_axis._neg_working_limit=0;
|
||||
g_machine.s_machine_config.z_axis._pos_working_limit=200;
|
||||
|
||||
g_machine.s_machine_config.x_axis._MoveToSpeed[0]=0.0;
|
||||
g_machine.s_machine_config.x_axis._MoveToSpeed[1]=0.0;
|
||||
@@ -624,9 +614,21 @@ SSI_STATUS_MOTION CSO7_Proto::so7_config_para_set_default()
|
||||
g_machine.s_machine_config.motion.m_MachineType=MACHINE_SO7_CONTROLLER;
|
||||
g_machine.s_machine_config.motion.m_VideoCardType=0;
|
||||
|
||||
|
||||
g_machine.s_machine_config.x_axis._scale_resolution=0.5;
|
||||
g_machine.s_machine_config.y_axis._scale_resolution=0.5;
|
||||
g_machine.s_machine_config.z_axis._scale_resolution=0.5;
|
||||
|
||||
g_machine.s_machine_config.x_axis._neg_working_limit=0;
|
||||
g_machine.s_machine_config.x_axis._pos_working_limit=200;
|
||||
g_machine.s_machine_config.y_axis._neg_working_limit=0;
|
||||
g_machine.s_machine_config.y_axis._pos_working_limit=100;
|
||||
g_machine.s_machine_config.z_axis._neg_working_limit=0;
|
||||
g_machine.s_machine_config.z_axis._pos_working_limit=200;
|
||||
|
||||
g_machine.s_machine_config.motion.m_RotaryCircleDis=7.2;
|
||||
g_machine.s_machine_config.motion.m_RotaryCirclePulse=14400;
|
||||
g_machine.s_machine_config.motion.m_RotaryAxisNO=MACHINE_AXIS_Y;
|
||||
g_machine.s_machine_config.motion.m_RotaryAxisNO=MACHINE_AXIS_NONE;
|
||||
|
||||
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
@@ -2022,6 +2024,7 @@ SSI_STATUS_MOTION CSO7_Proto::Load_SevenOcean_Inifile(CString cso7IniFile)
|
||||
g_machine._motor_pulse_num=atoi(cTemp);
|
||||
}
|
||||
}
|
||||
/*
|
||||
//=====================[WORKTABLE]========================
|
||||
else if(!_stricmp(token, "X_SCALE_RESOLUTION"))
|
||||
{
|
||||
@@ -2113,6 +2116,7 @@ SSI_STATUS_MOTION CSO7_Proto::Load_SevenOcean_Inifile(CString cso7IniFile)
|
||||
g_machine.dRotaryCirclDis=atof(cTemp);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
fclose(hConfigFile);
|
||||
@@ -2302,6 +2306,56 @@ SSI_STATUS_MOTION CSO7_Proto::Save_So7_Config()
|
||||
fprintf(m_pOutFile, "\n");
|
||||
fprintf(m_pOutFile, ";\n");
|
||||
|
||||
|
||||
outBuff="[CUSTOM_MACHINE]";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="X_SCALE_RESOLUTION=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.x_axis._scale_resolution);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="Y_SCALE_RESOLUTION=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.y_axis._scale_resolution);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="Z_SCALE_RESOLUTION=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.z_axis._scale_resolution);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="X_NEG_WORKING_LIMIT=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.x_axis._neg_working_limit);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="X_POS_WORKING_LIMIT=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.x_axis._pos_working_limit);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="Y_NEG_WORKING_LIMIT=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.y_axis._neg_working_limit);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="Y_POS_WORKING_LIMIT=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.y_axis._pos_working_limit);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="Z_NEG_WORKING_LIMIT=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.z_axis._neg_working_limit);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="Z_POS_WORKING_LIMIT=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.z_axis._pos_working_limit);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="ROTARY_AXIS_NUMBER=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.motion.m_RotaryAxisNO);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
outBuff="ROTARY_CIR_DIS=";
|
||||
fprintf(m_pOutFile,"%s", outBuff);
|
||||
fprintf(m_pOutFile,"%d", g_machine.s_machine_config.motion.m_RotaryCircleDis);
|
||||
fprintf(m_pOutFile, "\n");
|
||||
fprintf(m_pOutFile, ";\n");
|
||||
|
||||
fclose(m_pOutFile);
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
@@ -2590,54 +2644,6 @@ SSI_STATUS_MOTION CSO7_Proto::Load_So7_Config()
|
||||
g_machine.s_machine_config.motion.m_DebugOutputEnable=atoi(cTemp);
|
||||
}
|
||||
}
|
||||
//==================Motion=============================
|
||||
else if(!_stricmp(token, "X_SCALE_RESOLUTION"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.x_axis._scale_resolution=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Y_SCALE_RESOLUTION"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.y_axis._scale_resolution=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Z_SCALE_RESOLUTION"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.z_axis._scale_resolution=atof(cTemp);
|
||||
}
|
||||
}
|
||||
//=================Rotary========================
|
||||
else if (!_stricmp(token,"ROTARY_AXIS_NUMBER"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.motion.m_RotaryAxisNO=atoi(cTemp);
|
||||
}
|
||||
}
|
||||
else if (!_stricmp(token,"ROTARY_CIR_DIS"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.motion.m_RotaryCircleDis=atof(cTemp);
|
||||
g_machine.s_machine_config.motion.m_RotaryCirclePulse=g_machine.s_machine_config.motion.m_RotaryCircleDis/ROTARY_MMtoScale_RESOLUTION;
|
||||
}
|
||||
}
|
||||
//=================VideoCard========================
|
||||
else if (!_stricmp(token,"SDK3000_SLEEP_COUNT"))
|
||||
{
|
||||
@@ -2703,6 +2709,108 @@ SSI_STATUS_MOTION CSO7_Proto::Load_So7_Config()
|
||||
g_machine.s_machine_config.motion.m_VideoCardType=atoi(cTemp);
|
||||
}
|
||||
}
|
||||
|
||||
//=================Custom machine========================
|
||||
else if(!_stricmp(token, "X_SCALE_RESOLUTION"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.x_axis._scale_resolution=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Y_SCALE_RESOLUTION"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.y_axis._scale_resolution=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Z_SCALE_RESOLUTION"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.z_axis._scale_resolution=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "X_NEG_WORKING_LIMIT"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.x_axis._neg_working_limit=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "X_POS_WORKING_LIMIT"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.x_axis._pos_working_limit=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Y_NEG_WORKING_LIMIT"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.y_axis._neg_working_limit=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Y_POS_WORKING_LIMIT"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.y_axis._pos_working_limit=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Z_NEG_WORKING_LIMIT"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.z_axis._neg_working_limit=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if(!_stricmp(token, "Z_POS_WORKING_LIMIT"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.z_axis._pos_working_limit=atof(cTemp);
|
||||
}
|
||||
}
|
||||
else if (!_stricmp(token,"ROTARY_AXIS_NUMBER"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.motion.m_RotaryAxisNO=atoi(cTemp);
|
||||
}
|
||||
}
|
||||
else if (!_stricmp(token,"ROTARY_CIR_DIS"))
|
||||
{
|
||||
token = strtok( NULL, seps);
|
||||
if (token)
|
||||
{
|
||||
strcpy(cTemp,token);
|
||||
g_machine.s_machine_config.motion.m_RotaryCircleDis=atof(cTemp);
|
||||
g_machine.s_machine_config.motion.m_RotaryCirclePulse=g_machine.s_machine_config.motion.m_RotaryCircleDis/ROTARY_MMtoScale_RESOLUTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(hConfigFile);
|
||||
@@ -3734,6 +3842,148 @@ SSI_STATUS_MOTION CSO7_Proto::_get_xyz_index(long & lX, long & lY, long & lZ)
|
||||
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
};
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_jog(EMACHINE_AXIS cAxis,char cSpeedGear)
|
||||
{
|
||||
if (abs(cSpeedGear)>4)
|
||||
{
|
||||
if (cSpeedGear>0)
|
||||
{
|
||||
cSpeedGear=4;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSpeedGear=-4;
|
||||
}
|
||||
}
|
||||
if (abs(cSpeedGear)<1)
|
||||
{
|
||||
cSpeedGear=1;
|
||||
}
|
||||
switch (cAxis)
|
||||
{
|
||||
case MACHINE_AXIS_X:
|
||||
{
|
||||
if (cSpeedGear==4)
|
||||
{
|
||||
double dXStart(0.0), dYStart(0.0), dZStart(0.0);
|
||||
so7_motion_get_position_xyz(dXStart, dYStart, dZStart);
|
||||
return so7_motion_set_position_xyz(g_machine.s_machine_config.x_axis._pos_working_limit,dYStart,dZStart,false);
|
||||
}
|
||||
else if (cSpeedGear==-4)
|
||||
{
|
||||
double dXStart(0.0), dYStart(0.0), dZStart(0.0);
|
||||
so7_motion_get_position_xyz(dXStart, dYStart, dZStart);
|
||||
return so7_motion_set_position_xyz(g_machine.s_machine_config.x_axis._neg_working_limit,dYStart,dZStart,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _send_cmd_SO7_CMD_MOVE_X(cSpeedGear);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MACHINE_AXIS_Y:
|
||||
{
|
||||
if (cSpeedGear==4)
|
||||
{
|
||||
double dXStart(0.0), dYStart(0.0), dZStart(0.0);
|
||||
so7_motion_get_position_xyz(dXStart, dYStart, dZStart);
|
||||
return so7_motion_set_position_xyz(dXStart,g_machine.s_machine_config.y_axis._pos_working_limit,dZStart,false);
|
||||
}
|
||||
else if (cSpeedGear==-4)
|
||||
{
|
||||
double dXStart(0.0), dYStart(0.0), dZStart(0.0);
|
||||
so7_motion_get_position_xyz(dXStart, dYStart, dZStart);
|
||||
return so7_motion_set_position_xyz(dXStart,g_machine.s_machine_config.y_axis._neg_working_limit,dZStart,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _send_cmd_SO7_CMD_MOVE_Y(cSpeedGear);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MACHINE_AXIS_Z:
|
||||
{
|
||||
if (cSpeedGear==4)
|
||||
{
|
||||
double dXStart(0.0), dYStart(0.0), dZStart(0.0);
|
||||
so7_motion_get_position_xyz(dXStart, dYStart, dZStart);
|
||||
return so7_motion_set_position_xyz(dXStart,dYStart,g_machine.s_machine_config.z_axis._pos_working_limit,false);
|
||||
}
|
||||
else if (cSpeedGear==-4)
|
||||
{
|
||||
double dXStart(0.0), dYStart(0.0), dZStart(0.0);
|
||||
so7_motion_get_position_xyz(dXStart, dYStart, dZStart);
|
||||
return so7_motion_set_position_xyz(dXStart,dYStart,g_machine.s_machine_config.z_axis._neg_working_limit,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _send_cmd_SO7_CMD_MOVE_Z(cSpeedGear);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MACHINE_AXIS_ZOOM:
|
||||
{
|
||||
if (abs(cSpeedGear)==4)
|
||||
{
|
||||
if (cSpeedGear>0)
|
||||
{
|
||||
cSpeedGear=5;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSpeedGear=-5;
|
||||
}
|
||||
}
|
||||
else if (abs(cSpeedGear)==3)
|
||||
{
|
||||
if (cSpeedGear>0)
|
||||
{
|
||||
cSpeedGear=5;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSpeedGear=-5;
|
||||
}
|
||||
}
|
||||
else if (abs(cSpeedGear)==2)
|
||||
{
|
||||
if (cSpeedGear>0)
|
||||
{
|
||||
cSpeedGear=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSpeedGear=-1;
|
||||
}
|
||||
}
|
||||
else if (abs(cSpeedGear)==1)
|
||||
{
|
||||
if (cSpeedGear>0)
|
||||
{
|
||||
cSpeedGear=2;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSpeedGear=-2;
|
||||
}
|
||||
}
|
||||
return _send_cmd_SO7_CMD_MOVE_ZM(cSpeedGear);
|
||||
break;
|
||||
}
|
||||
case MACHINE_AXIS_R:
|
||||
{
|
||||
return so7_motion_move_R(cSpeedGear);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return SSI_STATUS_MOTION_INVALID_PARAMETERS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_get_position_xyz(double & dX, double & dY, double & dZ)
|
||||
{
|
||||
@@ -3776,11 +4026,44 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_xyz(double dX, double dY,
|
||||
SO7AXISMOVE Z;
|
||||
|
||||
X.dFromMM = dXStart;
|
||||
X.dToMM = dX;
|
||||
if (dX<g_machine.s_machine_config.x_axis._neg_working_limit)
|
||||
{
|
||||
X.dToMM=g_machine.s_machine_config.x_axis._neg_working_limit;
|
||||
}
|
||||
else if (dX>g_machine.s_machine_config.x_axis._pos_working_limit)
|
||||
{
|
||||
X.dToMM=g_machine.s_machine_config.x_axis._pos_working_limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
X.dToMM = dX;
|
||||
}
|
||||
Y.dFromMM = dYStart;
|
||||
Y.dToMM = dY;
|
||||
if (dY<g_machine.s_machine_config.y_axis._neg_working_limit)
|
||||
{
|
||||
Y.dToMM=g_machine.s_machine_config.y_axis._neg_working_limit;
|
||||
}
|
||||
else if (dY>g_machine.s_machine_config.y_axis._pos_working_limit)
|
||||
{
|
||||
Y.dToMM=g_machine.s_machine_config.y_axis._pos_working_limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
Y.dToMM = dY;
|
||||
}
|
||||
Z.dFromMM = dZStart;
|
||||
Z.dToMM = dZ;
|
||||
if (dZ<g_machine.s_machine_config.z_axis._neg_working_limit)
|
||||
{
|
||||
Z.dToMM=g_machine.s_machine_config.z_axis._neg_working_limit;
|
||||
}
|
||||
else if (dZ>g_machine.s_machine_config.z_axis._pos_working_limit)
|
||||
{
|
||||
Z.dToMM=g_machine.s_machine_config.z_axis._pos_working_limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z.dToMM = dZ;
|
||||
}
|
||||
|
||||
X.from = MMtoScale(dXStart, g_machine.s_machine_config.x_axis._scale_resolution);
|
||||
X.to = MMtoScale(dX, g_machine.s_machine_config.x_axis._scale_resolution);
|
||||
|
||||
Reference in New Issue
Block a user