initial commit

This commit is contained in:
2025-11-25 20:14:41 +09:00
commit 5cb1ff372c
559 changed files with 149800 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace Project
{
public partial class FMain
{
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using UIControl;
using AR;
namespace Project
{
public partial class FMain
{
void _BUTTON_RESET()
{
//Common processing when RESET button is pressed
DIO.SetBuzzer(false); //buzzer off
if (PUB.popup.Visible)
PUB.popup.needClose = true;
if (
hmi1.Scean == HMI.eScean.xmove)
hmi1.Scean = UIControl.HMI.eScean.Nomal;
PUB.flag.set(eVarBool.FG_KEYENCE_OFFF, false, "USER");
PUB.flag.set(eVarBool.FG_KEYENCE_OFFR, false, "USER");
//Remove popup message if it's a removable message.
if (hmi1.HasPopupMenu && hmi1.PopupMenuRequireInput == false)
hmi1.DelMenu();
//Alarm clear work (only when motion has error)
if (PUB.mot.IsInit && PUB.mot.HasServoAlarm)
{
PUB.mot.SetAlarmClearOn();
System.Threading.Thread.Sleep(200);
PUB.mot.SetAlarmClearOff();
}
//If there's no material and sensor doesn't respond but vacuum is on, turn it off
if (DIO.isVacOKL() == 0 && PUB.flag.get(eVarBool.FG_PK_ITEMON) == false && DIO.GetIOOutput(eDOName.PICK_VAC1) == false)
DIO.SetPickerVac(false, true);
//This reset is meaningful in stop and error mode.
if (PUB.sm.Step == eSMStep.RUN)
{
PUB.log.Add("[RESET] button does not work during operation");
}
else if (PUB.sm.Step == eSMStep.PAUSE)
{
//Switch to start waiting state (execution starts when start key is pressed in waiting state)
PUB.sm.SetNewStep(eSMStep.WAITSTART);
PUB.log.AddAT("Reset Clear System Resume & Pause ON");
}
else if (PUB.sm.Step == eSMStep.EMERGENCY)
{
PUB.popup.setMessage("EMERGENCY RESET\n" +
"[Emergency Stop] state requires [System Initialization]\n" +
"Execute [Initialize] from the top menu");
PUB.log.Add("RESET button caused transition from EMG situation to IDLE");
PUB.sm.SetNewStep(eSMStep.IDLE);
}
else if (PUB.sm.Step == eSMStep.ERROR)
{
PUB.log.Add("RESET button caused transition from ERR situation to IDLE");
PUB.sm.SetNewStep(eSMStep.IDLE);
}
else if (PUB.sm.Step == eSMStep.WAITSTART)
{
//No processing even when waiting for start
//Pub.log.Add("[RESET] button does not work while waiting for start button");
}
else if (PUB.sm.Step == eSMStep.IDLE)
{
//Pub.log.Add("[RESET] button does not work during standby");
}
else
{
//Pub.log.AddE("REST key button input from undefined state - switching to standby state");
PUB.sm.SetNewStep(eSMStep.IDLE);
}
}
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using AR;
namespace Project
{
public partial class FMain
{
void _BUTTON_START()
{
if (PUB.sm.Step == eSMStep.RUN)
{
//아무것도 하지 않는다
PUB.log.Add("START button is not available during operation");
}
else if (PUB.sm.Step == eSMStep.IDLE) //일반대기상태
{
if (DIO.isVacOKL() > 0)
{
DIO.SetBuzzer(true);
PUB.popup.setMessage("PICKER ITEM DETECT\nItem detected in PICKER\nPress [Cancel Work] to DROP item and remove it.");
return;
}
else if (DIO.getCartSize(1) == eCartSize.None)
{
DIO.SetBuzzer(true);
PUB.popup.setMessage("Cart is not installed in loader");
return;
}
else if (DIO.GetIOInput(eDIName.PORTC_LIM_DN) == true && DIO.GetIOInput(eDIName.PORTC_DET_UP) == true)
{
//하단리밋과, 자재감지가 동시에 들어오면 overload 이다
DIO.SetBuzzer(true);
PUB.popup.setMessage("Too many reels are loaded in the loader\n" +
"Bottom limit sensor and top reel detection sensor are both active");
return;
}
//else if (Util_DO.getCartSize(0) == eCartSize.None && Util_DO.getCartSize(2) == eCartSize.None)
//{
// Util_DO.SetBuzzer(true);
// Pub.popup.setMessage("언로더에 카트가 장착되지 않았습니다");
// return;
//}
Func_start_job_select();
}
else if (PUB.sm.Step == eSMStep.WAITSTART) //시작대기상태
{
DIO.SetRoomLight(true);
//새로시작하면 포트 얼라인을 해제 해준다
PUB.flag.set(eVarBool.FG_RDY_PORT_PL, false, "SW_START");
PUB.flag.set(eVarBool.FG_RDY_PORT_PC, false, "SW_START");
PUB.flag.set(eVarBool.FG_RDY_PORT_PR, false, "SW_START");
VAR.BOOL[eVarBool.FG_WAIT_INFOSELECTCLOSE] = false;
//언로더 체크작업은 항상 다시 시작한다
if (PUB.Result.UnloaderSeq > 1) PUB.Result.UnloaderSeq = 1;
//팝업메세지가 사라지도록 한다
PUB.popup.needClose = true;
PUB.sm.SetNewStep(eSMStep.RUN);
PUB.log.Add("[User pause] released => Work continues");
}
else
{
//string msg = "SYSTEM {0}\n[RESET] 버튼을 누른 후 다시 시도하세요";
//msg = string.Format(msg, PUB.sm.Step);
//PUB.popup.setMessage(msg);
PUB.log.AddE($"Press [RESET] button and try again");
}
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using AR;
namespace Project
{
public partial class FMain
{
void _BUTTON_STOP()
{
//매거진 투입모터 멈춤
if (DIO.GetIOOutput(eDOName.PORTL_MOT_RUN)) DIO.SetPortMotor(0, eMotDir.CW, false, "Button Stop");
if (DIO.GetIOOutput(eDOName.PORTC_MOT_RUN)) DIO.SetPortMotor(1, eMotDir.CW, false, "Button Stop");
if (DIO.GetIOOutput(eDOName.PORTR_MOT_RUN)) DIO.SetPortMotor(2, eMotDir.CW, false, "Button Stop");
//자재가 없고, 센서도 반응안하는데. 진공이 되어잇으면 off한다
if (DIO.isVacOKL() == 0 && PUB.flag.get(eVarBool.FG_PK_ITEMON) == false && DIO.GetIOOutput(eDOName.PICK_VAC1) == true)
DIO.SetPickerVac(false, true);
//조명켜기
if (AR.SETTING.Data.Disable_RoomLight == false)
DIO.SetRoomLight(true);
//컨베이어 멈춘다 230502
DIO.SetOutput(eDOName.LEFT_CONV, false);
DIO.SetOutput(eDOName.RIGHT_CONV, false);
//모든 모터도 멈춘다
if (PUB.mot.HasMoving) PUB.mot.MoveStop("Stop Button");
if (PUB.sm.Step == eSMStep.RUN)
{
//일시중지상태로 전환한다
PUB.Result.SetResultMessage(eResult.OPERATION, eECode.USER_STOP, eNextStep.PAUSE);
PUB.log.Add("[User pause]");
}
else if (PUB.sm.Step == eSMStep.HOME_FULL) //홈진행중에는 대기상태로 전환
{
PUB.sm.SetNewStep(eSMStep.IDLE);
}
//로그 기록
PUB.LogFlush();
}
}
}