修改双频没有发送数据的问题

This commit is contained in:
xu 2020-03-16 14:13:14 +08:00
parent 1b7ffa31ba
commit ebf81ea8a1
3 changed files with 7 additions and 4 deletions

View File

@ -68,6 +68,7 @@ namespace Plane.Communication
public override async Task OpenAsync() public override async Task OpenAsync()
{ {
string logstr;
if (!IsOpen) if (!IsOpen)
{ {
try try
@ -77,8 +78,9 @@ namespace Plane.Communication
//屏蔽掉异常处理 //屏蔽掉异常处理
//CreateClientAndConnectAsync会new一个TcpClient并且重新连接 //CreateClientAndConnectAsync会new一个TcpClient并且重新连接
//之前设置的TcpClient中Socket Bind会无效在多网卡工作时会导致断线重连的时间特别长 //之前设置的TcpClient中Socket Bind会无效在多网卡工作时会导致断线重连的时间特别长
catch (SocketException) catch (SocketException e)
{ {
logstr= e.Message;
//await CreateClientAndConnectAsync(); //await CreateClientAndConnectAsync();
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)

View File

@ -19,8 +19,8 @@ namespace Plane.CommunicationManagement
public TcpConnection Connection = null; public TcpConnection Connection = null;
public bool CommOK = false; public bool CommOK = false;
private const string MODULE_IP = "192.168.199.51"; private const string MODULE_IP = "192.168.199.51"; // "192.168.199.51";
private const string LOCAL_IP = "192.168.199.50"; private const string LOCAL_IP = "192.168.199.50"; //"192.168.199.50";
private const int PORT = 9551; private const int PORT = 9551;
private bool _disposed; private bool _disposed;
public int CommModuleCopterCount = 0; public int CommModuleCopterCount = 0;

View File

@ -1085,7 +1085,8 @@ namespace Plane.CommunicationManagement
byte[] packet = GeneratePacket(MAVLink.MAVLINK_MSG_ID_GPS_RTCM_DATA, gps); byte[] packet = GeneratePacket(MAVLink.MAVLINK_MSG_ID_GPS_RTCM_DATA, gps);
//Windows.Messages.Message.Show($"{DateTime.Now.ToString("HH:mm:ss:fff")} 单次长度 = {packet.Length}"); //Windows.Messages.Message.Show($"{DateTime.Now.ToString("HH:mm:ss:fff")} 单次长度 = {packet.Length}");
//await WriteCommPacketAsync(0, MavComm.COMM_DOWNLOAD_COMM, packet).ConfigureAwait(false); //老版本在这发送新版本在StartRtcmLoop里面一次性打包4个180字节发送了
await WriteCommPacketAsync(0, MavComm.COMM_DOWNLOAD_COMM, packet).ConfigureAwait(false);
lock (lock_rtcm) lock (lock_rtcm)
{ {