From 8287e5b91dff39a8c88f37004040a25ac5f3f488 Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期三, 30 九月 2020 15:12:18 +0800 Subject: [PATCH] 1. KeyIndicator显示字体加粗 --- src/Bro.M071.Process/M071Process_MotionCard.cs | 179 ++++++++++++++++++++++++++++------------------------------- 1 files changed, 84 insertions(+), 95 deletions(-) diff --git a/src/Bro.M071.Process/M071Process_MotionCard.cs b/src/Bro.M071.Process/M071Process_MotionCard.cs index 6f93730..5423b8f 100644 --- a/src/Bro.M071.Process/M071Process_MotionCard.cs +++ b/src/Bro.M071.Process/M071Process_MotionCard.cs @@ -17,7 +17,6 @@ public partial class M071Process { public Timer ResetTimer = null; - const int FULLRESETTIME = 5; object machineStateLock = new object(); //MachineState _machineStatePre = MachineState.Unknown; @@ -30,112 +29,102 @@ if (machineState == value) return; - //_machineStatePre = machineState; - machineState = value; - switch (machineState) + Task.Run(() => { - case MachineState.Ready: - lock (machineStateLock) - { - SwitchBeep(false); - SwitchLightRed(false); - SwitchLightYellow(false); - } - - Task.Run(() => - { - - while (MachineState == MachineState.Ready) + switch (machineState) + { + case MachineState.Ready: + lock (machineStateLock) { - lock (machineStateLock) - { - SwitchLightGreen(true); - Thread.Sleep(1000); - SwitchLightGreen(false); - Thread.Sleep(1000); - } + SwitchBeep(false); + SwitchLightRed(false); + SwitchLightYellow(false); } - }); - break; - case MachineState.Running: - lock (machineStateLock) - { - SwitchBeep(false); - SwitchLightRed(false); - SwitchLightYellow(false); - SwitchLightGreen(true); - } - break; - case MachineState.Alarm: - lock (machineStateLock) - { - SwitchBeep(true); - SwitchLightRed(true); - SwitchLightYellow(false); - SwitchLightGreen(false); - } - break; - case MachineState.Pause: - lock (machineStateLock) - { - SwitchBeep(false); - SwitchLightRed(false); - } - Task.Run(() => - { - while (MachineState == MachineState.Pause) + Task.Run(() => { - lock (machineStateLock) + while (MachineState == MachineState.Ready) { - SwitchLightYellow(true); - SwitchLightGreen(true); - Thread.Sleep(1000); - SwitchLightYellow(false); - SwitchLightGreen(false); - Thread.Sleep(1000); + lock (machineStateLock) + { + SwitchLightGreen(true); + Thread.Sleep(1000); + SwitchLightGreen(false); + Thread.Sleep(1000); + } } - } - }); - break; - case MachineState.Resetting: - lock (machineStateLock) - { - SwitchBeep(false); - SwitchLightRed(false); - SwitchLightGreen(false); - } - Task.Run(() => - { - while (MachineState == MachineState.Resetting) - { - lock (machineStateLock) - { + }); - SwitchLightYellow(true); - Thread.Sleep(1000); - SwitchLightYellow(false); - Thread.Sleep(1000); - } + break; + case MachineState.Running: + lock (machineStateLock) + { + SwitchBeep(false); + SwitchLightRed(false); + SwitchLightYellow(false); + SwitchLightGreen(true); } - }); - break; - default: - break; - } + break; + case MachineState.Alarm: + lock (machineStateLock) + { + SwitchBeep(true); + SwitchLightRed(true); + SwitchLightYellow(false); + SwitchLightGreen(false); + } + break; + case MachineState.Pause: + lock (machineStateLock) + { + SwitchBeep(false); + SwitchLightRed(false); + } + Task.Run(() => + { + while (MachineState == MachineState.Pause) + { + lock (machineStateLock) + { + SwitchLightYellow(true); + SwitchLightGreen(true); + Thread.Sleep(1000); + SwitchLightYellow(false); + SwitchLightGreen(false); + Thread.Sleep(1000); + } + } + }); + break; + case MachineState.Resetting: + lock (machineStateLock) + { + SwitchBeep(false); + SwitchLightRed(false); + SwitchLightGreen(false); + } + Task.Run(() => + { + while (MachineState == MachineState.Resetting) + { + lock (machineStateLock) + { + SwitchLightYellow(true); + Thread.Sleep(1000); + SwitchLightYellow(false); + Thread.Sleep(1000); + } + } + }); + break; + default: + break; + } + }); OnMachineStateChanged?.Invoke(machineState); - - //if (_machineStatePre == MachineState.Running && machineState == MachineState.Pause) - //{ - // Pause(); - //} - //else if (_machineStatePre == MachineState.Pause && (machineState == MachineState.Running || machineState == MachineState.Ready)) - //{ - // Resume(); - //} } } @@ -243,7 +232,7 @@ if (opConfig?.InputPara != null && opConfig.InputPara.Count > 0) { //澶у浣嶄俊鍙� - ResetTimer.Change(opConfig.InputPara[0] == 1 ? FULLRESETTIME * 1000 : -1, -1); + ResetTimer.Change(opConfig.InputPara[0] == 1 ? Config.FullResetRequiredDuration * 1000 : -1, -1); if (opConfig.InputPara[0] == 0) return new ProcessResponse(true); -- Gitblit v1.8.0