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
5207ee25
Commit
5207ee25
authored
May 12, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复 flyad.B2 开机速度写入 0xFFFFFFFF。 B2程序写错,手动速度 用了 扫描速度,且一开机写了0xFFFFFFFF,导致一开机手动正转,就会快过头,撞烂探头
2.优化 flyad.B2 使用批量写入,启动初始化从 2.4s 缩短到 1s
parent
7bc1dcf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
45 deletions
+66
-45
FlyAd2021B2.cs
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2.cs
+65
-43
IFlyAD.cs
Project.FLY.FlyADBase/FlyAd2021.B2/Inc/IFlyAD.cs
+1
-2
No files found.
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2.cs
View file @
5207ee25
using
AutoMapper
;
#
define
ENABLE_MULTI_TRANS
using
AutoMapper
;
using
FlyADBase.Inc
;
using
FObjBase
;
using
GeneralGommunication
;
...
...
@@ -11,6 +13,8 @@ using System.ComponentModel;
using
System.IO
;
using
System.Linq
;
namespace
FlyADBase
{
public
partial
class
FlyAd2021B2
:
IFlyADClient
...
...
@@ -667,8 +671,9 @@ namespace FlyADBase
//从设备读取参数
//获取当前全部状态
//core.BuildMultiTrans(() =>
//{
#if ENABLE_MULTI_TRANS
core
.
BuildMultiTrans
(()
=>{
#endif
core
.
GetSysParam_Jog
((
asyncContext
,
retData
)
=>
JogVelocity
=
(
UInt32
)
retData
,
null
);
core
.
GetSysParam_Zero
((
asyncContext
,
retData
)
=>
PosOffset
=
(
Int16
)
retData
,
null
);
core
.
GetSysParam_MotorType
((
asyncContext
,
retData
)
=>
MotorType
=
(
MOTORTYPE
)
retData
,
null
);
...
...
@@ -681,26 +686,26 @@ namespace FlyADBase
core
.
GetRunParam_DecTime
((
asyncContext
,
retData
)
=>
DTime
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_HSpd1
((
asyncContext
,
retData
)
=>
HVelocity1
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_HSpd2
((
asyncContext
,
retData
)
=>
HVelocity2
=
(
UInt32
)
retData
,
null
);
//});
#if ENABLE_MULTI_TRANS
});
#endif
}
else
{
//参数不保存在设备中, 保存在电脑。
//参数写入到设备。
//core.BuildMultiTrans(() =>
//{
#if ENABLE_MULTI_TRANS
core
.
BuildMultiTrans
(()
=>{
#endif
core
.
SetSysParam_MotorType
(
MotorType
,
null
,
null
);
core
.
SetSysParam_Ratio01
(
Ratio01
,
null
,
null
);
core
.
SetSysParam_Ratio02
(
Ratio02
,
null
,
null
);
core
.
SetSysParam_Zero
(
PosOffset
,
null
,
null
);
core
.
SetSysParam_Jog
(
JogVelocity
,
null
,
null
);
core
.
SetSysParam_Apply
(
null
,
null
);
//});
//NotifyPropertyChanged(nameof(MotorType));
//NotifyPropertyChanged(nameof(Ratio01));
//NotifyPropertyChanged(nameof(Ratio02));
//NotifyPropertyChanged(nameof(PosOffset));
//NotifyPropertyChanged(nameof(JogVelocity));
#if ENABLE_MULTI_TRANS
});
#endif
}
GetAccess
();
...
...
@@ -710,13 +715,17 @@ namespace FlyADBase
isReadyContext
.
Reset
();
sysTickContext
.
Reset
();
calSpeed
.
Reset
();
GetRunResult
();
GetOut
();
GetIn
();
GetEnc1
();
GetEnc2
();
#if ENABLE_MULTI_TRANS
core
.
BuildMultiTrans
(()
=>{
#endif
GetRunResult
();
GetOut
();
GetIn
();
GetEnc1
();
GetEnc2
();
#if ENABLE_MULTI_TRANS
});
#endif
advAfterContected
();
...
...
@@ -887,37 +896,44 @@ namespace FlyADBase
/// <param name="enable"></param>
public
void
SetOutput
(
UInt16
mask
,
UInt16
enable
)
{
core
.
SetOutPorts
(
mask
,
enable
,
(
asyncConetext
,
_retData
)
=>
{
#if ENABLE_MULTI_TRANS
core
.
BuildMultiTrans
(()
=>{
#endif
core
.
SetOutPorts
(
mask
,
enable
,
null
,
null
);
GetOut
();
},
null
);
#if ENABLE_MULTI_TRANS
});
#endif
}
#
region
速度参数
#region 速度参数
/// <summary>
/// 设置速度参数
/// </summary>
/// <param name="velocity">runto 速度 pps</param>
/// <param name="sv">开始速度 pps</param>
/// <param name="atime">加速时间 ms</param>
/// <param name="dtime">减速时间 ms</param>
/// <param name="hspeed1">归0 第1段速 pps</param>
/// <param name="hspeed2">归0 第2段速 pps</param>
public
void
SetPosParam
(
UInt32
velocity
,
UInt32
sv
,
UInt32
atime
,
UInt32
dtime
,
UInt32
hspeed1
,
UInt32
hspeed2
)
public
void
SetPosParam
(
UInt32
sv
,
UInt32
atime
,
UInt32
dtime
,
UInt32
hspeed1
,
UInt32
hspeed2
)
{
core
.
SetRunParam_V
(
velocity
,
null
,
null
);
core
.
SetRunParam_SV
(
sv
,
null
,
null
);
core
.
SetRunParam_AccTime
(
atime
,
null
,
null
);
core
.
SetRunParam_DecTime
(
dtime
,
null
,
null
);
core
.
SetRunParam_HSpd1
(
hspeed1
,
null
,
null
);
core
.
SetRunParam_HSpd2
(
hspeed2
,
null
,
null
);
core
.
GetRunParam_V
((
asyncContext
,
retData
)
=>
Velocity
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_SV
((
asyncContext
,
retData
)
=>
SVelocity
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_AccTime
((
asyncContext
,
retData
)
=>
ATime
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_DecTime
((
asyncContext
,
retData
)
=>
DTime
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_HSpd1
((
asyncContext
,
retData
)
=>
HVelocity1
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_HSpd2
((
asyncContext
,
retData
)
=>
HVelocity2
=
(
UInt32
)
retData
,
null
);
#if ENABLE_MULTI_TRANS
core
.
BuildMultiTrans
(()
=>{
#endif
core
.
SetRunParam_SV
(
sv
,
null
,
null
);
core
.
SetRunParam_AccTime
(
atime
,
null
,
null
);
core
.
SetRunParam_DecTime
(
dtime
,
null
,
null
);
core
.
SetRunParam_HSpd1
(
hspeed1
,
null
,
null
);
core
.
SetRunParam_HSpd2
(
hspeed2
,
null
,
null
);
core
.
GetRunParam_SV
((
asyncContext
,
retData
)
=>
SVelocity
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_AccTime
((
asyncContext
,
retData
)
=>
ATime
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_DecTime
((
asyncContext
,
retData
)
=>
DTime
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_HSpd1
((
asyncContext
,
retData
)
=>
HVelocity1
=
(
UInt32
)
retData
,
null
);
core
.
GetRunParam_HSpd2
((
asyncContext
,
retData
)
=>
HVelocity2
=
(
UInt32
)
retData
,
null
);
#if ENABLE_MULTI_TRANS
});
#endif
}
/// <summary>
/// 设置速度
...
...
@@ -925,9 +941,15 @@ namespace FlyADBase
/// <param name="velocity"></param>
public
void
SetVelocity
(
UInt32
velocity
)
{
core
.
SetRunParam_V
(
velocity
,
null
,
null
);
core
.
GetRunParam_V
((
asyncContext
,
retData
)
=>
Velocity
=
(
UInt32
)
retData
,
null
);
#if ENABLE_MULTI_TRANS
core
.
BuildMultiTrans
(()
=>{
#endif
core
.
SetRunParam_V
(
velocity
,
null
,
null
);
core
.
GetRunParam_V
((
asyncContext
,
retData
)
=>
Velocity
=
(
UInt32
)
retData
,
null
);
#if ENABLE_MULTI_TRANS
});
#endif
}
...
...
@@ -999,9 +1021,9 @@ namespace FlyADBase
core
.
Forw
(
126
,
null
,
null
);
}
#
endregion
#endregion
#
endregion
#endregion
}
...
...
Project.FLY.FlyADBase/FlyAd2021.B2/Inc/IFlyAD.cs
View file @
5207ee25
...
...
@@ -125,13 +125,12 @@ namespace FlyADBase
/// <summary>
/// 设置速度参数
/// </summary>
/// <param name="velocity">runto 速度 pps</param>
/// <param name="sv">开始速度 pps</param>
/// <param name="atime">加速时间 ms</param>
/// <param name="dtime">减速时间 ms</param>
/// <param name="hspeed1">归0 第1段速 pps</param>
/// <param name="hspeed2">归0 第2段速 pps</param>
void
SetPosParam
(
UInt32
velocity
,
UInt32
sv
,
UInt32
atime
,
UInt32
dtime
,
UInt32
hspeed1
,
UInt32
hspeed2
);
void
SetPosParam
(
UInt32
sv
,
UInt32
atime
,
UInt32
dtime
,
UInt32
hspeed1
,
UInt32
hspeed2
);
/// <summary>
/// 设置速度
/// </summary>
...
...
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