LabelMachine.Ledprocess.cs
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public partial class LabelMachine
{
Led AlarmLed;
Led RunningLed;
System.Threading.Timer ledtimer;
private void LedProcessInit()
{
AlarmLed = new Led(Config.DOList[IO_Label_Type.Alarm_Led].GetIOAddr(),DeviceName);
RunningLed = new Led(Config.DOList[IO_Label_Type.Run_Led].GetIOAddr(), DeviceName);
ledtimer = new System.Threading.Timer(new TimerCallback(LedProcess), null, 0, 1000);
GC.KeepAlive(ledtimer);
}
void LedProcess(object o)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
if (runStatus == RunStatus.Running)
{
RunningLed.LedState = LedState.on;
//无法运行,量报警灯
if (!canRunning)
{
AlarmLed.LedState = LedState.on;
RunningLed.LedState = LedState.off;
}
if (MoveInfo.MoveStep == MoveStep.Lbl_WaitCheckLabel)
{
AlarmLed.LedState = LedState.blink;
}
else
{
}
}
else if (runStatus == RunStatus.HomeReset)
{
RunningLed.LedState = LedState.blink;
}
if (alarmType != AlarmType.None)
{
AlarmLed.LedState = LedState.on;
}
if (UserPause)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
//StandbyLed.LedState = LedState.blink;
}
Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
}
}
}