Fixed a lot of bugs shoudl be able to write unit tests now.

This commit is contained in:
2019-09-05 00:51:07 -06:00
parent 9e6ce4d9f6
commit 5b5757c7d4
12 changed files with 41 additions and 81 deletions

View File

@@ -1,7 +1,4 @@
using System;
using System.Net;
using System.Reflection.Metadata.Ecma335;
using System.Xml.Schema;
namespace Tello_Drone
{
@@ -15,7 +12,7 @@ namespace Tello_Drone
_udpClient = udpClient;
}
public void Forward(int x) => SendCommand($"forward {x}");
public void Forward(int x) =>SendCommand() ($"forward {x}");
public void Reverse(int x) => SendCommand($"back {x}");
public void Up(int z) => SendCommand($"up {z}");
public void Down(int z) => SendCommand($"down {z}");
@@ -34,14 +31,14 @@ namespace Tello_Drone
private void SendCommand(string message)
{
var returnValue = _udpClient.TrySend(message, 0_500);
var returnValue = _udpClient.TrySend(message, 0_500, 3);
if (returnValue == false)
SendCommand("land");
}
private bool TrySendCommand(string message)
{
return _udpClient.TrySend(message, 0_500);
return _udpClient.TrySend(message, 0_500, 3);
}
}