优化获取到位信号bug

master
lhiven 1 year ago
parent e23abe37ae
commit 8c3dcd9910

@ -101,6 +101,13 @@ namespace Rs.Motion.GugaoPulse
diConfig.filterTime = 3;
apiResult = mc_pulse_cfg.GT_SetDiConfig((short)Config.CardId, mc_pulse.MC_LIMIT_NEGATIVE, (short)Config.AxisId, ref diConfig);
}
if (Config.EnableInp == 1)
{
apiResult = mc_pulse_cfg.GT_GetDiConfig((short)Config.CardId, mc_pulse.MC_ARRIVE, (short)Config.AxisId, out diConfig);
diConfig.active = 1;
diConfig.reverse = (short)Config.InpLogic;
apiResult = mc_pulse_cfg.GT_SetDiConfig((short)Config.CardId, mc_pulse.MC_ARRIVE, (short)Config.AxisId, ref diConfig);
}
apiResult = mc_pulse_cfg.GT_GetDiConfig((short)Config.CardId, mc_pulse.MC_HOME, (short)Config.AxisId, out diConfig);
diConfig.active = 1;
diConfig.reverse = (short)Config.HomeOrgLogic;
@ -933,18 +940,19 @@ namespace Rs.Motion.GugaoPulse
{
return ErrorCode.Ok;
}
#region 禁用到位信号判断
bool bINP = false;
err = GetInpStatus(out bINP);
if (err > ErrorCode.Ok)
if(Config.EnableInp==1)
{
return err;
}
if (!bINP)
{
return ErrorCode.Ok;
bool bINP = false;
err = GetInpStatus(out bINP);
if (err > ErrorCode.Ok)
{
return err;
}
if (!bINP)
{
return ErrorCode.Ok;
}
}
#endregion
double dfCurrentTorlance = 0.0;
double dfTorlance = Math.Abs(Config.Tolerance);
err = GetTolerance(out dfCurrentTorlance);
@ -1224,12 +1232,14 @@ namespace Rs.Motion.GugaoPulse
{
return ErrorCode.CardNotInit;
}
apiResult = mc_pulse.GT_GetSts((short)Config.CardId, (short)Config.AxisId, out int pSts, 1, out uint pClock);
//apiResult = mc_pulse.GT_GetSts((short)Config.CardId, (short)Config.AxisId, out int pSts, 1, out uint pClock);
apiResult = mc_pulse.GT_GetDi((short)Config.CardId, mc_pulse.MC_ARRIVE, out int pvalue);
if (apiResult != 0)
{
return ErrorCode.Fail;
}
bIsOn = ((pSts >> 11) & 0x01) == 1;
//bIsOn = ((pSts >> 11) & 0x01) == 1;
bIsOn = ((pvalue >> (short)Config.AxisId-1) & 0x01) == 1;
return ErrorCode.Ok;
}

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.20.24.7")]
[assembly: AssemblyVersion("2.20.24.8")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

Loading…
Cancel
Save