添加了摆放高度

闪灯的颜色设置
This commit is contained in:
zxd 2019-03-23 21:46:43 +08:00
parent 4ae451aded
commit e10e19aaf7
5 changed files with 25 additions and 5 deletions

View File

@ -2,7 +2,7 @@
namespace Plane.Copters
{
public partial interface ICopter : ICopterStatus, ICopterEvents, ICopterActions, ICopterCommunication, INotifyPropertyChanged
public partial interface ICopter : ICopterStatus, ICopterEvents, ICopterActions, ICopterCommunication, INotifyPropertyChanged, ICopterAttribute
{
}

View File

@ -21,6 +21,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Copters\Constants.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Copters\CopterCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Copters\CopterState.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Copters\ICopterAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Copters\PLObservableObject.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Copters\FlightCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Copters\GpsFixType.cs" />

View File

@ -31,6 +31,7 @@
<DocumentationFile>bin\Release\PlaneGcsSdk_Private_NET46.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />

View File

@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace Plane.CommunicationManagement
{
@ -267,8 +268,9 @@ namespace Plane.CommunicationManagement
bool temp = false;
//测试用 灯光间隔1S闪烁
public async Task TestLED(short id)
public async Task TestLED(short id, string colorString)
{
MAVLink.mavlink_msg_id_led_control led = new MAVLink.mavlink_msg_id_led_control();
led.target_system = 1;
led.target_component = 1;//(byte)MAVLink.MAV_COMPONENT.MAV_COMP_ID_SYSTEM_CONTROL;;
@ -276,9 +278,14 @@ namespace Plane.CommunicationManagement
led.pattern = 0;
led.custom_len = 4;
led.custom_bytes = new byte[24];
led.custom_bytes[0] = 175;
led.custom_bytes[1] = 30;
led.custom_bytes[2] = 50;
if (colorString == "") colorString = "330033";
Color color = (Color)ColorConverter.ConvertFromString("#" + colorString);
led.custom_bytes[0] = color.R;
led.custom_bytes[1] = color.G;
led.custom_bytes[2] = color.B;
led.custom_bytes[3] = 3;
byte[] data;
data = MavlinkUtil.StructureToByteArray(led);

View File

@ -150,6 +150,8 @@ namespace Plane.Copters
private byte[] _Retain = new byte[4];
private float _GroundAlt = 0;
private CopterState _State;
private string _StatusText;
@ -619,6 +621,15 @@ namespace Plane.Copters
get { return BitConverter.ToSingle(Retain,0); }
}
public float GroundAlt
{
get { return _GroundAlt; }
set {
Set(nameof(GroundAlt), ref _GroundAlt, value);
RaisePropertyChanged(nameof(GroundAlt));
}
}
public byte[] Retain
{