Commit 248af6bc authored by 潘栩锋's avatar 潘栩锋 🚴

GridAdv 调试完成

parent d9662735
...@@ -18,7 +18,7 @@ namespace FlyADBase ...@@ -18,7 +18,7 @@ namespace FlyADBase
/// <summary> /// <summary>
/// 通过脉冲计算速度,不使用AD盒的输出 /// 通过脉冲计算速度,不使用AD盒的输出
/// </summary> /// </summary>
public bool IsCalSpeed { get; set; } = true; public bool IsCalSpeed { get; set; }// = true;
private int gridsmooth = 0; private int gridsmooth = 0;
/// <summary> /// <summary>
...@@ -97,7 +97,7 @@ namespace FlyADBase ...@@ -97,7 +97,7 @@ namespace FlyADBase
Speed = speed; Speed = speed;
Speed2 = speed2; Speed2 = speed2;
} }
}, TimeSpan.FromSeconds(0.5)); }, TimeSpan.FromSeconds(1));
} }
private void FlyAD7_PropertyChanged1(object sender, System.ComponentModel.PropertyChangedEventArgs e) private void FlyAD7_PropertyChanged1(object sender, System.ComponentModel.PropertyChangedEventArgs e)
...@@ -440,14 +440,16 @@ namespace FlyADBase ...@@ -440,14 +440,16 @@ namespace FlyADBase
#endregion #endregion
} }
/// <summary> /// <summary>
/// 转为 grid 数据 /// 转为 grid 数据
/// </summary> /// </summary>
/// <param name="gridAdvUnits"></param> /// <param name="gridAdvUnits"></param>
/// <param name="dat"></param> /// <param name="dat"></param>
public void ToGrid(IEnumerable<GridAdvUnit> gridAdvUnits, out int[] dat) /// <param name="adLag">测试功能,让ad值滞后</param>
public void ToGrid(IEnumerable<GridAdvUnit> gridAdvUnits, out int[] dat, int adLag=0)
{ {
dat = mTimeGridAdvHelper.ToGrid(gridAdvUnits, PosOfGrid, SGrid.GRID_MAX_SIZE); dat = mTimeGridAdvHelper.ToGrid(gridAdvUnits, PosOfGrid, SGrid.GRID_MAX_SIZE, adLag);
} }
class PushGridInfo class PushGridInfo
{ {
......
...@@ -124,12 +124,14 @@ namespace FlyADBase ...@@ -124,12 +124,14 @@ namespace FlyADBase
/// <param name="dat">grid 数据</param> /// <param name="dat">grid 数据</param>
void GetGrid(DIRECTION direction, out int[] dat); void GetGrid(DIRECTION direction, out int[] dat);
/// <summary> /// <summary>
/// 转为 grid 数据 /// 转为 grid 数据
/// </summary> /// </summary>
/// <param name="gridAdvUnits"></param> /// <param name="gridAdvUnits"></param>
/// <param name="dat"></param> /// <param name="dat"></param>
void ToGrid(IEnumerable<GridAdvUnit> gridAdvUnits, out int[] dat); /// <param name="adLag">测试功能 ad值滞后</param>
void ToGrid(IEnumerable<GridAdvUnit> gridAdvUnits, out int[] dat,int adLag);
/// <summary> /// <summary>
/// 动作完成 /// 动作完成
/// </summary> /// </summary>
......
...@@ -12,6 +12,7 @@ namespace Flyad7_WPF ...@@ -12,6 +12,7 @@ namespace Flyad7_WPF
public class DebugAppParam : INotifyPropertyChanged public class DebugAppParam : INotifyPropertyChanged
{ {
public string EPStr { get; set; } = "192.168.251.10:20006"; public string EPStr { get; set; } = "192.168.251.10:20006";
public bool HasTimeGrid { get; set; } public bool HasTimeGrid { get; set; }
...@@ -30,12 +31,12 @@ namespace Flyad7_WPF ...@@ -30,12 +31,12 @@ namespace Flyad7_WPF
public int FB_Pos2 { get; set; } = 3000; public int FB_Pos2 { get; set; } = 3000;
public UInt32 Velocity; public UInt32 Velocity { get; set; }
public UInt32 SVelocity; public UInt32 SVelocity { get; set; }
public UInt32 ATime; public UInt32 ATime { get; set; }
public UInt32 DTime; public UInt32 DTime { get; set; }
public UInt32 HVelocity1; public UInt32 HVelocity1 { get; set; }
public UInt32 HVelocity2; public UInt32 HVelocity2 { get; set; }
public int PosLen; public int PosLen;
public int ADLag { get; set; } public int ADLag { get; set; }
...@@ -46,52 +47,16 @@ namespace Flyad7_WPF ...@@ -46,52 +47,16 @@ namespace Flyad7_WPF
public void Save() public void Save()
{ {
try Misc.SaveToXmlHepler.Save(file_path, this);
{
DebugAppParamJsonDB param = new DebugAppParamJsonDB()
{
EPStr = EPStr,
HasTimeGrid = HasTimeGrid,
HasGrid = HasGrid,
HasGridAdv = HasGridAdv,
HasCRC = HasCRC,
FB_Pos1 = FB_Pos1,
FB_Pos2 = FB_Pos2
};
File.WriteAllText(file_path, JsonConvert.SerializeObject(param, Formatting.Indented));
}
catch
{
//异常,没有json 编码失败
}
} }
string file_path = "param.json"; string file_path = "param.xml";
public void Load() public void Load()
{ {
try Misc.SaveToXmlHepler.Load(file_path, this);
{
if (File.Exists(file_path))
{
string json = File.ReadAllText(file_path);
var param = JsonConvert.DeserializeObject<DebugAppParamJsonDB>(json);
EPStr = param.EPStr;
HasTimeGrid = param.HasTimeGrid;
HasGrid = param.HasGrid;
HasGridAdv = param.HasGridAdv;
HasCRC = param.HasCRC;
FB_Pos1 = param.FB_Pos1;
FB_Pos2 = param.FB_Pos2;
}
}
catch
{
//异常,没有json 解码失败
}
} }
} }
public class DebugAppParamJsonDB public class DebugAppParamJsonDB
{ {
......
...@@ -173,6 +173,9 @@ ...@@ -173,6 +173,9 @@
<Resource Include="chip_128px_1093586_easyicon.net.ico" /> <Resource Include="chip_128px_1093586_easyicon.net.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper">
<Version>9.0.0</Version>
</PackageReference>
<PackageReference Include="Costura.Fody"> <PackageReference Include="Costura.Fody">
<Version>3.3.3</Version> <Version>3.3.3</Version>
</PackageReference> </PackageReference>
......
...@@ -326,14 +326,19 @@ ...@@ -326,14 +326,19 @@
<TabControl x:Name="tabControl" > <TabControl x:Name="tabControl" >
<TabItem Header="TimeGrid"> <TabItem Header="TimeGrid">
<Grid> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="141*"/>
<ColumnDefinition Width="524*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Name="stackpanel_graph"> <StackPanel Orientation="Horizontal" Name="stackpanel_graph" Grid.ColumnSpan="2">
<CheckBox Content="接收TimeGrid" IsChecked="{Binding DataContext.HasTimeGrid,ElementName=grid_param}" VerticalAlignment="Center" Margin="3" /> <CheckBox Content="接收TimeGrid" IsChecked="{Binding DataContext.HasTimeGrid,ElementName=grid_param}" VerticalAlignment="Center" Margin="3" />
</StackPanel> </StackPanel>
<WindowsFormsHost Grid.Row="1"> <WindowsFormsHost Grid.Row="1" Grid.ColumnSpan="2">
<Chr:Chart x:Name="chart2" /> <Chr:Chart x:Name="chart2" />
</WindowsFormsHost> </WindowsFormsHost>
</Grid> </Grid>
...@@ -366,10 +371,30 @@ ...@@ -366,10 +371,30 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Name="stackpanel_graph_gridadv">
<StackPanel Orientation="Horizontal" Name="stackpanel_graph_gridadv"> <StackPanel Orientation="Horizontal" >
<CheckBox Content="接收GridAdv" IsChecked="{Binding DataContext.HasGridAdv,ElementName=grid_param}" VerticalAlignment="Center" Margin="3" /> <CheckBox Content="接收GridAdv" IsChecked="{Binding DataContext.HasGridAdv,ElementName=grid_param}" VerticalAlignment="Center" Margin="3" />
<Button Padding="20,5" Margin="3" Content="保存GridAdv" Click="btnSaveGridAdvClick" />
<Button Padding="20,5" Margin="3" Content="读取GridAdv" Click="btnLoadGridAdvClick" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Padding="20,5" Margin="3" Content="计算滞后" Click="btnCalAdLagClick" />
<TextBlock Margin="10,0">
当前相关性=<Run Text="{Binding CurrR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock>
<StackPanel>
<TextBlock Margin="10,0">
计算进度 AdLag=<Run Text="{Binding ProgressOfAdLag, Mode=OneWay}"/> | R=<Run Text="{Binding ProgressOfR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock>
<TextBlock Margin="10,0">
结果 AdLag=<Run Text="{Binding BestAdLag, Mode=OneWay}"/> | R=<Run Text="{Binding BestR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock>
</StackPanel> </StackPanel>
</StackPanel>
</StackPanel>
<WindowsFormsHost Grid.Row="1"> <WindowsFormsHost Grid.Row="1">
<Chr:Chart x:Name="chart3" /> <Chr:Chart x:Name="chart3" />
</WindowsFormsHost> </WindowsFormsHost>
......
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