private void OnIrixiAxisStateChanged(object sender, Tuple <byte, AxisArgs> e) { int AxisNo = e.Item1 - 1; AxisArgsList[AxisNo].CurAbsPos = e.Item2.CurAbsPos; AxisArgsList[AxisNo].IsBusy = e.Item2.IsBusy; AxisArgsList[AxisNo].IsHomed = e.Item2.IsHomed; AxisArgsList[AxisNo].IsInRequest = e.Item2.IsInRequest; OnAxisStateChanged?.Invoke(this, e.Item1 - 1, AxisArgsList[AxisNo]); if (AxisArgsList[AxisNo].ErrorCode != e.Item2.ErrorCode) { AxisArgsList[AxisNo].ErrorCode = e.Item2.ErrorCode; if (e.Item2.ErrorCode != 0) { OnErrorOccured?.Invoke(this, e.Item2.ErrorCode, ParseErrorCode(e.Item2.ErrorCode)); } } }
private void OnIrixiAxisStateChanged(object sender, UnitState e) { int AxisNo = e.UnitID - (int)UnitID.U1; AxisArgsList[AxisNo].CurAbsPos = (double)e.AbsPosition / AxisArgsList[AxisNo].GainFactor; AxisArgsList[AxisNo].IsBusy = e.IsBusy; AxisArgsList[AxisNo].IsHomed = e.IsHomed; AxisArgsList[AxisNo].IsHomedAndNotBusy = e.IsHomed && (!e.IsBusy); AxisArgsList[AxisNo].CurAbsPosPuse = e.AbsPosition; OnAxisStateChanged?.Invoke(this, AxisNo, AxisArgsList[AxisNo]); if (AxisArgsList[AxisNo].ErrorCode != (byte)e.Error) { AxisArgsList[AxisNo].ErrorCode = (byte)e.Error; if ((byte)e.Error != 0) { OnErrorOccured?.Invoke(this, (int)e.Error, ParseErrorCode((int)e.Error)); } } }