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
08549d34
Commit
08549d34
authored
Mar 28, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 FLYAD7_WPF
parent
3766d41e
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
348 additions
and
317 deletions
+348
-317
FLYAD7.cs
Project.FLY.FlyADBase/FLY.Simulation.Flyad7/FLYAD7.cs
+1
-1
FlyAD7.cs
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
+6
-52
FlyADBase.csproj
Project.FLY.FlyADBase/FlyADBase/FlyADBase.csproj
+1
-0
FlyADClientAdv.cs
Project.FLY.FlyADBase/FlyADBase/FlyADClientAdv.cs
+4
-0
IFlyAD.cs
Project.FLY.FlyADBase/FlyADBase/IFlyAD.cs
+9
-1
IFlyADClient.cs
Project.FLY.FlyADBase/FlyADBase/IFlyADClient.cs
+76
-0
IFlyADClientAdv.cs
Project.FLY.FlyADBase/FlyADBase/IFlyADClientAdv.cs
+1
-64
AutoForwBackw.cs
Project.FLY.FlyADBase/Flyad7_WPF/AutoForwBackw.cs
+15
-13
DebugAppParam.cs
Project.FLY.FlyADBase/Flyad7_WPF/DebugAppParam.cs
+0
-21
Flyad7_WPF.csproj
Project.FLY.FlyADBase/Flyad7_WPF/Flyad7_WPF.csproj
+7
-0
MainWindow.xaml
Project.FLY.FlyADBase/Flyad7_WPF/MainWindow.xaml
+26
-12
MainWindow.xaml.cs
Project.FLY.FlyADBase/Flyad7_WPF/MainWindow.xaml.cs
+19
-89
UnityExt.cs
Project.FLY.FlyADBase/Flyad7_WPF/UnityExt.cs
+5
-6
WdConvolutionStyle.xaml
...lyADBase/Flyad7_WPF/WdConvolution/WdConvolutionStyle.xaml
+1
-2
WdSetVelocity.xaml
Project.FLY.FlyADBase/Flyad7_WPF/WdSetVelocity.xaml
+59
-0
WdSetVelocity.xaml.cs
Project.FLY.FlyADBase/Flyad7_WPF/WdSetVelocity.xaml.cs
+107
-0
Window_sync.xaml
Project.FLY.FlyADBase/Flyad7_WPF/Window_sync.xaml
+9
-30
Window_sync.xaml.cs
Project.FLY.FlyADBase/Flyad7_WPF/Window_sync.xaml.cs
+2
-26
No files found.
Project.FLY.FlyADBase/FLY.Simulation.Flyad7/FLYAD7.cs
View file @
08549d34
...
...
@@ -280,7 +280,7 @@ namespace FLY.Simulation.Flyad7
ADCnt
++;
AD
=
ad
;
TimeGrid
.
Add
(
ad
);
if
(
TimeGrid
.
Count
>=
10
00
)
if
(
TimeGrid
.
Count
>=
2
00
)
{
ADForShow
=
ADSum
/
ADCnt
;
ADSum
=
0
;
...
...
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
View file @
08549d34
...
...
@@ -20,7 +20,6 @@ namespace FlyADBase
public
partial
class
FlyAD7
:
FObj
,
IFlyADClient
{
#
region
MARKNO
const
int
MARKNO_SET_VELOCITY
=
1
;
const
int
MARKNO_SET_ZEROPOS
=
2
;
const
int
MARKNO_SET_SYSPARAM
=
3
;
const
int
MARKNO_SET_SAVE
=
4
;
...
...
@@ -70,7 +69,7 @@ namespace FlyADBase
bool
isReadyGetPos1AD1
=
false
;
bool
isReadyGetPos2
=
false
;
bool
isReadyGetIO
=
false
;
static
FlyAD7
()
{
propertyName_save
=
FlyAD7JsonDb
.
GetMemberNames
();
}
...
...
@@ -253,22 +252,6 @@ namespace FlyADBase
if
(
bShieldSetValueEx
)
return
;
//if ((e.PropertyName == nameof(Velocity)) ||
// (e.PropertyName == nameof(SVelocity)) ||
// (e.PropertyName == nameof(ATime)) ||
// (e.PropertyName == nameof(DTime)) ||
// (e.PropertyName == nameof(HVelocity1)) ||
// (e.PropertyName == nameof(HVelocity2)))
//{
// FObjBase.PollModule.Current.Poll_JustOnce(
// delegate ()
// {
// //TODO,不应该直接修改Velocity,SVelocity。。。。。。
// //所以下面也不可能存在!!!
// SetPosParam(Velocity, SVelocity, ATime, DTime, HVelocity1, HVelocity2);
// }, this, MARKNO_SET_VELOCITY);
//}
//else
if
((
e
.
PropertyName
==
nameof
(
PosOffset
))
||
(
e
.
PropertyName
==
nameof
(
JogVelocity
)))
{
...
...
@@ -308,33 +291,8 @@ namespace FlyADBase
pos1_LCShift
=
Pos1LCShift
}.
ToBytes
());
}
//else if (e.PropertyName == nameof(Position2))
//{
// CurrObjSys.CallFunctionEx(
// conn,
// FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID,
// ID,
// FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.CALL_PXX,
// new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_Pos2()
// {
// pos2 = Position2
// }.ToBytes());
//}
//else if (e.PropertyName == nameof(Pos2Comp))
//{
// CurrObjSys.CallFunctionEx(
// conn,
// FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID,
// ID,
// FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.CALL_PXX,
// new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_Pos2Comp()
// {
// comp = Pos2Comp
// }.ToBytes());
//}
}
void
Init
()
{
//CurrObjSys.SenseConfigEx(
...
...
@@ -409,7 +367,7 @@ namespace FlyADBase
NotifyPropertyChanged
(
nameof
(
Pos1LCShift
));
//写入到AD盒
SyncPos2Clear
();
SyncClear
();
SyncEnd
();
...
...
@@ -1570,6 +1528,7 @@ namespace FlyADBase
/// 设置纵向位置
/// </summary>
/// <param name="postion2"></param>
[
Obsolete
(
"pos2 不应该被修改"
)]
public
void
SetPos2
(
int
postion2
)
{
...
...
@@ -1606,6 +1565,7 @@ namespace FlyADBase
/// </summary>
/// <param name="pos2"></param>
/// <param name="immediately">只要是 01,就立刻修正</param>
[
Obsolete
(
"pos2 不应该被修改"
)]
public
void
SetPos2At01
(
int
pos2
,
bool
immediately
)
{
CurrObjSys
.
CallFunctionEx
(
...
...
@@ -1627,6 +1587,7 @@ namespace FlyADBase
/// 进入同步状态
/// </summary>
/// <param name="pos2"></param>
[
Obsolete
(
"pos2 不应该被修改"
)]
public
void
SyncBegin
(
int
pos2
)
{
Drive
(
DRIVE_MAN_ORDER
.
SYNC
,
pos2
);
...
...
@@ -1671,6 +1632,7 @@ namespace FlyADBase
/// <summary>
/// 清空POS2同步列表
/// </summary>
[
Obsolete
(
"pos2 不应该被修改"
)]
public
void
SyncPos2Clear
()
{
CurrObjSys
.
CallFunctionEx
(
...
...
@@ -1849,14 +1811,6 @@ namespace FlyADBase
this
.
PropertyChanged
-=
FlyAD7_PropertyChanged2
;
bool
ret
=
FlyAD7JsonDb
.
Load
(
jsonDbPath
,
this
);
this
.
PropertyChanged
+=
FlyAD7_PropertyChanged2
;
MotorType
=
Backup_MotorType
;
PosOfGrid
=
Backup_PosOfGrid
;
Ratio01
=
Backup_Ratio01
;
Ratio02
=
Backup_Ratio02
;
PosOffset
=
Backup_PosOffset
;
JogVelocity
=
Backup_JogVelocity
;
return
ret
;
...
...
Project.FLY.FlyADBase/FlyADBase/FlyADBase.csproj
View file @
08549d34
...
...
@@ -53,6 +53,7 @@
<Compile
Include=
"EventArgs\GridIStatusEventArgs.cs"
/>
<Compile
Include=
"FlyADClientAdv.cs"
/>
<Compile
Include=
"IFlyAD.cs"
/>
<Compile
Include=
"IFlyADClient.cs"
/>
<Compile
Include=
"IFlyADClientAdv.cs"
/>
<Compile
Include=
"EventArgs\IStatusChangedEventArgs.cs"
/>
<Compile
Include=
"EventArgs\MiniGridEventArgs.cs"
/>
...
...
Project.FLY.FlyADBase/FlyADBase/FlyADClientAdv.cs
View file @
08549d34
...
...
@@ -502,6 +502,10 @@ namespace FlyADBase
{
//获取ad列表
var
adList
=
mTimeGridAdvHelper
.
GetAD
(
beginTime
,
endTime
,
out
DateTime
reponse_endTime
);
int
adCnt
=
adList
.
Count
();
if
(
adCnt
==
0
)
return
;
//获取pos
var
posList
=
mTimeGridAdvHelper
.
GetPos
(
reponse_endTime
,
adList
.
Count
());
...
...
Project.FLY.FlyADBase/FlyADBase/IFlyAD.cs
View file @
08549d34
...
...
@@ -33,14 +33,17 @@ namespace FlyADBase
/// 脉冲
/// </summary>
int
Position
{
get
;
}
/// <summary>
/// 速度 pps
/// </summary>
int
Speed
{
get
;
}
/// <summary>
/// 1000ms从AD卡获取(或推送)1个AD值。此AD值只用于调试,定点
/// </summary>
int
AD
{
get
;
}
/// <summary>
/// AD值最大值 ,恒定返回65535
/// </summary>
...
...
@@ -278,11 +281,13 @@ namespace FlyADBase
/// 设置纵向位置
/// </summary>
/// <param name="postion2"></param>
[
Obsolete
(
"pos2 不应该被修改"
)]
void
SetPos2
(
int
postion2
);
/// <summary>
/// 纵向偏移,这个是相对量
/// </summary>
[
Obsolete
(
"pos2 不应该被修改"
)]
void
SetPos2Offset
(
int
offset
);
/// <summary>
...
...
@@ -290,14 +295,16 @@ namespace FlyADBase
/// </summary>
/// <param name="pos2"></param>
/// <param name="immediately">只要是 01,就立刻修正</param>
[
Obsolete
(
"pos2 不应该被修改"
)]
void
SetPos2At01
(
int
pos2
,
bool
immediately
);
#
endregion
#
region
同步控制
同步状态转换规则
/// <summary>
/// 进入同步状态
/// </summary>
/// <param name="pos2"></param>
[
Obsolete
(
"pos2 不应该被修改"
)]
void
SyncBegin
(
int
pos2
);
/// <summary>
/// 进入同步状态
...
...
@@ -314,6 +321,7 @@ namespace FlyADBase
/// <summary>
/// 清空POS2同步列表
/// </summary>
[
Obsolete
(
"pos2 不应该被修改"
)]
void
SyncPos2Clear
();
#
endregion
#
region
同步扫描
脚本指令
...
...
Project.FLY.FlyADBase/FlyADBase/IFlyADClient.cs
0 → 100644
View file @
08549d34
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
FlyADBase
{
/// <summary>
/// 客户端AD盒
/// </summary>
public
interface
IFlyADClient
:
IFlyAD
{
/// <summary>
/// 连接成功
/// </summary>
bool
IsConnected
{
get
;
}
/// <summary>
/// 重连次数
/// </summary>
int
ConnectCnt
{
get
;
}
/// <summary>
/// CRC 校正
/// </summary>
bool
HasCRC
{
get
;
set
;
}
/// <summary>
/// 连接
/// </summary>
void
Connect
();
/// <summary>
/// 连接 addr
/// </summary>
/// <param name="addr"></param>
void
Connect
(
string
addr
);
/// <summary>
/// 重连
/// </summary>
void
ReConnect
();
/// <summary>
/// 已经从AD盒获取全部当前数据
/// </summary>
bool
IsReady
{
get
;
}
/// <summary>
/// 通过判断systick,判断AD盒是否发生重启;
/// BeResetTime为上一次被复位时间, 此为 电脑的时间
/// </summary>
DateTime
BeResetTime
{
get
;
}
/// <summary>
/// 用于同步, 最后一次 纵向信号 0->1 时,主轴脉冲
/// </summary>
[
Obsolete
(
"偏移都由电脑计算,不需要AD盒处理"
)]
int
LastPos2At01
{
get
;
}
/// <summary>
/// 当前在同步状态
/// </summary>
bool
IsSync
{
get
;
}
/// <summary>
/// 同步列表,完成后,会删除
/// </summary>
ObservableCollection
<
SyncOrder
>
SyncOrders
{
get
;
}
}
}
Project.FLY.FlyADBase/FlyADBase/IFlyADClientAdv.cs
View file @
08549d34
...
...
@@ -9,72 +9,8 @@ using System.Threading.Tasks;
namespace
FlyADBase
{
/// <summary>
/// 客户端AD盒
/// </summary>
public
interface
IFlyADClient
:
IFlyAD
{
/// <summary>
/// 连接成功
/// </summary>
bool
IsConnected
{
get
;
}
/// <summary>
/// 重连次数
/// </summary>
int
ConnectCnt
{
get
;
}
/// <summary>
/// CRC 校正
/// </summary>
bool
HasCRC
{
get
;
set
;
}
/// <summary>
/// 连接
/// </summary>
void
Connect
();
/// <summary>
/// 连接 addr
/// </summary>
/// <param name="addr"></param>
void
Connect
(
string
addr
);
/// <summary>
/// 重连
/// </summary>
void
ReConnect
();
/// <summary>
/// 已经从AD盒获取全部当前数据
/// </summary>
bool
IsReady
{
get
;
}
/// <summary>
/// 通过判断systick,判断AD盒是否发生重启;
/// BeResetTime为上一次被复位时间
/// </summary>
DateTime
BeResetTime
{
get
;
}
/// <summary>
/// 用于同步, 最后一次 纵向信号 0->1 时,主轴脉冲
/// </summary>
int
LastPos2At01
{
get
;
}
/// <summary>
/// 当前在同步状态
/// </summary>
bool
IsSync
{
get
;
}
/// <summary>
/// 同步列表,完成后,会删除
/// </summary>
ObservableCollection
<
SyncOrder
>
SyncOrders
{
get
;
}
}
/// <summary>
/// 客户端AD盒附加的功能
/// </summary>
...
...
@@ -85,6 +21,7 @@ namespace FlyADBase
/// 通过脉冲计算速度,不使用AD盒的输出
/// </summary>
bool
IsCalSpeed
{
get
;
set
;
}
/// <summary>
/// 机架修正
/// </summary>
...
...
Project.FLY.FlyADBase/Flyad7_WPF/AutoForwBackw.cs
View file @
08549d34
...
...
@@ -35,19 +35,20 @@ namespace Flyad7_WPF
{
FB_Enable
=
false
;
}
if
(!
flyad
.
IsFinish
)
return
;
if
(
flyad
.
IsTimeToPushTimeGridAdv
)
//推送完成
return
;
if
(
flyad
.
DriveStatus
!=
DRIVE_MAN_STATUS
.
RUNNING
)
if
(
Math
.
Abs
(
FB_Pos1
-
flyad
.
Position
)
>
Math
.
Abs
(
FB_Pos2
-
flyad
.
Position
))
{
if
(
Math
.
Abs
(
FB_Pos1
-
flyad
.
Position
)
>
Math
.
Abs
(
FB_Pos2
-
flyad
.
Position
))
{
flyad
.
Runto
(
FB_Pos1
);
}
else
{
flyad
.
Runto
(
FB_Pos2
);
}
flyad
.
Runto
(
FB_Pos1
);
}
else
{
flyad
.
Runto
(
FB_Pos2
);
}
}
void
FB_init
()
{
...
...
@@ -55,12 +56,12 @@ namespace Flyad7_WPF
timer
.
Interval
=
TimeSpan
.
FromSeconds
(
1
);
timer
.
Tick
+=
new
EventHandler
(
timer_Tick
);
FB_Enable
=
false
;
this
.
PropertyChanged
+=
new
PropertyChangedEventHandler
(
MainWindow_PropertyChanged
)
;
this
.
PropertyChanged
+=
AutoForwBackw_PropertyChanged
;
}
void
MainWindo
w_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
private
void
AutoForwBack
w_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"FB_Enable"
)
if
(
e
.
PropertyName
==
nameof
(
FB_Enable
)
)
{
if
(
FB_Enable
)
{
...
...
@@ -72,6 +73,7 @@ namespace Flyad7_WPF
}
}
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
}
Project.FLY.FlyADBase/Flyad7_WPF/DebugAppParam.cs
View file @
08549d34
...
...
@@ -12,36 +12,15 @@ namespace Flyad7_WPF
{
public
class
DebugAppParam
:
INotifyPropertyChanged
{
public
string
EPStr
{
get
;
set
;
}
=
"192.168.251.10:20006"
;
public
bool
HasTimeGrid
{
get
;
set
;
}
public
bool
HasGrid
{
get
;
set
;
}
public
bool
HasGridAdv
{
get
;
set
;
}
public
bool
HasCRC
{
get
;
set
;
}
public
int
FB_Pos1
{
get
;
set
;
}
=
1000
;
public
int
FB_Pos2
{
get
;
set
;
}
=
3000
;
public
UInt32
Velocity
{
get
;
set
;
}
=
3000
;
public
UInt32
SVelocity
{
get
;
set
;
}
=
100
;
public
UInt32
ATime
{
get
;
set
;
}
=
300
;
public
UInt32
DTime
{
get
;
set
;
}
=
300
;
public
UInt32
HVelocity1
{
get
;
set
;
}
=
1000
;
public
UInt32
HVelocity2
{
get
;
set
;
}
=
300
;
public
int
PosLen
{
get
;
set
;
}
=
8900
;
public
int
ADLag
{
get
;
set
;
}
=
0
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
...
...
Project.FLY.FlyADBase/Flyad7_WPF/Flyad7_WPF.csproj
View file @
08549d34
...
...
@@ -89,6 +89,9 @@
<Compile
Include=
"WdGridAdvAnalyze\WdGridAdvAnalyze.xaml.cs"
>
<DependentUpon>
WdGridAdvAnalyze.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"WdSetVelocity.xaml.cs"
>
<DependentUpon>
WdSetVelocity.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"Window1.xaml.cs"
>
<DependentUpon>
Window1.xaml
</DependentUpon>
</Compile>
...
...
@@ -136,6 +139,10 @@
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"WdSetVelocity.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"Window1.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
...
...
Project.FLY.FlyADBase/Flyad7_WPF/MainWindow.xaml
View file @
08549d34
...
...
@@ -27,6 +27,11 @@
<Setter Property="Width" Value="60" />
<Setter Property="Margin" Value="3" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_itemContent">
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="23" />
<Setter Property="Margin" Value="3" />
</Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_itemContent">
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="23" />
...
...
@@ -58,11 +63,22 @@
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button Padding="20,5" Margin="3" Content="连接" Name="button_connect" Click="button_connect1_Click" />
<TextBox Name="textbox_ip" Text="{Binding DataContext.EPStr,ElementName=grid_param}" Width="283" />
<Button Padding="20,5" Margin="3" Name="button_connect" Click="btnConnectClick" >
<Button.Style>
<Style TargetType="Button">
<Setter Property="Content" Value="连接"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=txtIp,Path=IsEnable}" Value="False">
<Setter Property="Content" Value="重连"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<TextBox Name="txtIp" Text="{Binding Addr }" Width="283" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding
DataContext.HasCRC,ElementName=grid_param
}" Content="CRC" VerticalAlignment="Center" Margin="5"/>
<CheckBox IsChecked="{Binding
HasCRC
}" Content="CRC" VerticalAlignment="Center" Margin="5"/>
<TextBlock >
<Run>连接状态:</Run>
<Run Text="{Binding IsConnected, Mode=OneWay}"/>
...
...
@@ -209,32 +225,30 @@
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="速度" />
<TextB
ox Style="{StaticResource TextBox
Style_itemContent}" Text="{Binding Velocity}" />
<TextB
lock Style="{StaticResource TextBlock
Style_itemContent}" Text="{Binding Velocity}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="启动速度" />
<TextB
ox Style="{StaticResource TextBox
Style_itemContent}" Text="{Binding SVelocity}" />
<TextB
lock Style="{StaticResource TextBlock
Style_itemContent}" Text="{Binding SVelocity}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="加速时间" />
<TextB
ox Style="{StaticResource TextBox
Style_itemContent}" Text="{Binding ATime}" />
<TextB
lock Style="{StaticResource TextBlock
Style_itemContent}" Text="{Binding ATime}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="减速时间" />
<TextB
ox Style="{StaticResource TextBox
Style_itemContent}" Text="{Binding DTime}" />
<TextB
lock Style="{StaticResource TextBlock
Style_itemContent}" Text="{Binding DTime}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="归0速度1" />
<TextB
ox Style="{StaticResource TextBox
Style_itemContent}" Text="{Binding HVelocity1}" />
<TextB
lock Style="{StaticResource TextBlock
Style_itemContent}" Text="{Binding HVelocity1}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="归0速度2" />
<TextB
ox Style="{StaticResource TextBox
Style_itemContent}" Text="{Binding HVelocity2}" />
<TextB
lock Style="{StaticResource TextBlock
Style_itemContent}" Text="{Binding HVelocity2}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="设置" Command="{Binding SetVelocityParamCmd}" Style="{StaticResource ButtonStyle}"/>
<Button Content="保存" Click="button_save_velocity_Click" Style="{StaticResource ButtonStyle}"/>
<Button Content="加载" Click="button_load_velocity_Click" Style="{StaticResource ButtonStyle}"/>
<Button Content="设置" Click="btnSetPosParamClick" Style="{StaticResource ButtonStyle}"/>
</StackPanel>
</StackPanel>
...
...
Project.FLY.FlyADBase/Flyad7_WPF/MainWindow.xaml.cs
View file @
08549d34
...
...
@@ -42,7 +42,6 @@ namespace Flyad7_WPF
AutoGetGridAdv
autoGetGridAdv
;
GridAdvVm
gridAdvVm
;
MainWindowVm
viewModel
;
public
MainWindow
()
{
InitializeComponent
();
...
...
@@ -64,7 +63,6 @@ namespace Flyad7_WPF
gridAdvVm
=
Container
.
Resolve
<
GridAdvVm
>();
gridAdvVm
.
Init
(
chart3
);
viewModel
=
new
MainWindowVm
();
this
.
DataContext
=
flyad
;
this
.
grid_viewModel
.
DataContext
=
this
;
...
...
@@ -77,7 +75,6 @@ namespace Flyad7_WPF
flyad
.
GridEvent
+=
flyad_GridEvent
;
flyad
.
TimeGridEvent
+=
flyad_TimeGridEvent
;
groupBox4
.
DataContext
=
viewModel
;
FObjBase
.
PollModule
.
Current
.
Start
();
}
...
...
@@ -460,11 +457,18 @@ namespace Flyad7_WPF
private
void
b
utton_connect1_
Click
(
object
sender
,
RoutedEventArgs
e
)
private
void
b
tnConnect
Click
(
object
sender
,
RoutedEventArgs
e
)
{
flyad
.
Connect
(
param
.
EPStr
);
button_connect
.
IsEnabled
=
false
;
textbox_ip
.
IsEnabled
=
false
;
if
(
txtIp
.
IsEnabled
)
{
flyad
.
Connect
();
txtIp
.
IsEnabled
=
false
;
}
else
{
txtIp
.
IsEnabled
=
true
;
}
}
private
void
button_output_Click
(
object
sender
,
RoutedEventArgs
e
)
...
...
@@ -532,30 +536,6 @@ namespace Flyad7_WPF
}
}
private
void
button_save_velocity_Click
(
object
sender
,
RoutedEventArgs
e
)
{
param
.
Velocity
=
flyad
.
Velocity
;
param
.
SVelocity
=
flyad
.
SVelocity
;
param
.
ATime
=
flyad
.
ATime
;
param
.
DTime
=
flyad
.
DTime
;
param
.
HVelocity1
=
flyad
.
HVelocity1
;
param
.
HVelocity2
=
flyad
.
HVelocity2
;
param
.
PosLen
=
flyad
.
PosLen
;
param
.
ADLag
=
flyad
.
ADLag
;
MessageBox
.
Show
(
"保存成功"
);
}
private
void
button_load_velocity_Click
(
object
sender
,
RoutedEventArgs
e
)
{
param
.
Load
();
flyad
.
SetPosParam
(
param
.
Velocity
,
param
.
SVelocity
,
param
.
ATime
,
param
.
DTime
,
param
.
HVelocity1
,
param
.
HVelocity2
);
flyad
.
PosLen
=
param
.
PosLen
;
flyad
.
ADLag
=
param
.
ADLag
;
MessageBox
.
Show
(
"加载成功"
);
}
private
void
button_setbit_Click
(
object
sender
,
RoutedEventArgs
e
)
{
var
btn
=
sender
as
Button
;
...
...
@@ -641,66 +621,16 @@ namespace Flyad7_WPF
}
}
}
public
class
MainWindowVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
/// <summary>
/// runto 速度 pps
/// </summary>
public
UInt32
Velocity
{
get
;
set
;
}
=
8000
;
/// <summary>
/// 开始速度 pps
/// </summary>
public
UInt32
SVelocity
{
get
;
set
;
}
=
200
;
/// <summary>
/// 加速时间 ms
/// </summary>
public
UInt32
ATime
{
get
;
set
;
}
=
300
;
/// <summary>
/// 减速时间 ms
/// </summary>
public
UInt32
DTime
{
get
;
set
;
}
=
200
;
/// <summary>
/// 归0 第1段速 pps
/// </summary>
public
UInt32
HVelocity1
{
get
;
set
;
}
=
4000
;
/// <summary>
/// 归0 第2段速 pps
/// </summary>
public
UInt32
HVelocity2
{
get
;
set
;
}
=
500
;
public
RelayCommand
SetVelocityParamCmd
{
get
;
private
set
;
}
FlyAD7
flyAD7
;
public
MainWindowVm
()
{
SetVelocityParamCmd
=
new
RelayCommand
(
SetVelocityParam
);
}
public
void
Init
(
FlyAD7
flyAD7
)
{
this
.
flyAD7
=
flyAD7
;
Misc
.
BindingOperations
.
SetBinding
(
this
.
flyAD7
,
nameof
(
this
.
flyAD7
.
Velocity
),
this
,
nameof
(
Velocity
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
flyAD7
,
nameof
(
this
.
flyAD7
.
SVelocity
),
this
,
nameof
(
SVelocity
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
flyAD7
,
nameof
(
this
.
flyAD7
.
ATime
),
this
,
nameof
(
ATime
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
flyAD7
,
nameof
(
this
.
flyAD7
.
DTime
),
this
,
nameof
(
DTime
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
flyAD7
,
nameof
(
this
.
flyAD7
.
HVelocity1
),
this
,
nameof
(
HVelocity1
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
flyAD7
,
nameof
(
this
.
flyAD7
.
HVelocity2
),
this
,
nameof
(
HVelocity2
));
}
private
void
SetVelocityParam
(
)
private
void
btnSetPosParamClick
(
object
sender
,
RoutedEventArgs
e
)
{
flyAD7
.
SetPosParam
(
Velocity
,
SVelocity
,
ATime
,
DTime
,
HVelocity1
,
HVelocity2
);
WdSetVelocity
wd
=
new
WdSetVelocity
();
Container
.
BuildUp
(
wd
);
wd
.
Owner
=
this
;
if
(
wd
.
ShowDialog
()
==
true
)
{
}
}
}
}
Project.FLY.FlyADBase/Flyad7_WPF/UnityExt.cs
View file @
08549d34
...
...
@@ -25,9 +25,8 @@ namespace Flyad7_WPF
Container
.
RegisterFactory
<
FlyAD7
>((
unity
)
=>
{
IFlyADClient
flyAd
=
new
FlyAD7
();
var
param
=
unity
.
Resolve
<
DebugAppParam
>();
Misc
.
BindingOperations
.
SetBinding
(
param
,
"HasCRC"
,
flyAd
,
"HasCRC"
);
FlyAD7
flyAd
=
new
FlyAD7
();
flyAd
.
Load
();
return
flyAd
;
},
new
Unity
.
Lifetime
.
ContainerControlledLifetimeManager
());
...
...
@@ -36,8 +35,8 @@ namespace Flyad7_WPF
var
flyad
=
Container
.
Resolve
<
FlyAD7
>();
AutoForwBackw
autofb
=
new
AutoForwBackw
(
flyad
);
var
param
=
unity
.
Resolve
<
DebugAppParam
>();
Misc
.
BindingOperations
.
SetBinding
(
param
,
"FB_Pos1"
,
autofb
,
"FB_Pos1"
,
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
Misc
.
BindingOperations
.
SetBinding
(
param
,
"FB_Pos2"
,
autofb
,
"FB_Pos2"
,
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
Misc
.
BindingOperations
.
SetBinding
(
param
,
nameof
(
param
.
FB_Pos1
),
autofb
,
nameof
(
autofb
.
FB_Pos1
)
,
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
Misc
.
BindingOperations
.
SetBinding
(
param
,
nameof
(
param
.
FB_Pos2
),
autofb
,
nameof
(
autofb
.
FB_Pos2
)
,
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
return
autofb
;
},
new
Unity
.
Lifetime
.
ContainerControlledLifetimeManager
());
...
...
@@ -55,7 +54,7 @@ namespace Flyad7_WPF
var
flyad
=
Container
.
Resolve
<
FlyAD7
>();
GridAdvVm
gridAdvVm
=
new
GridAdvVm
(
flyad
);
var
param
=
unity
.
Resolve
<
DebugAppParam
>();
Misc
.
BindingOperations
.
SetBinding
(
param
,
"HasGridAdv"
,
gridAdvVm
,
"HasGridAdv"
,
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
Misc
.
BindingOperations
.
SetBinding
(
param
,
nameof
(
param
.
HasGridAdv
),
gridAdvVm
,
nameof
(
gridAdvVm
.
HasGridAdv
)
,
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
return
gridAdvVm
;
},
new
Unity
.
Lifetime
.
ContainerControlledLifetimeManager
());
}
...
...
Project.FLY.FlyADBase/Flyad7_WPF/WdConvolution/WdConvolutionStyle.xaml
View file @
08549d34
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Flyad7_WPF.WdConvolution">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Thickness x:Key="Margin_control">5</Thickness>
<Style TargetType="Button" x:Key="ButtonStyle_normal">
<Setter Property="Height" Value="30"/>
...
...
Project.FLY.FlyADBase/Flyad7_WPF/WdSetVelocity.xaml
0 → 100644
View file @
08549d34
<Window x:Class="Flyad7_WPF.WdSetVelocity"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Flyad7_WPF"
mc:Ignorable="d"
Title="WdSetVelocity" Height="252" Width="204">
<Window.Resources>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_groupTitle">
<Setter Property="FontSize" Value="16" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_itemTitle">
<Setter Property="Width" Value="60" />
<Setter Property="Margin" Value="3" />
</Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_itemContent">
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="23" />
<Setter Property="Margin" Value="3" />
</Style>
<Style TargetType="Button" x:Key="ButtonStyle">
<Setter Property="Height" Value="30"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Padding" Value="20,3"/>
</Style>
</Window.Resources>
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="速度" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding Velocity}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="启动速度" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding SVelocity}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="加速时间" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding ATime}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="减速时间" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding DTime}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="归0速度1" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding HVelocity1}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="归0速度2" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding HVelocity2}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="设置" Command="{Binding ApplyCmd}" Style="{StaticResource ButtonStyle}"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>
Project.FLY.FlyADBase/Flyad7_WPF/WdSetVelocity.xaml.cs
0 → 100644
View file @
08549d34
using
FlyADBase
;
using
GalaSoft.MvvmLight.Command
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Shapes
;
using
Unity
;
namespace
Flyad7_WPF
{
/// <summary>
/// WdSetVelocity.xaml 的交互逻辑
/// </summary>
public
partial
class
WdSetVelocity
:
Window
{
WdSetVelocityVm
viewModel
;
public
WdSetVelocity
()
{
InitializeComponent
();
}
[
InjectionMethod
]
public
void
Init
(
FlyAD7
flyad
)
{
viewModel
=
new
WdSetVelocityVm
();
viewModel
.
Init
(
flyad
);
DataContext
=
this
.
viewModel
;
}
}
public
class
WdSetVelocityVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
/// <summary>
/// runto 速度 pps
/// </summary>
public
UInt32
Velocity
{
get
;
set
;
}
/// <summary>
/// 开始速度 pps
/// </summary>
public
UInt32
SVelocity
{
get
;
set
;
}
/// <summary>
/// 加速时间 ms
/// </summary>
public
UInt32
ATime
{
get
;
set
;
}
/// <summary>
/// 减速时间 ms
/// </summary>
public
UInt32
DTime
{
get
;
set
;
}
/// <summary>
/// 归0 第1段速 pps
/// </summary>
public
UInt32
HVelocity1
{
get
;
set
;
}
/// <summary>
/// 归0 第2段速 pps
/// </summary>
public
UInt32
HVelocity2
{
get
;
set
;
}
public
RelayCommand
ApplyCmd
{
get
;
private
set
;
}
FlyAD7
flyad
;
public
WdSetVelocityVm
()
{
ApplyCmd
=
new
RelayCommand
(
Apply
);
}
public
void
Init
(
FlyAD7
flyad
)
{
this
.
flyad
=
flyad
;
Velocity
=
flyad
.
Velocity
;
SVelocity
=
flyad
.
SVelocity
;
ATime
=
flyad
.
ATime
;
DTime
=
flyad
.
DTime
;
HVelocity1
=
flyad
.
HVelocity1
;
HVelocity2
=
flyad
.
HVelocity2
;
}
private
void
Apply
()
{
if
(!
flyad
.
IsConnected
)
return
;
flyad
.
SetPosParam
(
Velocity
,
SVelocity
,
ATime
,
DTime
,
HVelocity1
,
HVelocity2
);
MessageBox
.
Show
(
"设置完成"
);
}
}
}
Project.FLY.FlyADBase/Flyad7_WPF/Window_sync.xaml
View file @
08549d34
...
...
@@ -34,51 +34,30 @@
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="3">
<StackPanel Orientation="Vertical" Name="textBlock_position2" Margin="4">
<TextBlock HorizontalAlignment="Left" Margin="2" FontSize="16">
<StackPanel Orientation="Vertical" Name="textBlock_position2" Margin="4">
<TextBlock HorizontalAlignment="Left" Margin="2" FontSize="16">
<Run Text="POS1脉冲:" />
<Run Text="{Binding Position, Mode=OneWay}" />
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="2" FontSize="16">
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="2" FontSize="16">
<Run Text="POS2脉冲:" />
<Run Text="{Binding Position2, Mode=OneWay}" />
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="2" FontSize="16">
<Run Text="0-1同步事件:" />
<Run Text="{Binding LastPos2At01, Mode=OneWay}" />
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="设置" Click="button_setPosition2_Click" />
<TextBox Text="{Binding Position2}" x:Name="textbox_position2"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="同步事件 0-1" Click="button_setPos2At01_Click" />
<CheckBox Content="立即" Margin="3" x:Name="checkbox_immediately"/>
</StackPanel>
<WrapPanel Orientation="Horizontal">
<Button Content="清空主轴列表" Click="button_pos2clear_Click" />
</WrapPanel>
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="3">
<Button Content="纵向偏移设置" Click="button_setPos2Shift_Click" />
<TextBox Text="{Binding Pos2Shift}" />
</StackPanel>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button Content="进入同步状态" Click="button_syncBegin_Click" />
<TextBox Text="{Binding Distance}" />
</StackPanel>
<WrapPanel Orientation="Horizontal">
<StackPanel >
<WrapPanel Orientation="Horizontal">
<Button Content="进入同步状态" Click="button_begin2_Click" />
<Button Content="退出同步状态" Click="button_syncEnd_Click" />
<Button Content="清空同步列表" Click="button_clear_Click" />
<Button Content="pos图" Click="button_graph_Click" />
</WrapPanel>
</StackPanel>
<StackPanel
Orientation="Vertical"
Name="textBlock_marker" >
<StackPanel Name="textBlock_marker" >
<TextBlock FontSize="16" Margin="2" >
<Run Text="Marker:" />
<Run Text="{Binding Marker, Mode=OneWay}" />
...
...
Project.FLY.FlyADBase/Flyad7_WPF/Window_sync.xaml.cs
View file @
08549d34
...
...
@@ -91,29 +91,17 @@ namespace Flyad7_WPF
MessageBox
.
Show
(
"flyad.Pos1LCShift = "
+
Pos1LCShift
.
ToString
());
}
private
void
button_setPosition2_Click
(
object
sender
,
RoutedEventArgs
e
)
{
flyad
.
SetPos2
(
Position2
);
MessageBox
.
Show
(
"flyad.Position2 = "
+
Position2
.
ToString
());
}
private
void
button_setPos2Shift_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//TODO
flyad
.
SetPos2Offset
(
Pos2Shift
);
MessageBox
.
Show
(
"flyad.SetPos2Offset( "
+
Pos2Shift
.
ToString
()
+
")"
);
}
private
void
button_setPos2At01_Click
(
object
sender
,
RoutedEventArgs
e
)
{
bool
i
=
(
bool
)
checkbox_immediately
.
IsChecked
;
flyad
.
SetPos2At01
(
Position2
,
i
);
MessageBox
.
Show
(
"flyad.SetPos2At01("
+
Position2
+
")"
);
}
private
void
button_pos2comp_Click
(
object
sender
,
RoutedEventArgs
e
)
{
}
private
void
button_clear_Click
(
object
sender
,
RoutedEventArgs
e
)
{
...
...
@@ -121,24 +109,12 @@ namespace Flyad7_WPF
MessageBox
.
Show
(
"flyad.SyncClear()"
);
}
private
void
button_syncBegin_Click
(
object
sender
,
RoutedEventArgs
e
)
{
flyad
.
SyncBegin
(
Distance
);
MessageBox
.
Show
(
"flyad.SyncBegin("
+
Distance
.
ToString
()+
")"
);
}
private
void
button_syncEnd_Click
(
object
sender
,
RoutedEventArgs
e
)
{
flyad
.
SyncEnd
();
MessageBox
.
Show
(
"flyad.SyncEnd()"
);
}
private
void
button_pos2clear_Click
(
object
sender
,
RoutedEventArgs
e
)
{
flyad
.
SyncPos2Clear
();
MessageBox
.
Show
(
"flyad.SyncPos2Clear()"
);
}
private
void
button_begin2_Click
(
object
sender
,
RoutedEventArgs
e
)
{
flyad
.
SyncBegin
();
...
...
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