/// <summary> /// 停止M2X4裝置 (復歸流程中不停止homeTask) /// </summary> public void Stop(StopType type, bool isStopTask = true) { I16 rc = -1; if (axisPara.IsActive && axisPara.Enabled) { if (type == StopType.Emergency) { rc = CCMNet.CS_mnet_m204_emg_stop(RingNoOfMNet, axisPara.SlaveIP, (U16)axisPara.AxisNo); } if (type == StopType.SlowDown) { rc = CCMNet.CS_mnet_m204_sd_stop(RingNoOfMNet, axisPara.SlaveIP, (U16)axisPara.AxisNo, axisPara.DecVelM); } if (type == StopType.CmdWait) { //if (this.IsReached || nPos == 0) if (!this.IsBusy || axisPara.StopCmdWaitSeconds == 0) { Stop(StopType.SlowDown, isStopTask); } else { Task.Factory.StartNew(() => { //if (!SpinWait.SpinUntil(() => this.IsReached, 3000)) if (!SpinWait.SpinUntil(() => !this.IsBusy, (int)(axisPara.StopCmdWaitSeconds * 1000))) { NotifyLogger.Post("Motor {0} CmdWait Stop Timeout", this.DeviceName); } Stop(StopType.SlowDown, isStopTask); }); } } if (isStopTask) { l122M2X4HomeFlow.Stop(); } } }
private void Load(string folderPath, string fileName, string cultureName) { try { string filePath = string.Format(@"{0}\{1}", folderPath, fileName); if (!File.Exists(filePath)) { return; } List <string> csvStrings = SimpleCsvHelper.ReadCsvToList(filePath); for (int i = 1; i < csvStrings.Count; i++) { string[] subItems = csvStrings[i].Split(','); ErrorCode errorCode = new ErrorCode() { ErrorType = (ErrorType)Enum.Parse(typeof(ErrorType), subItems[0]), Code = int.Parse(subItems[1]), Message = subItems[2], Remark = subItems[3] }; if (errorCode.ErrorType == ErrorType.Alarm) { _dicAlarmCodeCollection.Add(string.Format("{0}_{1}", cultureName, errorCode.Code), errorCode); } else { _dicWarningCodeCollection.Add(string.Format("{0}_{1}", cultureName, errorCode.Code), errorCode); } } } catch (Exception ex) { LogHelper.Exception(ex); NotifyLogger.Post(ex); } }