Commit 8b07cf25 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 添加 AD盒 脉冲不变 会触发“手动停止”状态

2. 修复 刚开机, 执行runto 且目标位置 与 当前位置一样时, 永远都不会IsFinish=TRUE
parent ed7bf665
...@@ -348,7 +348,10 @@ namespace FlyADBase ...@@ -348,7 +348,10 @@ namespace FlyADBase
/// 用于检测当 为IsRunning时,脉冲是否停了很久。 /// 用于检测当 为IsRunning时,脉冲是否停了很久。
/// </summary> /// </summary>
int last_position = int.MinValue; int last_position = int.MinValue;
/// <summary>
/// 脉冲不变化次数
/// </summary>
int position_no_changed_cnt = 0;
TimeSpan NoTGridTimeOut = TimeSpan.FromSeconds(60); TimeSpan NoTGridTimeOut = TimeSpan.FromSeconds(60);
...@@ -366,7 +369,8 @@ namespace FlyADBase ...@@ -366,7 +369,8 @@ namespace FlyADBase
string jsonDbPath; string jsonDbPath;
DateTime lastTimeGridTime; DateTime lastTimeGridTime;
static FlyAD7() { static FlyAD7()
{
propertyName_save = FlyAD7JsonDb.GetMemberNames(); propertyName_save = FlyAD7JsonDb.GetMemberNames();
} }
/// <summary> /// <summary>
...@@ -380,7 +384,7 @@ namespace FlyADBase ...@@ -380,7 +384,7 @@ namespace FlyADBase
void constructor() void constructor()
{ {
Now = DateTime.Now; Now = DateTime.Now;
sysTickContext.BeReseted += () => BeResetTime = DateTime.Now; //sysTickContext.BeReseted += () => BeResetTime = DateTime.Now;
this.PropertyChanged += new PropertyChangedEventHandler(FlyAD7_PropertyChanged); this.PropertyChanged += new PropertyChangedEventHandler(FlyAD7_PropertyChanged);
...@@ -456,17 +460,33 @@ namespace FlyADBase ...@@ -456,17 +460,33 @@ namespace FlyADBase
() => () =>
{ {
if (!IsConnected) if (!IsConnected)
{
position_no_changed_cnt = 0;
return; return;
}
if (DriveStatus != DRIVE_MAN_STATUS.RUNNING) if (DriveStatus != DRIVE_MAN_STATUS.RUNNING)
{
position_no_changed_cnt = 0;
return; return;
}
if (Position != last_position) if (Position != last_position)
{ {
last_position = Position; last_position = Position;
position_no_changed_cnt = 0;
return; return;
} }
position_no_changed_cnt++;
if (driveman_wait.CheckMark(TimeSpan.FromSeconds(3)))//每3秒检查一次 if (position_no_changed_cnt >= 10)
{
//连续10秒,脉冲一样
//异常
DriveStatus = DRIVE_MAN_STATUS.STOP_MANUAL;
position_no_changed_cnt = 0;
return;
}
if (driveman_wait.CheckMark(TimeSpan.FromSeconds(2)))//每2秒检查一次
{ {
driveman_wait.Mark(); driveman_wait.Mark();
CurrObjSys.GetValueEx( CurrObjSys.GetValueEx(
...@@ -593,7 +613,8 @@ namespace FlyADBase ...@@ -593,7 +613,8 @@ namespace FlyADBase
ID, ID,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.GET_ZERO_POS); FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.GET_ZERO_POS);
} }
else { else
{
//参数不保存在设备中, 保存在电脑。 //参数不保存在设备中, 保存在电脑。
//参数写入到设备。 //参数写入到设备。
NotifyPropertyChanged(nameof(MotorType)); NotifyPropertyChanged(nameof(MotorType));
...@@ -682,7 +703,7 @@ namespace FlyADBase ...@@ -682,7 +703,7 @@ namespace FlyADBase
if (IsConnected) if (IsConnected)
{ {
ConnectCnt++; ConnectCnt++;
BeResetTime = DateTime.Now;
AfterConnected(); AfterConnected();
} }
else else
...@@ -1454,7 +1475,7 @@ namespace FlyADBase ...@@ -1454,7 +1475,7 @@ namespace FlyADBase
/// <param name="velocity"></param> /// <param name="velocity"></param>
public void SetVelocity(UInt32 velocity) public void SetVelocity(UInt32 velocity)
{ {
SetPosParam(velocity,UInt32.MaxValue, UInt32.MaxValue, UInt32.MaxValue, UInt32.MaxValue, UInt32.MaxValue); SetPosParam(velocity, UInt32.MaxValue, UInt32.MaxValue, UInt32.MaxValue, UInt32.MaxValue, UInt32.MaxValue);
} }
/// <summary> /// <summary>
...@@ -1805,7 +1826,8 @@ namespace FlyADBase ...@@ -1805,7 +1826,8 @@ namespace FlyADBase
public int HardwareVersion = 2; public int HardwareVersion = 2;
public static string[] GetMemberNames() { public static string[] GetMemberNames()
{
var type = typeof(FlyAD7JsonDb); var type = typeof(FlyAD7JsonDb);
return type.GetMembers().Select(mi => mi.Name).ToArray(); return type.GetMembers().Select(mi => mi.Name).ToArray();
} }
......
...@@ -50,7 +50,7 @@ namespace FlyADBase ...@@ -50,7 +50,7 @@ namespace FlyADBase
/// <summary> /// <summary>
/// 动作完成 /// 动作完成
/// </summary> /// </summary>
public bool IsFinish { get; set; } public bool IsFinish { get; set; } = true;
/// <summary> /// <summary>
/// 机架修正 /// 机架修正
......
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