87 lines
2.5 KiB
C#
87 lines
2.5 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|