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

GridAdv 调试完成

parent d9662735
......@@ -18,7 +18,7 @@ namespace FlyADBase
/// <summary>
/// 通过脉冲计算速度,不使用AD盒的输出
/// </summary>
public bool IsCalSpeed { get; set; } = true;
public bool IsCalSpeed { get; set; }// = true;
private int gridsmooth = 0;
/// <summary>
......@@ -97,7 +97,7 @@ namespace FlyADBase
Speed = speed;
Speed2 = speed2;
}
}, TimeSpan.FromSeconds(0.5));
}, TimeSpan.FromSeconds(1));
}
private void FlyAD7_PropertyChanged1(object sender, System.ComponentModel.PropertyChangedEventArgs e)
......@@ -440,14 +440,16 @@ namespace FlyADBase
#endregion
}
/// <summary>
/// 转为 grid 数据
/// </summary>
/// <param name="gridAdvUnits"></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
{
......
......@@ -124,12 +124,14 @@ namespace FlyADBase
/// <param name="dat">grid 数据</param>
void GetGrid(DIRECTION direction, out int[] dat);
/// <summary>
/// 转为 grid 数据
/// </summary>
/// <param name="gridAdvUnits"></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>
......
......@@ -11,6 +11,7 @@ namespace Flyad7_WPF
{
public class DebugAppParam : INotifyPropertyChanged
{
public string EPStr { get; set; } = "192.168.251.10:20006";
......@@ -30,12 +31,12 @@ namespace Flyad7_WPF
public int FB_Pos2 { get; set; } = 3000;
public UInt32 Velocity;
public UInt32 SVelocity;
public UInt32 ATime;
public UInt32 DTime;
public UInt32 HVelocity1;
public UInt32 HVelocity2;
public UInt32 Velocity { get; set; }
public UInt32 SVelocity { get; set; }
public UInt32 ATime { get; set; }
public UInt32 DTime { get; set; }
public UInt32 HVelocity1 { get; set; }
public UInt32 HVelocity2 { get; set; }
public int PosLen;
public int ADLag { get; set; }
......@@ -46,52 +47,16 @@ namespace Flyad7_WPF
public void Save()
{
try
{
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 编码失败
}
Misc.SaveToXmlHepler.Save(file_path, this);
}
string file_path = "param.json";
string file_path = "param.xml";
public void Load()
{
try
{
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 解码失败
}
Misc.SaveToXmlHepler.Load(file_path, this);
}
}
public class DebugAppParamJsonDB
{
......
......@@ -173,6 +173,9 @@
<Resource Include="chip_128px_1093586_easyicon.net.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper">
<Version>9.0.0</Version>
</PackageReference>
<PackageReference Include="Costura.Fody">
<Version>3.3.3</Version>
</PackageReference>
......
......@@ -46,7 +46,7 @@
<ColumnDefinition Width="573*" />
</Grid.ColumnDefinitions>
<Grid Name="grid_param"/>
<StackPanel Orientation="Vertical">
<GroupBox Margin="5" Name="groupBox2" >
<GroupBox.Header>
......@@ -89,30 +89,30 @@
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Width="200">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" >
<StackPanel Orientation="Horizontal" Width="200">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" >
<Run Text="位置1" />
<Run Text="{Binding Position}"/>
</TextBlock>
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" Foreground="Red">
</TextBlock>
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" Foreground="Red">
<Run Text="|" />
<Run Text="{Binding Speed}"/>
<Run Text="pps" />
</TextBlock>
</StackPanel>
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Width="200">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" >
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" >
<Run Text="位置2" />
<Run Text="{Binding Position2}"/>
</TextBlock>
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" Foreground="Blue">
</TextBlock>
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Width="auto" Foreground="Blue">
<Run Text="|" />
<Run Text="{Binding Speed2}"/>
<Run Text="pps" />
</TextBlock>
</StackPanel>
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</GroupBox>
......@@ -326,14 +326,19 @@
<TabControl x:Name="tabControl" >
<TabItem Header="TimeGrid">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="141*"/>
<ColumnDefinition Width="524*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</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" />
</StackPanel>
<WindowsFormsHost Grid.Row="1">
<WindowsFormsHost Grid.Row="1" Grid.ColumnSpan="2">
<Chr:Chart x:Name="chart2" />
</WindowsFormsHost>
</Grid>
......@@ -366,10 +371,30 @@
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Name="stackpanel_graph_gridadv">
<CheckBox Content="接收GridAdv" IsChecked="{Binding DataContext.HasGridAdv,ElementName=grid_param}" VerticalAlignment="Center" Margin="3" />
<StackPanel Name="stackpanel_graph_gridadv">
<StackPanel Orientation="Horizontal" >
<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>
<WindowsFormsHost Grid.Row="1">
<Chr:Chart x:Name="chart3" />
</WindowsFormsHost>
......@@ -377,7 +402,7 @@
</TabItem>
</TabControl>
</GroupBox>
</GroupBox>
</Grid>
</Window>
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