Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
e002c0f5
Commit
e002c0f5
authored
Jul 26, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 AD盒脉冲3秒不变化。 状态设置为手动停止
parent
f64acccb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
95 deletions
+151
-95
FlyAD7.cs
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
+41
-19
GM_ScanMotion.cs
...ect.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanMotion.cs
+110
-76
No files found.
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
View file @
e002c0f5
...
...
@@ -348,7 +348,10 @@ namespace FlyADBase
/// 用于检测当 为IsRunning时,脉冲是否停了很久。
/// </summary>
int
last_position
=
int
.
MinValue
;
/// <summary>
/// 脉冲不变化次数
/// </summary>
int
position_no_changed_cnt
=
0
;
TimeSpan
NoTGridTimeOut
=
TimeSpan
.
FromSeconds
(
60
);
...
...
@@ -366,7 +369,8 @@ namespace FlyADBase
string
jsonDbPath
;
DateTime
lastTimeGridTime
;
static
FlyAD7
()
{
static
FlyAD7
()
{
propertyName_save
=
FlyAD7JsonDb
.
GetMemberNames
();
}
/// <summary>
...
...
@@ -456,17 +460,33 @@ namespace FlyADBase
()
=>
{
if
(!
IsConnected
)
{
position_no_changed_cnt
=
0
;
return
;
}
if
(
DriveStatus
!=
DRIVE_MAN_STATUS
.
RUNNING
)
{
position_no_changed_cnt
=
0
;
return
;
}
if
(
Position
!=
last_position
)
{
last_position
=
Position
;
position_no_changed_cnt
=
0
;
return
;
}
if
(
driveman_wait
.
CheckMark
(
TimeSpan
.
FromSeconds
(
3
)))
//每3秒检查一次
position_no_changed_cnt
++;
if
(
position_no_changed_cnt
>=
3
)
{
//连续3秒,脉冲一样
//异常
DriveStatus
=
DRIVE_MAN_STATUS
.
STOP_MANUAL
;
position_no_changed_cnt
=
0
;
return
;
}
if
(
driveman_wait
.
CheckMark
(
TimeSpan
.
FromSeconds
(
2
)))
//每2秒检查一次
{
driveman_wait
.
Mark
();
CurrObjSys
.
GetValueEx
(
...
...
@@ -593,7 +613,8 @@ namespace FlyADBase
ID
,
FLYAD7_OBJ_INTERFACE
.
SYS_DATA_INTERFACE
.
GET_ZERO_POS
);
}
else
{
else
{
//参数不保存在设备中, 保存在电脑。
//参数写入到设备。
NotifyPropertyChanged
(
nameof
(
MotorType
));
...
...
@@ -1454,7 +1475,7 @@ namespace FlyADBase
/// <param name="velocity"></param>
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>
...
...
@@ -1805,7 +1826,8 @@ namespace FlyADBase
public
int
HardwareVersion
=
2
;
public
static
string
[]
GetMemberNames
()
{
public
static
string
[]
GetMemberNames
()
{
var
type
=
typeof
(
FlyAD7JsonDb
);
return
type
.
GetMembers
().
Select
(
mi
=>
mi
.
Name
).
ToArray
();
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanMotion.cs
View file @
e002c0f5
...
...
@@ -128,24 +128,7 @@ namespace FLY.Thick.Base.Server
FinishEvent
?.
Invoke
(
this
,
null
);
base
.
Stop
();
}
bool
WaitFinish
(
ref
CTRLST
src
,
CTRLST
next
)
{
switch
(
mFlyAD
.
DriveStatus
)
{
case
DRIVE_MAN_STATUS
.
STOP
:
//完成任务
case
DRIVE_MAN_STATUS
.
LIMIT
:
{
src
=
next
;
return
true
;
}
break
;
case
DRIVE_MAN_STATUS
.
STOP_MANUAL
:
//异常
{
NotifyError
(
ERRNO_Running_Manual
);
Stop
();
return
false
;
}
break
;
}
return
false
;
}
protected
override
void
OnPoll
()
{
switch
(
state
)
...
...
@@ -157,15 +140,31 @@ namespace FLY.Thick.Base.Server
mFlyAD
.
Origin
();
state
=
CTRLST
.
ORIGINWAIT
;
}
else
{
else
{
state
=
CTRLST
.
SCAN_FORW
;
}
}
break
;
case
CTRLST
.
ORIGINWAIT
:
{
WaitFinish
(
ref
state
,
CTRLST
.
FORWARD
);
}
break
;
switch
(
mFlyAD
.
DriveStatus
)
{
case
DRIVE_MAN_STATUS
.
STOP
:
//完成任务
{
state
=
CTRLST
.
FORWARD
;
}
break
;
case
DRIVE_MAN_STATUS
.
LIMIT
:
case
DRIVE_MAN_STATUS
.
STOP_MANUAL
:
//异常
{
NotifyError
(
ERRNO_Running_Manual
);
Stop
();
}
break
;
}
}
break
;
case
CTRLST
.
FORWARD
:
{
int
to
=
ScanEnd
;
...
...
@@ -189,13 +188,18 @@ namespace FLY.Thick.Base.Server
mFlyAD
.
SetVelocity
(
Velocity
);
mFlyAD
.
Runto
(
to
);
state
=
CTRLST
.
FORWAIT_1
;
}
break
;
}
break
;
case
CTRLST
.
FORWAIT_1
:
{
if
(
WaitFinish
(
ref
state
,
CTRLST
.
FORWAIT_2
))
if
(
WaitFinish
())
{
state
=
CTRLST
.
FORWAIT_2
;
FlushAD
(
DIRECTION
.
FORWARD
);
}
}
break
;
}
break
;
case
CTRLST
.
FORWAIT_2
:
{
state
=
CTRLST
.
BACKWARD
;
...
...
@@ -217,16 +221,22 @@ namespace FLY.Thick.Base.Server
state
=
CTRLST
.
FORWAIT_SAMPLE
;
}
}
}
break
;
}
break
;
case
CTRLST
.
FORWAIT_SAMPLE
:
{
WaitFinish
(
ref
state
,
CTRLST
.
FORW_SAMPLE
);
}
break
;
if
(
WaitFinish
())
{
state
=
CTRLST
.
FORW_SAMPLE
;
}
}
break
;
case
CTRLST
.
FORW_SAMPLE
:
{
gsample
.
Do
(
Misc
.
DIRECTION
.
FORWARD
);
state
=
CTRLST
.
BACKWARD
;
}
break
;
}
break
;
case
CTRLST
.
BACKWARD
:
{
int
to
=
ScanStart
;
...
...
@@ -250,12 +260,17 @@ namespace FLY.Thick.Base.Server
mFlyAD
.
SetVelocity
(
Velocity
);
mFlyAD
.
Runto
(
to
);
state
=
CTRLST
.
BACKWAIT_1
;
}
break
;
}
break
;
case
CTRLST
.
BACKWAIT_1
:
{
if
(
WaitFinish
(
ref
state
,
CTRLST
.
BACKWAIT_2
))
if
(
WaitFinish
())
{
state
=
CTRLST
.
BACKWAIT_2
;
FlushAD
(
DIRECTION
.
BACKWARD
);
}
break
;
}
}
break
;
case
CTRLST
.
BACKWAIT_2
:
{
int
b
,
e
;
...
...
@@ -275,17 +290,23 @@ namespace FLY.Thick.Base.Server
state
=
CTRLST
.
BACKWAIT_SAMPLE
;
}
}
else
{
else
{
//完成一次周期
if
(!
gsample
.
IsFailure
())
orgStartTime
=
timer
.
Elapsed
;
state
=
CTRLST
.
INIT
;
}
}
break
;
}
break
;
case
CTRLST
.
BACKWAIT_SAMPLE
:
{
WaitFinish
(
ref
state
,
CTRLST
.
BACKW_SAMPLE
);
}
break
;
if
(
WaitFinish
())
{
state
=
CTRLST
.
BACKW_SAMPLE
;
}
}
break
;
case
CTRLST
.
BACKW_SAMPLE
:
{
gsample
.
Do
(
Misc
.
DIRECTION
.
BACKWARD
);
...
...
@@ -293,7 +314,8 @@ namespace FLY.Thick.Base.Server
if
(!
gsample
.
IsFailure
())
orgStartTime
=
timer
.
Elapsed
;
state
=
CTRLST
.
INIT
;
}
break
;
}
break
;
case
CTRLST
.
SCAN_FORW
:
...
...
@@ -306,9 +328,12 @@ namespace FLY.Thick.Base.Server
break
;
case
CTRLST
.
SCAN_FORWAIT
:
{
if
(
WaitFinish
(
ref
state
,
CTRLST
.
SCAN_BACKW
))
if
(
WaitFinish
())
{
state
=
CTRLST
.
SCAN_BACKW
;
FlushAD
(
DIRECTION
.
FORWARD
);
}
}
break
;
case
CTRLST
.
SCAN_BACKW
:
{
...
...
@@ -320,16 +345,20 @@ namespace FLY.Thick.Base.Server
break
;
case
CTRLST
.
SCAN_BACKWAIT
:
{
if
(
WaitFinish
(
ref
state
,
CTRLST
.
INIT
))
if
(
WaitFinish
())
{
state
=
CTRLST
.
INIT
;
FlushAD
(
DIRECTION
.
BACKWARD
);
}
}
break
;
}
}
private
bool
IsOrging
()
{
if
(
OrgInterval
>
0
)
{
if
(
OrgInterval
>
0
)
{
if
(
timer
.
Elapsed
>=
(
orgStartTime
+
TimeSpan
.
FromMinutes
(
OrgInterval
)))
return
true
;
...
...
@@ -492,24 +521,7 @@ namespace FLY.Thick.Base.Server
FinishEvent
(
this
,
null
);
base
.
Stop
();
}
bool
WaitFinish
(
ref
CTRLST
src
,
CTRLST
next
)
{
switch
(
mFlyAD
.
DriveStatus
)
{
case
DRIVE_MAN_STATUS
.
STOP
:
//完成任务
case
DRIVE_MAN_STATUS
.
LIMIT
:
{
src
=
next
;
return
true
;
}
break
;
case
DRIVE_MAN_STATUS
.
STOP_MANUAL
:
//异常
{
NotifyError
(
ERRNO_Running_Manual
);
Stop
();
return
false
;
}
break
;
}
return
false
;
}
protected
override
void
OnPoll
()
{
switch
(
state
)
...
...
@@ -518,48 +530,69 @@ namespace FLY.Thick.Base.Server
{
mFlyAD
.
Origin
();
state
=
CTRLST
.
READY_ORIGINWAIT
;
}
break
;
}
break
;
case
CTRLST
.
READY_ORIGINWAIT
:
{
WaitFinish
(
ref
state
,
CTRLST
.
READY_BACKW
);
}
break
;
if
(
WaitFinish
())
{
state
=
CTRLST
.
READY_BACKW
;
}
}
break
;
case
CTRLST
.
READY_BACKW
:
{
mFlyAD
.
SetVelocity
(
Velocity
);
mFlyAD
.
RuntoMin
();
state
=
CTRLST
.
READY_BACKWAIT
;
}
break
;
}
break
;
case
CTRLST
.
READY_BACKWAIT
:
{
WaitFinish
(
ref
state
,
CTRLST
.
SFORWARD
);
}
break
;
if
(
WaitFinish
())
{
state
=
CTRLST
.
SFORWARD
;
}
}
break
;
case
CTRLST
.
SFORWARD
:
{
mFlyAD
.
SetVelocity
(
Velocity
);
mFlyAD
.
RuntoMax
();
state
=
CTRLST
.
SFORWAIT_1
;
}
break
;
}
break
;
case
CTRLST
.
SFORWAIT_1
:
{
if
(
WaitFinish
(
ref
state
,
CTRLST
.
SFORWAIT_2
))
if
(
WaitFinish
())
{
state
=
CTRLST
.
SFORWAIT_2
;
FlushAD
(
DIRECTION
.
FORWARD
);
}
break
;
}
}
break
;
case
CTRLST
.
SFORWAIT_2
:
{
state
=
CTRLST
.
SBACKWARD
;
}
break
;
}
break
;
case
CTRLST
.
SBACKWARD
:
{
mFlyAD
.
SetVelocity
(
Velocity
);
mFlyAD
.
RuntoMin
();
state
=
CTRLST
.
SBACKWAIT_1
;
}
break
;
}
break
;
case
CTRLST
.
SBACKWAIT_1
:
{
if
(
WaitFinish
(
ref
state
,
CTRLST
.
SBACKWAIT_2
))
if
(
WaitFinish
())
{
state
=
CTRLST
.
SBACKWAIT_2
;
FlushAD
(
DIRECTION
.
BACKWARD
);
}
break
;
}
}
break
;
case
CTRLST
.
SBACKWAIT_2
:
{
state
=
CTRLST
.
SFORWARD
;
...
...
@@ -573,7 +606,8 @@ namespace FLY.Thick.Base.Server
//扫描完成
Stop
();
return
;
}
}
break
;
}
break
;
}
}
private
void
FlushAD
(
Misc
.
DIRECTION
direction
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment