static async Task <bool> TestGyro() { Console.Clear(); ConsoleOutput.Logo(); Console.WriteLine("Press ESC to stop"); int outputStart = Console.CursorTop + 1; do { var result = await SendCommand(":XL1#,#"); while (!Console.KeyAvailable) { Console.CursorTop = outputStart; Console.CursorLeft = 0; Console.WriteLine("********* GYRO TEST **************"); ConsoleOutput.ClearRestOfScreen(); Console.CursorTop = outputStart; await SendCommand(":XLGC#,#"); await Task.Delay(250); } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); await SendCommand(":XL0#,#"); _commHandler.Disconnect(); _commHandler = null; await Task.Delay(250); return(true); }
static async Task <bool> TestGPS() { Console.Clear(); ConsoleOutput.Logo(); Console.WriteLine("********* GPS TEST ***************\r"); Console.WriteLine("* Battery may need to be charged *\r"); Console.WriteLine("* first time GPS is used ~30min *\r"); Console.WriteLine("* 0 = No satelites found *\r"); Console.WriteLine("* 1 = Satelites found *\r"); Console.WriteLine("**********************************\r"); Console.WriteLine("Press ESC to stop"); int outputStart = Console.CursorTop + 1; do { while (!Console.KeyAvailable) { Console.CursorTop = outputStart; Console.CursorLeft = 0; ConsoleOutput.ClearRestOfScreen(); var result = await SendCommand(":gT100#,n"); if (result.Data == "1") { result = await SendCommand(":Gt#,#"); var latitudeArray = result.Data.Split('*'); float latitude = float.Parse(latitudeArray[0], _oatCulture) + (float.Parse(latitudeArray[1], _oatCulture) / 60.0f); await Task.Delay(250); result = await SendCommand(":Gg#,#"); var longitudeArray = result.Data.Split('*'); float longitude = float.Parse(longitudeArray[0], _oatCulture) + (float.Parse(longitudeArray[1], _oatCulture) / 60.0f); if (longitude > 180) { longitude -= 360; } await Task.Delay(250); ConsoleOutput.Error(string.Format("Lat: {0}", latitude)); ConsoleOutput.Error(string.Format("Lon: {0}", longitude)); } //Console.WriteLine("ESC - Exit\n"); await Task.Delay(1000); } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); _commHandler.Disconnect(); _commHandler = null; Console.ReadKey(); return(true); }