通讯无法闪灯,发RTK等bug,由于使用了新协议,暂时改回去

This commit is contained in:
xu 2020-03-02 19:22:14 +08:00
parent 772bafa771
commit 21d9c121f5

View File

@ -413,6 +413,8 @@ namespace Plane.CommunicationManagement
/// <returns></returns> /// <returns></returns>
public async Task WriteCommPacketAsync(short copterId, short messageType, byte[] data = null, byte[] batchPacket = null) public async Task WriteCommPacketAsync(short copterId, short messageType, byte[] data = null, byte[] batchPacket = null)
{ {
//新盒子的协议--暂时不用-需要问张伟
/*
if (messageType == MavComm.COMM_DOWNLOAD_COMM && copterId == 0) if (messageType == MavComm.COMM_DOWNLOAD_COMM && copterId == 0)
{ {
short byteNum; short byteNum;
@ -430,6 +432,7 @@ namespace Plane.CommunicationManagement
batchPacket = BitConverter.GetBytes(length).Concat(batchPacket).ToArray(); batchPacket = BitConverter.GetBytes(length).Concat(batchPacket).ToArray();
} }
} }
*/
if (data != null && batchPacket != null) data = batchPacket.Concat(data).ToArray(); if (data != null && batchPacket != null) data = batchPacket.Concat(data).ToArray();
int packetlength = data == null ? 0 : data.Length; int packetlength = data == null ? 0 : data.Length;
@ -483,6 +486,16 @@ namespace Plane.CommunicationManagement
{ {
int dataLength = 6 + 2 + indata.Length * 32; int dataLength = 6 + 2 + indata.Length * 32;
byte[] data = new byte[dataLength]; byte[] data = new byte[dataLength];
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, 6, 2);
//新盒子的协议--暂时不用-需要问张伟
/*
Int16 countNum = (Int16)indata.Length; Int16 countNum = (Int16)indata.Length;
byte[] uses = new byte[] { 0, 1, 0, 0, 0, 0 }; byte[] uses = new byte[] { 0, 1, 0, 0, 0, 0 };
@ -491,6 +504,10 @@ namespace Plane.CommunicationManagement
Array.Copy(BitConverter.GetBytes(countNum), 0, data, 2, 2); Array.Copy(BitConverter.GetBytes(countNum), 0, data, 2, 2);
Array.Copy(BitConverter.GetBytes(countNum), 0, data, 6, 2); Array.Copy(BitConverter.GetBytes(countNum), 0, data, 6, 2);
*/
int offset = 8; int offset = 8;