private void btInputClick(object sender, EventArgs e) { //Button Bt = sender as Button; //uint uPstnNo = (uint)Bt.Tag; int iBtnTag = Convert.ToInt32(((Button)sender).Tag); uint uPstnNo = (uint)iBtnTag; bool bServo = ML.MT_GetServo(m_uMotrId); double dPos, dInputPos; string sPos; if (bServo) { dPos = ML.MT_GetCmdPos(m_uMotrId); sPos = dPos.ToString("N4"); dInputPos = double.Parse(sPos); } else { dPos = ML.MT_GetEncPos(m_uMotrId); sPos = dPos.ToString("N4"); dInputPos = double.Parse(sPos); } string sText = ((Button)sender).Text; Log.Trace("Form DeviceSet Input Button Clicked (" + ML.MT_GetName(m_uMotrId) + " " + GetName(uPstnNo).Trim() + " " + GetValue(uPstnNo) + " -> " + sPos + ")", ForContext.Frm); //SetValue(uPstnNo , GetCmdPos((int)m_uMotrId)); SetValue(uPstnNo, dInputPos); }
private void tmUpdate_Tick(object sender, EventArgs e) { string sTemp;; tmUpdate.Enabled = false; lbStat1.ForeColor = ML.MT_GetNLimSnsr(m_eId) ? Color.Red : Color.Silver; lbStat2.ForeColor = ML.MT_GetHomeSnsr(m_eId) ? Color.Red : Color.Silver; lbStat3.ForeColor = ML.MT_GetPLimSnsr(m_eId) ? Color.Red : Color.Silver; lbStat4.ForeColor = ML.MT_GetHomeDone(m_eId) ? Color.Red : Color.Silver; lbStat5.ForeColor = ML.MT_GetAlarmSgnl(m_eId) ? Color.Red : Color.Silver; lbStat6.ForeColor = ML.MT_GetStop(m_eId) ? Color.Red : Color.Silver; lbStat7.ForeColor = ML.MT_GetInPosSgnl(m_eId) ? Color.Red : Color.Silver; lbStat8.ForeColor = ML.MT_GetServo(m_eId) ? Color.Red : Color.Silver; sTemp = string.Format("{0:0.0000}", ML.MT_GetCmdPos(m_eId)); lbCmdPos.Text = sTemp; if (!this.Visible) { tmUpdate.Enabled = false; return; } tmUpdate.Enabled = true; }
public static bool InspectMotor() { //Local Var. bool isOk = true; for (int i = 0; i < (int)mi.MAX_MOTR; i++) { if (ML.MT_GetAlarmSgnl(i)) { if (ML.MT_GetServo(i)) { ML.MT_SetServo(i, false); } ML.ER_SetErr(ei.MTR_Alarm, ML.MT_GetName(i)); isOk = false; } if (ML.MT_GetHomeDone(i)) { if (ML.MT_GetNLimSnsr(i)) { ML.ER_SetErr(ei.MTR_NegLim, ML.MT_GetName(i)); isOk = false; } if (ML.MT_GetPLimSnsr(i)) { ML.ER_SetErr(ei.MTR_PosLim, ML.MT_GetName(i)); isOk = false; } } } //Ok. return(isOk); }
private void tmUpdate_Tick(object sender, EventArgs e) { tmUpdate.Enabled = false; LbStat1.BackColor = ML.MT_GetNLimSnsr(m_eId) ? Color.Lime : Color.Silver; LbStat2.BackColor = ML.MT_GetHomeSnsr(m_eId) ? Color.Lime : Color.Silver; LbStat3.BackColor = ML.MT_GetPLimSnsr(m_eId) ? Color.Lime : Color.Silver; LbStat4.BackColor = ML.MT_GetAlarmSgnl(m_eId) ? Color.Lime : Color.Silver; LbStat5.BackColor = ML.MT_GetServo(m_eId) ? Color.Lime : Color.Silver; LbStat6.BackColor = ML.MT_GetStop(m_eId) ? Color.Lime : Color.Silver; LbStat7.BackColor = ML.MT_GetHomeDone(m_eId) ? Color.Lime : Color.Silver; LbCmdPos.Text = ML.MT_GetCmdPos(m_eId).ToString(); LbEncPos.Text = ML.MT_GetEncPos(m_eId).ToString(); if (SEQ._bRun) { btNeg.Enabled = false; btPos.Enabled = false; } else { btNeg.Enabled = true; btPos.Enabled = true; } if (!this.Visible) { tmUpdate.Enabled = false; return; } tmUpdate.Enabled = true; }
private static void UpdateButton() { //Check Inspect. //if (!OM.CmnOptn.bIgnrDoor) InspectDoor(); if (m_iStep != EN_SEQ_STEP.Idle) { InspectHomeDone(); } if (m_iStep == EN_SEQ_STEP.Idle) { InspectLightGrid(); } //Local Var. bool isErr = ML.ER_IsErr(); bool bStartSw = ML.IO_GetXUp(xi.ETC_StartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ; bool bStopSw = ML.IO_GetXUp(xi.ETC_StopSw) || m_bBtnStop; // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop ; bool bResetSw = ML.IO_GetXUp(xi.ETC_ResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ; bool bAirSw = false; //ML.IO_GetXUp(xi.ETC_AirSw ) || m_bBtnAir ; bool bInitSw = false; //ML.IO_GetXUp(xi.ETC_InitSw ) ; bool bMotorSw = ML.IO_GetXUp(xi.ETC_MotorSw); if (m_bBtnStart) { Log.Trace("m_bBtnStart", "true"); } if (bStartSw) { Log.Trace("bStartSw", "Started"); if (m_iSeqStat == EN_SEQ_STAT.Init) { Log.Trace("SeqStat", "ssInit "); } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd) { Log.Trace("SeqStat", "ssWorkEnd"); } if (m_iSeqStat == EN_SEQ_STAT.Error) { Log.Trace("SeqStat", "ssError "); } if (m_iSeqStat == EN_SEQ_STAT.Running) { Log.Trace("SeqStat", "ssRunning"); } if (m_iSeqStat == EN_SEQ_STAT.Stop) { Log.Trace("SeqStat", "ssStop "); } if (m_iSeqStat == EN_SEQ_STAT.RunWarn) { Log.Trace("SeqStat", "ssRunWarn"); } if (MM.GetManNo() != (int)mc.NoneCycle) { Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString())); bStartSw = false; } } //Update Switch's Lamp bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick; //버튼 클릭시나 ML.IO_SetY(yi.ETC_StartLp, ML.IO_GetX(xi.ETC_StartSw) || m_bRun); ML.IO_SetY(yi.ETC_StopLp, ML.IO_GetX(xi.ETC_StopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_ResetLp, ML.IO_GetX(xi.ETC_ResetSw) || (m_bFlick && isErr)); //ML.IO_SetY(yi.ETC_AirLp , ML.IO_GetX(xi.ETC_AirSw ) || ML.IO_GetY(yi.ETC_MainAirSol )); //ML.IO_SetY(yi.ETC_InitLp , ML.IO_GetX(xi.ETC_InitSw ) ); ML.IO_SetY(yi.ETC_MotorLp, ML.MT_GetServo(mi.OUT_TRelT)); //Center Man Button m_bBtnStart = false; m_bBtnStop = false; m_bBtnReset = false; m_bBtnAir = false; //Init. Button Flags. bool isHomeEnd = ML.MT_GetHomeDoneAll(); if (bStartSw) { if (!isHomeEnd) { Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false; } //if(!LOT.GetLotOpen ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; } //if(!InspectStripDispr ()) { m_bInspDispr = true ; bStartSw = false ; } //if(!InspectStripUnknown()) { m_bInspUnkwn = true ; bStartSw = false ; } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn) { Reset(); } } if (bInitSw) { MM.SetManCycle(mc.AllHome); } if (bMotorSw) { if (ML.MT_GetServo(mi.OUT_TRelT)) { ML.MT_SetServo(mi.OUT_TRelT, false); ML.MT_SetServo(mi.OUT_TRelB, false); } else { ML.MT_SetServo(mi.OUT_TRelT, true); ML.MT_SetServo(mi.OUT_TRelB, true); ML.MT_SetHomeDone(mi.OUT_TRelT, true); ML.MT_SetHomeDone(mi.OUT_TRelB, true); } } //Air Switch. //if(bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init) //{ // ML.IO_SetY(yi.ETC_MainAirSol , !ML.IO_GetY(yi.ETC_MainAirSol )) ; //} //Buzzer Off. if (isErr && bStopSw) { ML.TL_SetBuzzOff(true); } bool isStopCon = bStopSw || (isErr && !m_bReqStop && m_bRun); bool isRunCon = bStartSw && !isErr; bool isResetCon = bResetSw && !m_bRun; //Run. if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) { m_iStep = EN_SEQ_STEP.ToStartCon; ML.TL_SetBuzzOff(false); ML.ER_SetDisp(true); } if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { m_bReqStop = true; } if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle)) { Reset(); } if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 10000)) { //Trace Log. string Msg; Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); ML.ER_SetErr(ei.ETC_ToStartTO); m_iStep = EN_SEQ_STEP.Idle; m_bRun = false; } //CDelayTimer StopBtn = null; //StopBtn = new CDelayTimer(); //if(m_iStep == EN_SEQ_STEP.scToStopCon) //{ // if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000)) // { // Log.Trace("SEQ","Forced Stop"); // m_bRun = false ; // m_iStep = EN_SEQ_STEP.scIdle; // m_bReqStop = false; // } //} //else //{ // StopBtn.Clear(); //} if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 10000)) // 20000)) { { //Trace Log. string Msg; Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); m_bRun = false; ML.ER_SetErr(ei.ETC_ToStopTO); m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; } EN_SEQ_STEP iPreStep = m_iStep; if (iPreStep != m_iStep) { string sMsg = ""; sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString()); Log.Trace("SEQ", sMsg); } iPreStep = m_iStep; //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠. bool bPreLotEnd = LOT.GetLotEnd(); if (LOT.GetLotEnd() != bPreLotEnd) { Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False"); } bPreLotEnd = LOT.GetLotEnd(); //Running Step. switch (m_iStep) { case EN_SEQ_STEP.Idle: return; case EN_SEQ_STEP.ToStartCon: if (!ToStartCon()) { return; } m_iStep = EN_SEQ_STEP.ToStart; Log.Trace("SEQ", "scToStartCon END"); return; case EN_SEQ_STEP.ToStart: if (!ToStart()) { return; } m_bRun = true; m_bRunEdge = true; m_iStep = EN_SEQ_STEP.Run; Log.Trace("SEQ", "scToStart END"); return; case EN_SEQ_STEP.Run: if (!m_bReqStop) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.ShowMessage("Checked", "Lot Ended."); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); m_bRunEnd = true; m_iStep = EN_SEQ_STEP.ToStopCon; } return; } m_bReqStop = false; m_iStep = EN_SEQ_STEP.ToStopCon; Log.Trace("SEQ", "scRun END"); return; case EN_SEQ_STEP.ToStopCon: if (!ToStopCon()) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.Trace("SEQ", "scToStopCon LotEnd"); } return; } m_bRun = false; m_iStep = EN_SEQ_STEP.ToStop; Log.Trace("SEQ", "scToStopCon END"); return; case EN_SEQ_STEP.ToStop: if (!ToStop()) { return; } m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; DM.SaveMap(); Log.Trace("SEQ", "scToStop END"); return; } }