From e10e19aaf739a17d5374330bc41c80f6f322e90e Mon Sep 17 00:00:00 2001 From: zxd Date: Sat, 23 Mar 2019 21:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=91=86=E6=94=BE?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=20=E9=97=AA=E7=81=AF=E7=9A=84=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlaneGcsSdk.Contract_Shared/Copters/ICopter.cs | 2 +- .../PlaneGcsSdk.Contract_Shared.projitems | 1 + .../PlaneGcsSdk_Private_NET46.csproj | 1 + .../CommunicationManagement/CommModule.cs | 15 +++++++++++---- .../Copters/CopterImplSharedPart.cs | 11 +++++++++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/PlaneGcsSdk.Contract_Shared/Copters/ICopter.cs b/PlaneGcsSdk.Contract_Shared/Copters/ICopter.cs index e038ccb..d4c4a61 100644 --- a/PlaneGcsSdk.Contract_Shared/Copters/ICopter.cs +++ b/PlaneGcsSdk.Contract_Shared/Copters/ICopter.cs @@ -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 { } diff --git a/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems b/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems index 90ba7c6..f92db2d 100644 --- a/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems +++ b/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems @@ -21,6 +21,7 @@ + diff --git a/PlaneGcsSdk_Private_NET46/PlaneGcsSdk_Private_NET46.csproj b/PlaneGcsSdk_Private_NET46/PlaneGcsSdk_Private_NET46.csproj index 0569a3e..78eddf5 100644 --- a/PlaneGcsSdk_Private_NET46/PlaneGcsSdk_Private_NET46.csproj +++ b/PlaneGcsSdk_Private_NET46/PlaneGcsSdk_Private_NET46.csproj @@ -31,6 +31,7 @@ bin\Release\PlaneGcsSdk_Private_NET46.xml + diff --git a/PlaneGcsSdk_Shared/CommunicationManagement/CommModule.cs b/PlaneGcsSdk_Shared/CommunicationManagement/CommModule.cs index 60bc87f..6928324 100644 --- a/PlaneGcsSdk_Shared/CommunicationManagement/CommModule.cs +++ b/PlaneGcsSdk_Shared/CommunicationManagement/CommModule.cs @@ -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); diff --git a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs index 0c88891..ae5a138 100644 --- a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs +++ b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs @@ -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 {