灯光频率改为间隔
可以选择颜色
This commit is contained in:
parent
e1c81f28ff
commit
62a7b8b028
@ -123,7 +123,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
{
|
{
|
||||||
Thread.Sleep((int)vLEDInfo.Delay * 1000);
|
Thread.Sleep((int)vLEDInfo.Delay * 1000);
|
||||||
if (!LEDTestRun) break;
|
if (!LEDTestRun) break;
|
||||||
_commModuleManager.LED_TaskAsync(vLEDInfo.LEDMode, vLEDInfo.LEDRate, vLEDInfo.LEDTimes, vLEDInfo.LEDRGB, this.Copter);
|
_commModuleManager.LED_TaskAsync(vLEDInfo.LEDMode, vLEDInfo.LEDInterval, vLEDInfo.LEDTimes, vLEDInfo.LEDRGB, this.Copter);
|
||||||
}
|
}
|
||||||
//LEDTestRun = false;
|
//LEDTestRun = false;
|
||||||
});
|
});
|
||||||
@ -170,7 +170,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
{
|
{
|
||||||
private double delay = 1; //灯光延时 单位:100ms (从当前任务开为0,延时几秒后设置LED)
|
private double delay = 1; //灯光延时 单位:100ms (从当前任务开为0,延时几秒后设置LED)
|
||||||
private int ledmode = 0; //灯光模式 0常亮 1闪烁 2随机闪烁(RGB无意义)
|
private int ledmode = 0; //灯光模式 0常亮 1闪烁 2随机闪烁(RGB无意义)
|
||||||
private float ledRate = 0; //闪烁延时 单位:100ms
|
private float ledInterval = 0; //闪烁延时 单位:秒
|
||||||
private int ledtimes = 0; //次数 (预留、暂取消其意义)
|
private int ledtimes = 0; //次数 (预留、暂取消其意义)
|
||||||
private string ledRGB = "FFFFFF"; //灯光颜色
|
private string ledRGB = "FFFFFF"; //灯光颜色
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
{
|
{
|
||||||
delay = led.delay;
|
delay = led.delay;
|
||||||
ledmode = led.ledmode;
|
ledmode = led.ledmode;
|
||||||
ledRate = led.ledRate;
|
ledInterval = led.ledInterval;
|
||||||
ledRGB = led.ledRGB;
|
ledRGB = led.ledRGB;
|
||||||
}
|
}
|
||||||
public double Delay
|
public double Delay
|
||||||
@ -197,10 +197,10 @@ namespace Plane.FormationCreator.Formation
|
|||||||
get { return ledmode; }
|
get { return ledmode; }
|
||||||
set { ledmode = value; }
|
set { ledmode = value; }
|
||||||
}
|
}
|
||||||
public float LEDRate
|
public float LEDInterval
|
||||||
{
|
{
|
||||||
get { return ledRate; }
|
get { return ledInterval; }
|
||||||
set { ledRate = value; }
|
set { ledInterval = value; }
|
||||||
}
|
}
|
||||||
public int LEDTimes
|
public int LEDTimes
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
IMission LEDMission = Mission.CreateLEDControlMission(
|
IMission LEDMission = Mission.CreateLEDControlMission(
|
||||||
(int)(ledInfo.Delay * 10),
|
(int)(ledInfo.Delay * 10),
|
||||||
ledInfo.LEDMode,
|
ledInfo.LEDMode,
|
||||||
ledInfo.LEDRate,
|
ledInfo.LEDInterval,
|
||||||
0, //ledInfo.LEDTimes,
|
0, //ledInfo.LEDTimes,
|
||||||
color.R,
|
color.R,
|
||||||
color.G,
|
color.G,
|
||||||
|
@ -1518,7 +1518,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
IMission LEDMission = Mission.CreateLEDControlMission(
|
IMission LEDMission = Mission.CreateLEDControlMission(
|
||||||
(int)(ledInfo.Delay * 10),
|
(int)(ledInfo.Delay * 10),
|
||||||
ledMode,
|
ledMode,
|
||||||
ledInfo.LEDRate,
|
ledInfo.LEDInterval,
|
||||||
0, //ledInfo.LEDTimes,
|
0, //ledInfo.LEDTimes,
|
||||||
color.R,
|
color.R,
|
||||||
color.G,
|
color.G,
|
||||||
|
@ -308,7 +308,8 @@
|
|||||||
<StackPanel x:Name="lightDesign">
|
<StackPanel x:Name="lightDesign">
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
|
<StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
|
||||||
<TextBlock Margin="5,7,0,0" Text="变换颜色"/>
|
<TextBlock Margin="5,7,0,0" Text="变换颜色"/>
|
||||||
<TextBox Margin="5,5,40,3" Width="60" Text="{Binding ChangeRGB}"/>
|
<TextBox Margin="5,5,40,3" Width="60" Text="{Binding ChangeRGB}"
|
||||||
|
MouseDoubleClick="TextBox_MouseDoubleClick"/>
|
||||||
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
|
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
|
||||||
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding BeginTime}"/>
|
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding BeginTime}"/>
|
||||||
<TextBlock Margin="5,7,0,0" Text="结束时间"/>
|
<TextBlock Margin="5,7,0,0" Text="结束时间"/>
|
||||||
@ -322,7 +323,8 @@
|
|||||||
<Grid >
|
<Grid >
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
|
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
|
||||||
<TextBlock Margin="5,7,0,0" Text="结束颜色"/>
|
<TextBlock Margin="5,7,0,0" Text="结束颜色"/>
|
||||||
<TextBox Margin="5,5,40,3" Width="60" Text="{Binding EndRGB}" ToolTip="设置为0,表示变换后回到原色"/>
|
<TextBox Margin="5,5,40,3" Width="60" Text="{Binding EndRGB}" ToolTip="设置为0,表示变换后回到原色"
|
||||||
|
MouseDoubleClick="TextBox_MouseDoubleClick"/>
|
||||||
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
|
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
|
||||||
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding StrokesTime}"/>
|
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding StrokesTime}"/>
|
||||||
<TextBlock Margin="5,7,0,0" Text="频率"/>
|
<TextBlock Margin="5,7,0,0" Text="频率"/>
|
||||||
@ -340,9 +342,11 @@
|
|||||||
<TextBlock Margin="5,7,0,0" Text="时间"/>
|
<TextBlock Margin="5,7,0,0" Text="时间"/>
|
||||||
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding GradientRampTime}"/>
|
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding GradientRampTime}"/>
|
||||||
<TextBlock Margin="5,7,0,0" Text="起始色"/>
|
<TextBlock Margin="5,7,0,0" Text="起始色"/>
|
||||||
<TextBox Margin="5,5,0,3" Width="60" Text="{Binding LeftRGB}"/>
|
<TextBox Margin="5,5,0,3" Width="60" Text="{Binding LeftRGB}"
|
||||||
|
MouseDoubleClick="TextBox_MouseDoubleClick"/>
|
||||||
<TextBlock Margin="5,7,0,0" Text="结束色"/>
|
<TextBlock Margin="5,7,0,0" Text="结束色"/>
|
||||||
<TextBox Margin="5,5,0,3" Width="60" Text="{Binding RightRGB}"/>
|
<TextBox Margin="5,5,0,3" Width="60" Text="{Binding RightRGB}"
|
||||||
|
MouseDoubleClick="TextBox_MouseDoubleClick"/>
|
||||||
<Button Margin="10,5,0,3" Width="120" Content="设置渐变灯"
|
<Button Margin="10,5,0,3" Width="120" Content="设置渐变灯"
|
||||||
Command="{Binding SetGradientRampCommand}" />
|
Command="{Binding SetGradientRampCommand}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@ -413,7 +417,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" >
|
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" >
|
||||||
<TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock>
|
<TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock>
|
||||||
<ComboBox MinWidth="125" Width="125" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
|
<ComboBox MinWidth="125" Width="110" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
|
||||||
SelectedIndex="{Binding Path=LEDMode}">
|
SelectedIndex="{Binding Path=LEDMode}">
|
||||||
<ComboBox.ItemContainerStyle>
|
<ComboBox.ItemContainerStyle>
|
||||||
<Style>
|
<Style>
|
||||||
@ -428,6 +432,11 @@
|
|||||||
<ComboBoxItem Content="呼吸灯" />
|
<ComboBoxItem Content="呼吸灯" />
|
||||||
<ComboBoxItem Content="同步闪烁(随机)" />
|
<ComboBoxItem Content="同步闪烁(随机)" />
|
||||||
<ComboBoxItem Content="异步闪烁(单色)" />
|
<ComboBoxItem Content="异步闪烁(单色)" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ComboBoxItem Content="拉烟"/>
|
<ComboBoxItem Content="拉烟"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
@ -436,13 +445,16 @@
|
|||||||
ToolTip="单位:秒,最小设置0.1秒"
|
ToolTip="单位:秒,最小设置0.1秒"
|
||||||
Text="{Binding Delay,UpdateSourceTrigger=PropertyChanged}" />
|
Text="{Binding Delay,UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
|
||||||
<TextBlock Text="频率" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
<TextBlock Text="间隔" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
||||||
<TextBox MinWidth="40" MaxWidth="45" Margin="5,0,0,0"
|
<TextBox MinWidth="35" MaxWidth="40" Margin="5,0,0,0"
|
||||||
Text="{Binding Path=LEDRate, UpdateSourceTrigger=PropertyChanged}" />
|
ToolTip="单位:秒,最小设置0.1秒"
|
||||||
|
Text="{Binding Path=LEDInterval, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
|
||||||
<TextBlock Text="颜色" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
<TextBlock Text="颜色" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
||||||
<TextBox Margin="5,0,0,0" MinWidth="50" Width="50"
|
<TextBox Margin="5,0,0,0" MinWidth="50" Width="50"
|
||||||
Text="{Binding LEDRGB, UpdateSourceTrigger=PropertyChanged}" />
|
Text="{Binding LEDRGB, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
MouseDoubleClick="TextBox_MouseDoubleClick"
|
||||||
|
/>
|
||||||
|
|
||||||
<Button Content="删除" Margin="12,0,0,0"
|
<Button Content="删除" Margin="12,0,0,0"
|
||||||
Command="{Binding RemoveLEDCommand}"/>
|
Command="{Binding RemoveLEDCommand}"/>
|
||||||
|
@ -17,14 +17,17 @@ using System.Windows.Navigation;
|
|||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Plane.Geography;
|
using Plane.Geography;
|
||||||
using Plane.FormationCreator.Util;
|
using Plane.FormationCreator.Util;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Plane.FormationCreator.Views
|
namespace Plane.FormationCreator.Views
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for ModifyTaskView.xaml
|
/// Interaction logic for ModifyTaskView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public partial class ModifyTaskView : UserControl
|
public partial class ModifyTaskView : UserControl
|
||||||
{
|
{
|
||||||
|
private int[] defcolor= { 255, 65280, 16711680, 65535 , 16711935, 16776960,0 };
|
||||||
ModifyTaskViewModel _modifyTaskViewModel = ServiceLocator.Current.GetInstance<ModifyTaskViewModel>();
|
ModifyTaskViewModel _modifyTaskViewModel = ServiceLocator.Current.GetInstance<ModifyTaskViewModel>();
|
||||||
public ModifyTaskView()
|
public ModifyTaskView()
|
||||||
{
|
{
|
||||||
@ -60,7 +63,28 @@ namespace Plane.FormationCreator.Views
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
|
||||||
|
colorDialog.CustomColors = defcolor;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
colorDialog.Color = ColorTranslator.FromHtml("#" + (sender as TextBox).Text);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
colorDialog.Color = System.Drawing.Color.White;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
defcolor = colorDialog.CustomColors;
|
||||||
|
(sender as TextBox).Text = String.Format("{0:X2}", colorDialog.Color.R) +
|
||||||
|
String.Format("{0:X2}", colorDialog.Color.G) +
|
||||||
|
String.Format("{0:X2}", colorDialog.Color.B);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user