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

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

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