自动按照位置排序虚拟ID
This commit is contained in:
parent
ce73335fd9
commit
c254013048
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Plane.Copters
|
||||
{
|
||||
public partial interface ICopter : ICopterStatus, ICopterEvents, ICopterActions, ICopterCommunication, INotifyPropertyChanged, ICopterAttribute
|
||||
public partial interface ICopter : ICopterStatus, ICopterEvents, ICopterVirtualId, ICopterActions, ICopterCommunication, INotifyPropertyChanged, ICopterAttribute
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,6 @@ namespace Plane.Copters
|
||||
/// <summary>
|
||||
/// 获取名称。
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\CopterCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\CopterState.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\ICopterAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\ICopterVirtualId.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\PLObservableObject.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\FlightCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Copters\GpsFixType.cs" />
|
||||
|
@ -413,6 +413,23 @@ namespace Plane.CommunicationManagement
|
||||
/// <returns></returns>
|
||||
public async Task WriteCommPacketAsync(short copterId, short messageType, byte[] data = null, byte[] batchPacket = null)
|
||||
{
|
||||
if (messageType == MavComm.COMM_DOWNLOAD_COMM && copterId == 0)
|
||||
{
|
||||
short byteNum;
|
||||
short length;
|
||||
if (batchPacket == null)
|
||||
{
|
||||
byteNum = 0;
|
||||
length = (short)((0x5 << 12) ^ byteNum);
|
||||
batchPacket = BitConverter.GetBytes(length);
|
||||
}
|
||||
else
|
||||
{
|
||||
byteNum = (short)(batchPacket.Length / 2);
|
||||
length = (short)((0x5 << 12) ^ byteNum);
|
||||
batchPacket = BitConverter.GetBytes(length).Concat(batchPacket).ToArray();
|
||||
}
|
||||
}
|
||||
if (data != null && batchPacket != null) data = batchPacket.Concat(data).ToArray();
|
||||
|
||||
int packetlength = data == null ? 0 : data.Length;
|
||||
@ -466,11 +483,13 @@ namespace Plane.CommunicationManagement
|
||||
{
|
||||
int dataLength = 6 + 2 + indata.Length * 32;
|
||||
byte[] data = new byte[dataLength];
|
||||
Int16 countNum = (Int16)indata.Length;
|
||||
|
||||
byte[] uses = new byte[] { 0, 1, 0, 0, 0, 0 };
|
||||
|
||||
byte[] uses = new byte[] { 0, 0, 1, 0, 0, 0 };
|
||||
Array.Copy(uses, 0, data, 0, 6);
|
||||
|
||||
Int16 countNum = (Int16)indata.Length;
|
||||
Array.Copy(BitConverter.GetBytes(countNum), 0, data, 2, 2);
|
||||
Array.Copy(BitConverter.GetBytes(countNum), 0, data, 6, 2);
|
||||
|
||||
int offset = 8;
|
||||
|
@ -169,6 +169,11 @@ namespace Plane.Copters
|
||||
|
||||
private double _RecordLng;
|
||||
|
||||
|
||||
private int _VirtualId;
|
||||
|
||||
private bool _DisplayVirtualId = false;
|
||||
|
||||
#endregion Backing Fields
|
||||
|
||||
public CopterImplSharedPart(SynchronizationContext uiSyncContext) : base(uiSyncContext)
|
||||
@ -394,6 +399,20 @@ namespace Plane.Copters
|
||||
protected set { Set(nameof(Elevation), ref _Elevation, value); }
|
||||
}
|
||||
|
||||
public int VirtualId
|
||||
{
|
||||
get { return _VirtualId; }
|
||||
set { Set(nameof(VirtualId), ref _VirtualId, value); }
|
||||
}
|
||||
|
||||
public bool DisplayVirtualId
|
||||
{
|
||||
get { return _DisplayVirtualId; }
|
||||
set { Set(nameof(DisplayVirtualId), ref _DisplayVirtualId, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取固件版本。
|
||||
/// </summary>
|
||||
@ -597,7 +616,6 @@ namespace Plane.Copters
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
public float Pitch
|
||||
{
|
||||
get { return _Pitch; }
|
||||
|
Loading…
Reference in New Issue
Block a user