Commit 78224741 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 FlyAD7 删除Backup_XXX 参数备份寄存器。 刚成功connect时,直接把参数写入到 设备。 参数以电脑为准。

parent 3c15e477
......@@ -332,7 +332,49 @@ namespace FlyADBase
ID,
0xffffffff,
SENSE_CONFIG.ADD);
UpdateParam();
if (IsReadParamFromDev)
{
//读取全部参数!!!!!
//OBJ_SYS_DATA
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.GET_SYSPARAM);
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.GET_ZERO_POS);
//DRIVE_MAN
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_DRIVEPARAM);
}
else {
//参数不保存在设备中, 保存在电脑。
//参数写入到设备。
NotifyPropertyChanged(nameof(MotorType));
NotifyPropertyChanged(nameof(PosOfGrid));
NotifyPropertyChanged(nameof(Ratio01));
NotifyPropertyChanged(nameof(Ratio02));
NotifyPropertyChanged(nameof(PosOffset));
NotifyPropertyChanged(nameof(JogVelocity));
}
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.GET_SYSINFO);
isReadyGetState = false;
isReadyGetPos1AD1 = false;
......@@ -1837,15 +1879,6 @@ namespace FlyADBase
//不需要设置到 AD盒
bShieldSetValueEx = true;
bool ret = FlyAD7JsonDb.Load(jsonDbPath, this);
//还没连到 AD盒前, 有比较正常的 默认值,不需要设置到AD盒
PosOfGrid = Backup_PosOfGrid;
MotorType = Backup_MotorType;
Ratio01 = Backup_Ratio01;
Ratio02 = Backup_Ratio02;
PosOffset = Backup_PosOffset;
JogVelocity = Backup_JogVelocity;
bShieldSetValueEx = false;
......@@ -1930,12 +1963,12 @@ namespace FlyADBase
public bool HasPosMaxMin = false;
//备份参数
public MOTORTYPE Backup_MotorType = MOTORTYPE.SERVO;
public UInt16 Backup_PosOfGrid = 10;
public UInt16 Backup_Ratio01 = 4;
public UInt16 Backup_Ratio02 = 1;
public Int16 Backup_PosOffset = 0;
public UInt32 Backup_JogVelocity = 5000;
public MOTORTYPE MotorType = MOTORTYPE.SERVO;
public UInt16 PosOfGrid = 10;
public UInt16 Ratio01 = 4;
public UInt16 Ratio02 = 1;
public Int16 PosOffset = 0;
public UInt32 JogVelocity = 1000;
/// <summary>
/// 硬件版本
......
......@@ -45,15 +45,11 @@ namespace FlyADBase
/// </summary>
public int PosMax { get; set; } = 8900;
#region 备份参数
public MOTORTYPE Backup_MotorType { get; set; } = MOTORTYPE.SERVO;
public UInt16 Backup_PosOfGrid { get; set; } = 10;
public UInt16 Backup_Ratio01 { get; set; } = 4;
public UInt16 Backup_Ratio02 { get; set; } = 1;
public Int16 Backup_PosOffset { get; set; } = 0;
public UInt32 Backup_JogVelocity { get; set; } = 300;
#endregion
/// <summary>
/// 只要connect成功,获取systick被复位,都会从AD盒设备读取参数;
/// 否则, 设置参数 到 AD盒
/// </summary>
public bool IsReadParamFromDev { get; set; }
public int GridLen => PosLen / PosOfGrid;
/// <summary>
......
......@@ -37,15 +37,11 @@ namespace FlyADBase
/// </summary>
double Speed1Scale { get; }
#region 备份参数
MOTORTYPE Backup_MotorType { get; }
UInt16 Backup_PosOfGrid { get; }
UInt16 Backup_Ratio01 { get; }
UInt16 Backup_Ratio02 { get; }
Int16 Backup_PosOffset { get; }
UInt32 Backup_JogVelocity { get; }
#endregion
/// <summary>
/// 只要connect成功,获取systick被复位,都会从AD盒设备读取参数;
/// 否则, 设置参数 到 AD盒
/// </summary>
bool IsReadParamFromDev { get; set; }
/// <summary>
/// 机架总长
......
......@@ -63,9 +63,6 @@
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="脉冲/数据格" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PosOfGrid}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Error}"
Visibility="{Binding IsPosOfGridModified, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}"
Text="{Binding Backup_PosOfGrid}"/>
</StackPanel>
</StackPanel>
......@@ -76,20 +73,17 @@
<StackPanel Margin="{StaticResource ControlMargin}">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="电机类型" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Error}"
Visibility="{Binding IsMotorTypeModified, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}"
Text="{Binding Backup_MotorType}"/>
</StackPanel>
<ComboBox Width="191" HorizontalAlignment="Left" MinHeight="40">
<ComboBox Width="120" HorizontalAlignment="Left" MinHeight="{StaticResource FontSize.FieldContent}">
<ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.SERVO}}">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" FontSize="32" Text="伺服"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" FontSize="{StaticResource FontSize.FieldContent.Middle}" Text="伺服"/>
</ComboBoxItem>
<ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.VF0}}" >
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" FontSize="32" Text="变频器"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" FontSize="{StaticResource FontSize.FieldContent.Middle}" Text="变频器"/>
</ComboBoxItem>
<ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.NULL}}" >
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" FontSize="32" Text="无"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" FontSize="{StaticResource FontSize.FieldContent.Middle}" Text="无"/>
</ComboBoxItem>
</ComboBox>
</StackPanel>
......@@ -97,9 +91,6 @@
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="电机脉冲" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Ratio01}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Error}"
Visibility="{Binding IsRatio01Modified, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}"
Text="{Binding Backup_Ratio01}"/>
</StackPanel>
</StackPanel>
......@@ -107,9 +98,6 @@
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="编码脉冲" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Ratio02}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Error}"
Visibility="{Binding IsRatio02Modified, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}"
Text="{Binding Backup_Ratio02}"/>
</StackPanel>
</StackPanel>
......@@ -117,10 +105,6 @@
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="原点脉冲" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PosOffset}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Error}"
Visibility="{Binding IsPosOffsetModified, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}"
Text="{Binding Backup_PosOffset}"/>
</StackPanel>
</StackPanel>
......@@ -149,9 +133,6 @@
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="手动速度" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding JogVelocity}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Error}"
Visibility="{Binding IsJogVelocityModified, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}"
Text="{Binding Backup_JogVelocity}"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
......
......@@ -55,24 +55,6 @@ namespace FLY.Thick.Base.UI
public int PosMax { get; set; }
#endregion
#region 备份参数
public MOTORTYPE Backup_MotorType { get; set; } = MOTORTYPE.SERVO;
public UInt16 Backup_PosOfGrid { get; set; } = 10;
public UInt16 Backup_Ratio01 { get; set; } = 4;
public UInt16 Backup_Ratio02 { get; set; } = 1;
public Int16 Backup_PosOffset { get; set; } = 0;
public UInt32 Backup_JogVelocity { get; set; } = 300;
#endregion
#region 备份参数
public bool IsMotorTypeModified => MotorType != Backup_MotorType;
public bool IsPosOfGridModified => PosOfGrid != Backup_PosOfGrid;
public bool IsRatio01Modified => Ratio01 != Backup_Ratio01;
public bool IsRatio02Modified => Ratio02 != Backup_Ratio02;
public bool IsPosOffsetModified => PosOffset != Backup_PosOffset;
public bool IsJogVelocityModified => JogVelocity != Backup_JogVelocity;
#endregion
public int Version { get; set; }
public int HardwareVersion { get; set; }
......@@ -168,13 +150,6 @@ namespace FLY.Thick.Base.UI
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.PosMin), this, nameof(PosMin));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.PosMax), this, nameof(PosMax));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Backup_MotorType), this, nameof(Backup_MotorType));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Backup_PosOfGrid), this, nameof(Backup_PosOfGrid));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Backup_Ratio01), this, nameof(Backup_Ratio01));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Backup_Ratio02), this, nameof(Backup_Ratio02));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Backup_PosOffset), this, nameof(Backup_PosOffset));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Backup_JogVelocity), this, nameof(Backup_JogVelocity));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.Verson), this, nameof(Version));
Misc.BindingOperations.SetBinding(this.flyAdService, nameof(this.flyAdService.HardwareVersion), this, nameof(HardwareVersion));
......@@ -216,14 +191,6 @@ namespace FLY.Thick.Base.UI
flyAdService.PosMin = this.PosMin;
flyAdService.PosMax = this.PosMax;
flyAdService.Backup_MotorType = this.MotorType;
flyAdService.Backup_PosOfGrid = this.PosOfGrid;
flyAdService.Backup_Ratio01 = this.Ratio01;
flyAdService.Backup_Ratio02 = this.Ratio02;
flyAdService.Backup_PosOffset = this.PosOffset;
flyAdService.Backup_JogVelocity = this.JogVelocity;
flyAdService.HardwareVersion = HardwareVersion;
FLY.ControlLibrary.Window_Tip.Show("应用成功",
......
......@@ -56,15 +56,6 @@ namespace FLY.Thick.Base.Client
public int PosMin { get; set; }
public int PosMax { get; set; }
#region 备份参数
public MOTORTYPE Backup_MotorType { get; set; }
public UInt16 Backup_PosOfGrid { get; set; }
public UInt16 Backup_Ratio01 { get; set; }
public UInt16 Backup_Ratio02 { get; set; }
public Int16 Backup_PosOffset { get; set; }
public UInt32 Backup_JogVelocity { get; set; }
#endregion
public int Verson { get; set; }
public int HardwareVersion { get; set; }
......@@ -111,14 +102,6 @@ namespace FLY.Thick.Base.Client
Call(nameof(GetGrid), new { direction }, asyncDelegate, asyncContext);
}
/// <summary>
/// 向AD盒获取数据
/// </summary>
public void UpdateParam()
{
Call(nameof(UpdateParam));
}
#endregion
}
}
\ No newline at end of file
......@@ -158,11 +158,6 @@
<Version>3.3.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\.editorconfig">
<Link>.editorconfig</Link>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="OBJ_INTERFACE\" />
<Folder Include="Server.OBJProxy\" />
......
......@@ -31,15 +31,6 @@ namespace FLY.Thick.Base.IService
int PosMin { get; set; }
int PosMax { get; set; }
#region 备份参数
MOTORTYPE Backup_MotorType { get; set; }
UInt16 Backup_PosOfGrid { get; set; }
UInt16 Backup_Ratio01 { get; set; }
UInt16 Backup_Ratio02 { get; set; }
Int16 Backup_PosOffset { get; set; }
UInt32 Backup_JogVelocity { get; set; }
#endregion
int Verson { get; }
int HardwareVersion { get; set; }
/// <summary>
......@@ -68,11 +59,5 @@ namespace FLY.Thick.Base.IService
/// <param name="asyncContext"></param>
[Call(typeof(GridInfo))]
void GetGrid(Misc.DIRECTION direction, AsyncCBHandler asyncDelegate, object asyncContext);
/// <summary>
/// 向AD盒获取数据
/// </summary>
void UpdateParam();
}
}
......@@ -174,55 +174,6 @@ namespace FLY.Thick.Base.Server
}
}
public MOTORTYPE Backup_MotorType
{
get { return (MOTORTYPE)flyad.Backup_MotorType; }
set
{
flyad.Backup_MotorType = (FlyADBase.MOTORTYPE)value;
}
}
public UInt16 Backup_PosOfGrid
{
get { return flyad.Backup_PosOfGrid; }
set
{
flyad.Backup_PosOfGrid = value;
}
}
public UInt16 Backup_Ratio01
{
get { return flyad.Backup_Ratio01; }
set
{
flyad.Backup_Ratio01 = value;
}
}
public UInt16 Backup_Ratio02
{
get { return flyad.Backup_Ratio02; }
set
{
flyad.Backup_Ratio02 = value;
}
}
public Int16 Backup_PosOffset
{
get { return flyad.Backup_PosOffset; }
set
{
flyad.Backup_PosOffset = value;
}
}
public UInt32 Backup_JogVelocity
{
get { return flyad.Backup_JogVelocity; }
set
{
flyad.Backup_JogVelocity = value;
}
}
public int Verson
{
get { return flyad.Version; }
......@@ -253,8 +204,6 @@ namespace FLY.Thick.Base.Server
if (type.GetProperty(e.PropertyName) != null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(e.PropertyName));
}
//if(e.PropertyName )
}
/// <summary>
......@@ -357,13 +306,5 @@ namespace FLY.Thick.Base.Server
};
asyncDelegate(asyncContext, p);
}
/// <summary>
/// 向AD盒获取数据
/// </summary>
public void UpdateParam()
{
flyad.UpdateParam();
}
}
}
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