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
Expand all
Hide 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,14 +348,17 @@ namespace FlyADBase
...
@@ -348,14 +348,17 @@ 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
);
Stopwatch
stopwatch_noTGrid
=
new
Stopwatch
();
Stopwatch
stopwatch_noTGrid
=
new
Stopwatch
();
IsReadyContext
isReadyContext
=
new
IsReadyContext
();
IsReadyContext
isReadyContext
=
new
IsReadyContext
();
SysTickContext
sysTickContext
=
new
SysTickContext
();
SysTickContext
sysTickContext
=
new
SysTickContext
();
...
@@ -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>
...
@@ -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
>=
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
();
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
));
...
@@ -658,7 +679,7 @@ namespace FlyADBase
...
@@ -658,7 +679,7 @@ namespace FlyADBase
ID
,
ID
,
FLYAD7_OBJ_INTERFACE
.
FLYIO_OBJ_INTERFACE
.
GET_IO
);
FLYAD7_OBJ_INTERFACE
.
FLYIO_OBJ_INTERFACE
.
GET_IO
);
NotifyPropertyChanged
(
nameof
(
Pos1LCShift
));
//写入到AD盒
NotifyPropertyChanged
(
nameof
(
Pos1LCShift
));
//写入到AD盒
NotifyPropertyChanged
(
nameof
(
Pos2LCShift
));
//写入到AD盒
NotifyPropertyChanged
(
nameof
(
Pos2LCShift
));
//写入到AD盒
...
@@ -908,7 +929,7 @@ namespace FlyADBase
...
@@ -908,7 +929,7 @@ namespace FlyADBase
Position
=
pack
.
pos1
;
Position
=
pack
.
pos1
;
DateTime
dt
=
sysTickContext
.
ToDateTime
(
pack
.
systick
);
DateTime
dt
=
sysTickContext
.
ToDateTime
(
pack
.
systick
);
Now
=
dt
;
Now
=
dt
;
PositionChangedEvent
?.
Invoke
(
this
,
new
PositionChangedEventArgs
()
{
Time
=
dt
,
Position
=
Position
});
PositionChangedEvent
?.
Invoke
(
this
,
new
PositionChangedEventArgs
()
{
Time
=
dt
,
Position
=
Position
});
}
}
calSpeed
.
SetPos1
(
Now
,
Position
);
calSpeed
.
SetPos1
(
Now
,
Position
);
...
@@ -933,7 +954,7 @@ namespace FlyADBase
...
@@ -933,7 +954,7 @@ namespace FlyADBase
Position2
=
pack
.
pos2
;
Position2
=
pack
.
pos2
;
DateTime
dt
=
sysTickContext
.
ToDateTime
(
pack
.
systick
);
DateTime
dt
=
sysTickContext
.
ToDateTime
(
pack
.
systick
);
Now
=
dt
;
Now
=
dt
;
Position2ChangedEvent
?.
Invoke
(
this
,
new
PositionChangedEventArgs
()
{
Time
=
dt
,
Position
=
Position
});
Position2ChangedEvent
?.
Invoke
(
this
,
new
PositionChangedEventArgs
()
{
Time
=
dt
,
Position
=
Position
});
}
}
calSpeed
.
SetPos2
(
Now
,
Position2
);
calSpeed
.
SetPos2
(
Now
,
Position2
);
...
@@ -1158,7 +1179,7 @@ namespace FlyADBase
...
@@ -1158,7 +1179,7 @@ namespace FlyADBase
}
}
break
;
break
;
}
}
_end_push_info
:
_end_push_info
:
bShieldSetValueEx
=
false
;
bShieldSetValueEx
=
false
;
}
}
...
@@ -1183,7 +1204,7 @@ namespace FlyADBase
...
@@ -1183,7 +1204,7 @@ namespace FlyADBase
ID
,
ID
,
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
CALL_PXX
,
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
CALL_PXX
,
new
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
Pack_CallRunto
()
{
to
=
TargetPos
}.
ToBytes
());
new
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
Pack_CallRunto
()
{
to
=
TargetPos
}.
ToBytes
());
}
}
break
;
break
;
case
DRIVE_MAN_ORDER
.
ORIGIN
:
case
DRIVE_MAN_ORDER
.
ORIGIN
:
...
@@ -1256,9 +1277,9 @@ namespace FlyADBase
...
@@ -1256,9 +1277,9 @@ namespace FlyADBase
bool
ret
=
FlyAD7JsonDb
.
Load
(
jsonDbPath
,
this
);
bool
ret
=
FlyAD7JsonDb
.
Load
(
jsonDbPath
,
this
);
bShieldSetValueEx
=
false
;
bShieldSetValueEx
=
false
;
this
.
PropertyChanged
+=
FlyAD7_PropertyChanged2
;
this
.
PropertyChanged
+=
FlyAD7_PropertyChanged2
;
return
ret
;
return
ret
;
}
}
...
@@ -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>
...
@@ -1477,7 +1498,7 @@ namespace FlyADBase
...
@@ -1477,7 +1498,7 @@ namespace FlyADBase
FLYAD7_OBJ_INTERFACE
.
SYS_DATA_INTERFACE
.
GET_SYSINFO
);
FLYAD7_OBJ_INTERFACE
.
SYS_DATA_INTERFACE
.
GET_SYSINFO
);
}
}
/// <summary>
/// <summary>
/// 初始化系统信息区
/// 初始化系统信息区
/// </summary>
/// </summary>
...
@@ -1789,12 +1810,12 @@ namespace FlyADBase
...
@@ -1789,12 +1810,12 @@ namespace FlyADBase
//备份参数
//备份参数
public
bool
IsDevParamValid
=
false
;
public
bool
IsDevParamValid
=
false
;
public
MOTORTYPE
MotorType
=
MOTORTYPE
.
SERVO
;
public
MOTORTYPE
MotorType
=
MOTORTYPE
.
SERVO
;
public
UInt16
PosOfGrid
=
10
;
public
UInt16
PosOfGrid
=
10
;
public
UInt16
Ratio01
=
4
;
public
UInt16
Ratio01
=
4
;
public
UInt16
Ratio02
=
1
;
public
UInt16
Ratio02
=
1
;
public
Int16
PosOffset
=
0
;
public
Int16
PosOffset
=
0
;
public
UInt32
JogVelocity
=
1000
;
public
UInt32
JogVelocity
=
1000
;
/// <summary>
/// <summary>
/// 硬件版本
/// 硬件版本
...
@@ -1805,8 +1826,9 @@ namespace FlyADBase
...
@@ -1805,8 +1826,9 @@ 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
();
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanMotion.cs
View file @
e002c0f5
This diff is collapsed.
Click to expand it.
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