/* * Created by SharpDevelop. * User: amkor * Date: 5/16/2018 * Time: 3:08 PM * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Collections; namespace Project { public static partial class Util_DO { public static Boolean isEmergencyOn() { //둘중 하나라도 켜져있드면 비상 상태이다 var b1 = GetIOInput(eDIName.BUT_EMGF); return b1; //BitArray ba1 = new BitArray(8); //ba1.Set(0, GetIOInput(eDIName.BUT_EMG1)); //ba1.Set(1, GetIOInput(eDIName.BUT_EMG2)); //ba1.Set(2, GetIOInput(eDIName.BUT_EMG3)); //ba1.Set(3, GetIOInput(eDIName.BUT_EMG4)); //return ba1.ValueI(); } /// /// 감지센서확인 /// /// public static int isVacOKL() { var cnt = 0; if (GetIOOutput(eDOName.PICK_VAC1)) cnt += 1; if (GetIOOutput(eDOName.PICK_VAC2)) cnt += 1; if (GetIOOutput(eDOName.PICK_VAC3)) cnt += 1; if (GetIOOutput(eDOName.PICK_VAC4)) cnt += 1; return cnt; } /// /// 포트에 장작된 카트의 크기를 반환합니다. 없는경우 0, 7,13 입니다. /// /// Port Index(left=0, Center=1, Right=2) /// public static eCartSize getCartSize(int idx) { var s07 = false; var s13 = false; if (idx == 0) { s07 = Util_DO.GetIOInput(eDIName.PORT0_SIZE_07); s13 = Util_DO.GetIOInput(eDIName.PORT0_SIZE_13); } else if (idx == 1) { s07 = Util_DO.GetIOInput(eDIName.PORT1_SIZE_07); s13 = Util_DO.GetIOInput(eDIName.PORT1_SIZE_13); } else { s07 = Util_DO.GetIOInput(eDIName.PORT2_SIZE_07); s13 = Util_DO.GetIOInput(eDIName.PORT2_SIZE_13); } if (s07 == false && s13 == false) return eCartSize.None; else if (s13 == true) return eCartSize.Inch13; else return eCartSize.Inch7; } public static string getPinDescription(eDIName pin) { if (pin == eDIName.L_PICK_VAC) return "(좌) 프린트 용지 감지 센서"; else if (pin == eDIName.R_PICK_VAC) return "(우) 프린트 용지 감지 센서"; else if (pin == eDIName.R_PICK_BW) return "(우) 부착실린더 후진 감지 센서"; else if (pin == eDIName.R_PICK_FW) return "(우) 부착실린더 전진 감지 센서"; else if (pin == eDIName.L_PICK_BW) return "(좌) 부착실린더 후진 감지 센서"; else if (pin == eDIName.L_PICK_FW) return "(좌) 부착실린더 전진 감지 센서"; else if (pin == eDIName.AIR_DETECT) return "AIR 감지 센서"; else return pin.ToString(); } public static string getPinDescription(eDOName pin) { if (pin == eDOName.SOL_AIR) return "AIR 공급 출력"; else if (pin == eDOName.BUZZER) return "BUZZER"; else if (pin == eDOName.CART_MAG0) return "(좌) 전자석 출력"; else if (pin == eDOName.CART_MAG1) return "(중앙) 전자석 출력"; else if (pin == eDOName.CART_MAG2) return "(우) 전자석 출력"; else if (pin == eDOName.PICK_VAC1) return "피커 진공 출력 #1"; else if (pin == eDOName.PICK_VAC2) return "피커 진공 출력 #2"; else if (pin == eDOName.PICK_VAC3) return "피커 진공 출력 #3"; else if (pin == eDOName.PICK_VAC4) return "피커 진공 출력 #4"; else if (pin == eDOName.PORT0_MOT_DIR) return "(좌) 포트 방향 출력"; else if (pin == eDOName.PORT1_MOT_DIR) return "(중앙) 포트 방향 출력"; else if (pin == eDOName.PORT2_MOT_DIR) return "(우) 포트 방향 출력"; else if (pin == eDOName.PORT0_MOT_RUN) return "(좌) 포트 동작 출력"; else if (pin == eDOName.PORT1_MOT_RUN) return "(중앙) 포트 동작 출력"; else if (pin == eDOName.PORT2_MOT_RUN) return "(우) 포트 동작 출력"; else if (pin == eDOName.PRINTL_AIRON) return "(좌) 프린트 하단 AIR"; else if (pin == eDOName.PRINTR_AIRON) return "(우) 프린트 하단 AIR"; else return pin.ToString(); } /// /// ADLink I/O Board input status /// /// /// public static Boolean GetIOInput(eDIName pin) { var curValue = Pub.dio.INPUT(GetDINum(pin) - 1); //B접점으로 쓸 것들만 반전 시킨다. if (pin == eDIName.BUT_EMGF) { if (Pub.system.ReverseSIG_Emgergency) curValue = !curValue; } else if (pin == eDIName.PICKER_SAFE) { if (Pub.system.ReverseSIG_PickerSafe) curValue = !curValue; } else if (pin == eDIName.BUT_AIRF) { if (Pub.system.ReverseSIG_ButtonAir) curValue = !curValue; } else if (pin == eDIName.DOORF1 || pin == eDIName.DOORF2 || pin == eDIName.DOORF3) { if (Pub.system.ReverseSIG_DoorF) curValue = !curValue; } else if (pin == eDIName.DOORR1 || pin == eDIName.DOORR2 || pin == eDIName.DOORR3) { if (Pub.system.ReverseSIG_DoorR) curValue = !curValue; } else if (pin == eDIName.AIR_DETECT) { if (Pub.system.ReverseSIG_AirCheck) curValue = !curValue; } else if (pin == eDIName.PORT0_LIM_UP || pin == eDIName.PORT1_LIM_UP || pin == eDIName.PORT2_LIM_UP) { if (Pub.system.ReverseSIG_PortLimitUp) curValue = !curValue; } else if (pin == eDIName.PORT0_LIM_DN || pin == eDIName.PORT1_LIM_DN || pin == eDIName.PORT2_LIM_DN) { if (Pub.system.ReverseSIG_PortLimitDn) curValue = !curValue; } else if (pin == eDIName.PORT0_DET_UP) { if (Pub.system.ReverseSIG_PortDetect0Up) curValue = !curValue; } else if (pin == eDIName.PORT1_DET_UP) { if (Pub.system.ReverseSIG_PortDetect1Up) curValue = !curValue; } else if (pin == eDIName.PORT2_DET_UP) { if (Pub.system.ReverseSIG_PortDetect2Up) curValue = !curValue; } return curValue; } /// /// ADLink I/O Board Output Status /// /// /// public static Boolean GetIOOutput(eDOName pin) { return Pub.dio.OUTPUT(GetDONum(pin) - 1); } /// /// A/D Link Digital input Pin number /// /// /// public static int GetDINum(eDIName pin) { return (int)pin + 1; //return Pub.setting.DI[(byte)pin]; } /// /// adlink digital output in number /// /// /// public static int GetDONum(eDOName pin) { return (int)pin + 1; //return Pub.setting.DO[(byte)pin]; } /// /// 포트내의 안전센서 여부 /// /// public static Boolean isSaftyDoorF(Boolean RealSensor = false) { //모든 포트가 안전해야 전체가 안전한것이다 return isSaftyDoorF(0, RealSensor) && isSaftyDoorF(1, RealSensor) && isSaftyDoorF(2, RealSensor); } public static Boolean isSaftyDoorF(int idx, Boolean RealSensor) { if (idx == 0 && Pub.setting.Disable_safty_F0 == true) return true; else if (idx == 1 && Pub.setting.Disable_safty_F1 == true) return true; else if (idx == 2 && Pub.setting.Disable_safty_F2 == true) return true; if (RealSensor == false && idx == 0 && Pub.setting.Disable_safty_F0 == true) return true; else if (RealSensor == false && idx == 1 && Pub.setting.Disable_safty_F1 == true) return true; else if (RealSensor == false && idx == 2 && Pub.setting.Disable_safty_F2 == true) return true; else if (idx == 0 && Util_DO.GetIOInput(eDIName.DOORF1) == false) return true; else if (idx == 1 && Util_DO.GetIOInput(eDIName.DOORF2) == false) return true; else if (idx == 2 && Util_DO.GetIOInput(eDIName.DOORF3) == false) return true; else return false; } public static Boolean isSaftyDoorR(Boolean RealSensor = false) { //모든 포트가 안전해야 전체가 안전한것이다 return isSaftyDoorR(0, RealSensor) && isSaftyDoorR(1, RealSensor) && isSaftyDoorR(2, RealSensor); } public static Boolean isSaftyDoorR(int idx, Boolean RealSensor) { if (RealSensor == false && idx == 0 && Pub.setting.Disable_safty_R0 == true) return true; else if (RealSensor == false && idx == 1 && Pub.setting.Disable_safty_R1 == true) return true; else if (RealSensor == false && idx == 2 && Pub.setting.Disable_safty_R2 == true) return true; else if (idx == 0 && Util_DO.GetIOInput(eDIName.DOORR1) == false) return true; else if (idx == 1 && Util_DO.GetIOInput(eDIName.DOORR2) == false) return true; else if (idx == 2 && Util_DO.GetIOInput(eDIName.DOORR3) == false) return true; else return false; } private static DateTime RoomLightControlTime = DateTime.Now; public static Boolean SetRoomLight(Boolean on) { if (on == true && Pub.setting.Disable_RoomLight == true) { Pub.log.Add("비활성화 됨"); return true; //200708 } //형광등은 너무 빠른 제어는 하지 않는다 var ts = DateTime.Now - RoomLightControlTime; if (ts.TotalMilliseconds < 500) return false; RoomLightControlTime = DateTime.Now; return Pub.dio.SetOutput(GetDONum(eDOName.LAMPON1) - 1, on); } public static Boolean SetAIR(Boolean ON) { if (Pub.dio == null || !Pub.dio.IsInit) return false; return Pub.dio.SetOutput(GetDONum(eDOName.SOL_AIR) - 1, ON); } public static Boolean SetOutput(eDOName pin, Boolean value) { if (Pub.dio == null || !Pub.dio.IsInit) return false; return Pub.dio.SetOutput((int)pin, value); } public static bool GetPortMotorRun(int index) { if (Pub.dio == null || !Pub.dio.IsInit) return false; if (index < 0 || index > 3) throw new Exception("포트번호는 (0~2) 사이로 입력되어야 함"); Boolean b1 = false; eDOName Pin_Dir = eDOName.PORT0_MOT_RUN; if (index == 1) Pin_Dir = eDOName.PORT1_MOT_RUN; else if (index == 2) Pin_Dir = eDOName.PORT2_MOT_RUN; //direction을 먼저 전송한다 b1 = Util_DO.GetIOOutput(Pin_Dir); return b1; } public static eMotDir GetPortMotorDir(int index) { if (Pub.dio == null || !Pub.dio.IsInit) return eMotDir.CW; if (index < 0 || index > 3) throw new Exception("포트번호는 (0~2) 사이로 입력되어야 함"); Boolean b1 = false; eDOName Pin_Dir = eDOName.PORT0_MOT_DIR; if (index == 1) Pin_Dir = eDOName.PORT1_MOT_DIR; else if (index == 2) Pin_Dir = eDOName.PORT2_MOT_DIR; //direction을 먼저 전송한다 b1 = Util_DO.GetIOOutput(Pin_Dir); if (b1 == false) return eMotDir.CW; else return eMotDir.CCW; } public static Boolean SetPortMagnet(int index, Boolean on) { if (Pub.dio == null || !Pub.dio.IsInit) return false; //기능적용 2100129 if (on == true) { if (index == 0 && Pub.setting.Enable_Magnet0 == false) return true; if (index == 1 && Pub.setting.Enable_Magnet1 == false) return true; if (index == 2 && Pub.setting.Enable_Magnet2 == false) return true; } if (index == 0) return Util_DO.SetOutput(eDOName.CART_MAG0, on); else if (index == 1) return Util_DO.SetOutput(eDOName.CART_MAG1, on); else return Util_DO.SetOutput(eDOName.CART_MAG2, on); } /// /// CW = Up, CCW = Dn /// /// /// /// /// public static Boolean SetPortMotor(int index, eMotDir Dir, Boolean run, string remark, Boolean smalldown = false) { if (Pub.dio == null || !Pub.dio.IsInit) return false; //Pub.log.AddI($"포트모터({index}) {(Dir == eMotDir.CW ? "(정)" : "(역)")}방향 : {(run ? "O" : "X")} => {remark}"); Boolean b1, b2; b1 = b2 = false; int Pin_Dir, Pin_Run; eDIName pin_limp, pin_limn; if (index == 0) Pin_Dir = (int)eDOName.PORT0_MOT_DIR; else if (index == 1) Pin_Dir = (int)eDOName.PORT1_MOT_DIR; else Pin_Dir = (int)eDOName.PORT2_MOT_DIR; if (index == 0) Pin_Run = (int)eDOName.PORT0_MOT_RUN; else if (index == 1) Pin_Run = (int)eDOName.PORT1_MOT_RUN; else Pin_Run = (int)eDOName.PORT2_MOT_RUN; if (index == 0) pin_limp = eDIName.PORT0_LIM_UP; else if (index == 1) pin_limp = eDIName.PORT1_LIM_UP; else pin_limp = eDIName.PORT2_LIM_UP; if (index == 0) pin_limn = eDIName.PORT0_LIM_DN; else if (index == 1) pin_limn = eDIName.PORT1_LIM_DN; else pin_limn = eDIName.PORT2_LIM_DN; //direction을 먼저 전송한다 if (run) { //b2 = Pub.dio.SetOutput(Pin_Dir, Dir != eMotDir.CW); //System.Threading.Thread.Sleep(5); //켜야하는 상황인데.. 리밋이 걸렸다면 처리하지 않는다 if (Dir == eMotDir.CW && Util_DO.GetIOInput(pin_limp) == true) { Pub.log.AddI(string.Format("포트({0})번의 출력을 무시합니다(LIMIT_UP) 방향:{1}", index, Dir)); b1 = true; } else if (Dir == eMotDir.CCW && Util_DO.GetIOInput(pin_limn) == true) { Pub.log.AddI(string.Format("포트({0})번의 출력을 무시합니다(LIMIT_DN) 방향:{1}", index, Dir)); b1 = true; } else { if (smalldown) { if (index == 0) { Pub.flag.set(eFlag.PORT0_ENDDOWN, true, remark + ":SETPORT"); Pub.SetVarTime(eVarTime.PORT0); //내린시간 } if (index == 1) { Pub.flag.set(eFlag.PORT1_ENDDOWN, true, remark + ":SETPORT"); Pub.SetVarTime(eVarTime.PORT1); //내린시간 } if (index == 2) { Pub.flag.set(eFlag.PORT2_ENDDOWN, true, remark + ":SETPORT"); Pub.SetVarTime(eVarTime.PORT2); //내린시간 } Pub.log.AddAT(string.Format("P{0} Small Down Active Dir={1}",index, Dir)); } else { //다른곳에서 이동을 설정해버리면 sdmall down 기능을 없앤다 -- 210405 if (index == 0 && Pub.flag.get(eFlag.PORT0_ENDDOWN) == true) { Pub.flag.set(eFlag.PORT0_ENDDOWN, false, remark + ":SETPORT"); Pub.log.AddAT("P0 Small Down Ignore"); } if (index == 1 && Pub.flag.get(eFlag.PORT1_ENDDOWN) == true) { Pub.flag.set(eFlag.PORT1_ENDDOWN, false, remark + ":SETPORT"); Pub.log.AddAT("P1 Small Down Ignore"); } if (index == 2 && Pub.flag.get(eFlag.PORT2_ENDDOWN) == true) { Pub.flag.set(eFlag.PORT2_ENDDOWN, false, remark + ":SETPORT"); Pub.log.AddAT("P2 Small Down Ignore"); } } //방향전환을 해야한다면 우선 정지 후 500ms 대기한다 if (Util_DO.GetPortMotorDir(index) != Dir) { //일단 멈춤고 b1 = Pub.dio.SetOutput(Pin_Run, false); System.Threading.Thread.Sleep(20); //방향전환 ON b2 = Pub.dio.SetOutput(Pin_Dir, Dir != eMotDir.CW); System.Threading.Thread.Sleep(20); //모터 가동 b1 = Pub.dio.SetOutput(Pin_Run, run); System.Threading.Thread.Sleep(20); } else { //방향전환을 하지 않는 경우 //모터 가동 b2 = true; b1 = Pub.dio.SetOutput(Pin_Run, run); System.Threading.Thread.Sleep(20); } //b1 = Pub.dio.SetOutput(Pin_Run, run); } } else { //동작을 먼저 끈다 b1 = Pub.dio.SetOutput(Pin_Run, run); System.Threading.Thread.Sleep(20); //방향핀을 끈다 b2 = Pub.dio.SetOutput(Pin_Dir, false); System.Threading.Thread.Sleep(20); } //System.Threading.Thread.Sleep(5); return b1 && b2; } public static Boolean SetPrintLVac(ePrintVac run, bool force) { if (Pub.dio == null || !Pub.dio.IsInit) return false; if (force == false && Pub.setting.Disable_PLVac == true) run = ePrintVac.off; bool b1, b2; if (run == ePrintVac.inhalation) { //흡기 b1 = Util_DO.SetOutput(eDOName.PRINTL_VACO, false); b2 = Util_DO.SetOutput(eDOName.PRINTL_VACI, true); } else if (run == ePrintVac.exhaust) { //배기 b1 = Util_DO.SetOutput(eDOName.PRINTL_VACI, false); b2 = Util_DO.SetOutput(eDOName.PRINTL_VACO, true); } else { //끄기 b1 = Util_DO.SetOutput(eDOName.PRINTL_VACO, false); b2 = Util_DO.SetOutput(eDOName.PRINTL_VACI, false); } return b1 && b2; } public static Boolean SetPrintRVac(ePrintVac run, bool force) { if (Pub.dio == null || !Pub.dio.IsInit) return false; if (force == false && Pub.setting.Disable_PRVac == true) run = ePrintVac.off; bool b1, b2; if (run == ePrintVac.inhalation) { //흡기 b1 = Util_DO.SetOutput(eDOName.PRINTR_VACO, false); b2 = Util_DO.SetOutput(eDOName.PRINTR_VACI, true); } else if (run == ePrintVac.exhaust) { //배기 b1 = Util_DO.SetOutput(eDOName.PRINTR_VACI, false); b2 = Util_DO.SetOutput(eDOName.PRINTR_VACO, true); } else { //끄기 b1 = Util_DO.SetOutput(eDOName.PRINTR_VACO, false); b2 = Util_DO.SetOutput(eDOName.PRINTR_VACI, false); } return b1 && b2; } public static Boolean SetPickerVac(Boolean run, Boolean force) { if (Pub.dio == null || !Pub.dio.IsInit) return false; // Pub.log.Add("[F] 진공 : " + run.ToString()); bool b1, b2, b3, b4; //if (Pub.setting.Disable_vacum) run = false; if (run) { if (force == true || Pub.setting.Disable_PKVac == false) { b1 = Pub.dio.SetOutput((int)eDOName.PICK_VAC1, true); b2 = Pub.dio.SetOutput((int)eDOName.PICK_VAC2, true); b3 = Pub.dio.SetOutput((int)eDOName.PICK_VAC3, true); b4 = Pub.dio.SetOutput((int)eDOName.PICK_VAC4, true); } else { b1 = b2 = b3 = b4 = true; } } else { b1 = Pub.dio.SetOutput((int)eDOName.PICK_VAC1, false); b2 = Pub.dio.SetOutput((int)eDOName.PICK_VAC2, false); b3 = Pub.dio.SetOutput((int)eDOName.PICK_VAC3, false); b4 = Pub.dio.SetOutput((int)eDOName.PICK_VAC4, false); //if (Pub.flag.get(eFlag.PK_ITEMON) == true) // Pub.flag.set(eFlag.PK_ITEMON, false, "VACOFF"); } return b1 & b2 & b3 & b4; } #region "Tower Lamp" /// /// 타워램프버튼 작업 /// /// /// /// public static void SetTWLamp(Boolean bFront, Boolean r, Boolean g, Boolean y) { if (Pub.dio == null || !Pub.dio.IsInit) return; if (Util_DO.GetIOOutput(eDOName.TWR_GRNF) != g) Pub.dio.SetOutput(GetDONum(eDOName.TWR_GRNF) - 1, g); if (Util_DO.GetIOOutput(eDOName.TWR_REDF) != r) Pub.dio.SetOutput(GetDONum(eDOName.TWR_REDF) - 1, r); if (Util_DO.GetIOOutput(eDOName.TWR_YELF) != y) Pub.dio.SetOutput(GetDONum(eDOName.TWR_YELF) - 1, y); if (Pub.flag.get(eFlag.MOVE_PICKER) == true) { g = true; r = true; if (Util_DO.GetIOOutput(eDOName.BUT_STARTF) != g) Pub.dio.SetOutput(GetDONum(eDOName.BUT_STARTF) - 1, g); if (Util_DO.GetIOOutput(eDOName.BUT_STOPF) != r) Pub.dio.SetOutput(GetDONum(eDOName.BUT_STOPF) - 1, r); } else { if (Util_DO.GetIOOutput(eDOName.BUT_STARTF) != g) Pub.dio.SetOutput(GetDONum(eDOName.BUT_STARTF) - 1, g); if (Util_DO.GetIOOutput(eDOName.BUT_STOPF) != r) Pub.dio.SetOutput(GetDONum(eDOName.BUT_STOPF) - 1, r); } if (Util_DO.GetIOOutput(eDOName.BUT_RESETF) != y) Pub.dio.SetOutput(GetDONum(eDOName.BUT_RESETF) - 1, y); } public static Boolean SetTwRed(Boolean ON) { if (Pub.dio == null || !Pub.dio.IsInit) return false; Pub.dio.SetOutput(GetDONum(eDOName.BUT_STOPF) - 1, ON); return Pub.dio.SetOutput(GetDONum(eDOName.TWR_REDF) - 1, ON); } public static Boolean SetTwYel(Boolean ON) { if (Pub.dio == null || !Pub.dio.IsInit) return false; Pub.dio.SetOutput(GetDONum(eDOName.BUT_RESETF) - 1, ON); return Pub.dio.SetOutput(GetDONum(eDOName.TWR_YELF) - 1, ON); } public static Boolean SetTwGrn(Boolean ON) { if (Pub.dio == null || !Pub.dio.IsInit) return false; Pub.dio.SetOutput(GetDONum(eDOName.BUT_STARTF) - 1, ON); return Pub.dio.SetOutput(GetDONum(eDOName.TWR_GRNF) - 1, ON); } #endregion public static void ToggleRoomLight() { //var current = Util_DO.GetIOOutput(eDOName.ROOM_LIGHT); //Pub.dio.SetOutput((int)eDOName.ROOM_LIGHT, !current); } public static Boolean SetBuzzer(Boolean ON) { if (Pub.dio == null || !Pub.dio.IsInit) return false; if (ON) { Pub.BuzzerTime = DateTime.Now; if (Pub.setting.Disable_Buzzer == true) return true; //부저기능OFF시 사용 안함 } if (ON && Pub.setting.Disable_Buzzer == true) { Pub.log.AddAT("buzzer Disabled"); ON = false; } return Pub.dio.SetOutput(GetDONum(eDOName.BUZZER) - 1, ON); } public static Boolean SetMotPowerOn(Boolean ON) { if (Pub.dio == null || !Pub.dio.IsInit) return false; var c0 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_0); var c1 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_1); var c2 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_2); var c3 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_3); var c4 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_4); var c5 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_5); var c6 = !Util_DO.GetIOOutput(eDOName.SVR_PWR_6); //꺼져잇는 신호가 하나도 없다면 이번에 끄니깐 메세지를 추가하자 //if (c0 == false && c0 == c1 && c0 == c2 && c0 == c3 && c0 == c4 && c0 == c5 && c0 == c6) // Console.WriteLine("mot power off"); bool b0, b1, b2, b3, b4, b5, b6; b0 = b1 = b2 = b3 = b4 = b5 = b6 = true; if (c0 != ON) b0 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_0) - 1, !ON); if (c1 != ON) b1 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_1) - 1, !ON); if (c2 != ON) b2 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_2) - 1, !ON); if (c3 != ON) b3 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_3) - 1, !ON); if (c4 != ON) b4 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_4) - 1, !ON); if (c5 != ON) b5 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_5) - 1, !ON); if (c6 != ON) b6 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_PWR_6) - 1, !ON); return b0 && b1 && b2 && b3 && b4 && b5 && b6; } public static Boolean SetMotEmergency(Boolean ON) { //if (ON == true) Console.WriteLine("mot emg on"); if (Pub.dio == null || !Pub.dio.IsInit) return false; var c0 = Util_DO.GetIOOutput(eDOName.SVR_EMG_0); var c1 = Util_DO.GetIOOutput(eDOName.SVR_EMG_1); var c2 = Util_DO.GetIOOutput(eDOName.SVR_EMG_2); var c3 = Util_DO.GetIOOutput(eDOName.SVR_EMG_3); var c4 = Util_DO.GetIOOutput(eDOName.SVR_EMG_4); var c5 = Util_DO.GetIOOutput(eDOName.SVR_EMG_5); var c6 = Util_DO.GetIOOutput(eDOName.SVR_EMG_6); bool b0, b1, b2, b3, b4, b5, b6; b0 = b1 = b2 = b3 = b4 = b5 = b6 = ON; if (c0 != ON) b0 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_0) - 1, ON); if (c1 != ON) b1 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_1) - 1, ON); if (c2 != ON) b2 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_2) - 1, ON); if (c3 != ON) b3 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_3) - 1, ON); if (c4 != ON) b4 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_4) - 1, ON); if (c5 != ON) b5 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_5) - 1, ON); if (c6 != ON) b6 = Pub.dio.SetOutput(GetDONum(eDOName.SVR_EMG_6) - 1, ON); return b0 && b1 && b2 && b3 && b4 && b5 && b6; } } }