Commit a68bc2d3 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 GM_XXX Start重入

parent d8770658
......@@ -22,8 +22,15 @@ namespace FLY.Thick.Base.Server
}
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMin();
}
......
......@@ -63,10 +63,8 @@ namespace FLY.Thick.Base.Server
}
public virtual void Stop()
{
FObjBase.PollModule.Current.Poll_Config(
FObjBase.PollModule.POLL_CONFIG.REMOVE,
onpoll_func);
FObjBase.PollModule.Current.Poll_Remove(onpoll_func);
IsRunning = false;
}
......
......@@ -21,8 +21,16 @@ namespace FLY.Thick.Base.Server
}
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMax();
}
......
......@@ -94,9 +94,14 @@ namespace FLY.Thick.Base.Server
/// </summary>
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning)
return;
return;//运行不起来
Progress = 0;
DataOK = false;
......
......@@ -27,8 +27,14 @@ namespace FLY.Thick.Base.Server
}
public void Start(int pos)
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(pos);
......
......@@ -12,9 +12,16 @@ namespace FLY.Thick.Base.Server
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning)
return;
return;//运行不起来
mFlyAD.Origin();
}
}
......
......@@ -108,8 +108,15 @@ namespace FLY.Thick.Base.Server
}
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mState = STATE.WAIT_ORG;
mFlyAD.Origin();
}
......
......@@ -141,9 +141,14 @@ namespace FLY.Thick.Base.Server
}
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning)
return;
return;//运行不起来
Progress = 0;
var group = Groups[CurrGroupIndex];
......
......@@ -9,6 +9,7 @@ using FlyADBase;
using FLY.Thick.Base.Common;
using System.Diagnostics;
using FLY.OBJComponents.Server;
using NLog;
namespace FLY.Thick.Base.Server
{
......@@ -177,8 +178,8 @@ namespace FLY.Thick.Base.Server
}
else
{
warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL,accessory: "ManualStop");
Stop();
warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL, accessory: "ManualStop");
Stop();
}
return false;
}
......@@ -236,10 +237,10 @@ namespace FLY.Thick.Base.Server
}
else
{
warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL,accessory: "ManualStopAtHome");
warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL, accessory: "ManualStopAtHome");
Stop();
}
}break;
} break;
}
return false;
}
......@@ -296,7 +297,7 @@ namespace FLY.Thick.Base.Server
{
if (!WaitFinish())
break;
FlushAD(DIRECTION.FORWARD);
state = CTRLST.FORWAIT_2;
}
......@@ -364,7 +365,7 @@ namespace FLY.Thick.Base.Server
{
if (!WaitFinish())
break;
FlushAD(DIRECTION.BACKWARD);
state = CTRLST.BACKWAIT_2;
}
......@@ -426,7 +427,7 @@ namespace FLY.Thick.Base.Server
{
if (!WaitFinish())
break;
FlushAD(DIRECTION.FORWARD);
state = CTRLST.SCAN_BACKW;
}
......@@ -443,7 +444,7 @@ namespace FLY.Thick.Base.Server
{
if (!WaitFinish())
break;
FlushAD(DIRECTION.BACKWARD);
state = CTRLST.INIT;
}
......@@ -491,6 +492,4 @@ namespace FLY.Thick.Base.Server
}
}
}
}
......@@ -16,8 +16,15 @@ namespace FLY.Thick.Base.Server
}
public override void Start()
{
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.Stop();
}
}
......
......@@ -54,13 +54,15 @@ namespace FLY.Thick.Base.Server
/// </summary>
public class GageModeManager:INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// 当前动作模式
/// </summary>
public CTRL_STATE State { get; set; } = CTRL_STATE.FIX;
/// <summary>
/// 第1个GM,就是默认值
/// 第1个GM,就是默认值; 没有任何GM运行,就会启动第1个GM
/// </summary>
List<IGageMode> GMs = new List< IGageMode>();
......@@ -90,21 +92,29 @@ namespace FLY.Thick.Base.Server
{
IGageMode gm = sender as IGageMode;
if (e.PropertyName == "IsRunning")
if (e.PropertyName == nameof(gm.IsRunning))
{
if (gm.IsRunning == true)
{
//GM 启动
if (GMofRunning != null)//其中一个GM启动,停止上一次运行的GM
if (GMofRunning != null)
{
//GM启动,停止上一次运行的GM
//必须先注册 当前运行 GMofRunning 为 新的GM
//再停止上一个 GM
//因为 GM.Stop 会触发 下面的停止事件, 插入 GMs[0] 动作
IGageMode g = GMofRunning;
GMofRunning = gm;
g.Stop();
}
else
{
GMofRunning = gm;
//没有上一个GM
GMofRunning = gm;
}
//更新当前状态
State = gm.GMState;
......@@ -112,7 +122,7 @@ namespace FLY.Thick.Base.Server
else
{
//GM 停止
if (gm == GMofRunning)
if (gm == GMofRunning)//就是当前在运行的GM
{
GMofRunning = null;//当前没有GM在运行
......@@ -122,6 +132,6 @@ namespace FLY.Thick.Base.Server
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment