diff --git a/Rs.SkyLine/Commom/Ops.cs b/Rs.SkyLine/Commom/Ops.cs index 7d97e8d..a7b7fb3 100644 --- a/Rs.SkyLine/Commom/Ops.cs +++ b/Rs.SkyLine/Commom/Ops.cs @@ -378,12 +378,45 @@ namespace Rs.MotionPlat.Commom public static bool IsOn(string ioName) { - return IoManager.Instance.ReadIn(ioName) == 1; + int num = 0; + short val = 0; + while (num<3) + { + val = IoManager.Instance.ReadIn(ioName); + if(val==0) + { + num++; + Thread.Sleep(20); + } + else + { + num = 0; + break; + } + } + return val == 1; } public static bool IsOff(string ioName) { - return IoManager.Instance.ReadIn(ioName) == 0; + int num = 0; + short val = 0; + while (num < 3) + { + val = IoManager.Instance.ReadIn(ioName); + if (val == 1) + { + num++; + Thread.Sleep(20); + } + else + { + num = 0; + break; + } + } + return val == 0; + //return IoManager.Instance.ReadIn(ioName) == 0; } public static bool IsOutOn(string ioName)