diff --git a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo index 8dfd396..f588abe 100644 Binary files a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo and b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo differ diff --git a/ErgometerApplication/ErgometerApplication/ClientApplicatie.cs b/ErgometerApplication/ErgometerApplication/ClientApplicatie.cs index 429a914..d1483a5 100644 --- a/ErgometerApplication/ErgometerApplication/ClientApplicatie.cs +++ b/ErgometerApplication/ErgometerApplication/ClientApplicatie.cs @@ -36,23 +36,26 @@ namespace ErgometerApplication { MainClient.ComPort.Write("ST"); string response = MainClient.ComPort.Read(); - Meting m = MainClient.SaveMeting(response); - - heartBeat.updateValue(m.HeartBeat); - RPM.updateValue(m.RPM); - speed.updateValue(m.Speed); - distance.updateValue(m.Distance); - power.updateValue(m.Power); - energy.updateValue(m.Energy); - actualpower.updateValue(m.ActualPower); - - if(count >= 10) + if (response != "err") { - count = 0; - panelGraphView.updateAllCharts(MainClient.Metingen); - } + Meting m = MainClient.SaveMeting(response); - count++; + heartBeat.updateValue(m.HeartBeat); + RPM.updateValue(m.RPM); + speed.updateValue(m.Speed); + distance.updateValue(m.Distance); + power.updateValue(m.Power); + energy.updateValue(m.Energy); + actualpower.updateValue(m.ActualPower); + + if (count >= 10) + { + count = 0; + panelGraphView.updateAllCharts(MainClient.Metingen); + } + + count++; + } } } @@ -69,7 +72,7 @@ namespace ErgometerApplication if (password.Length > 0) { string error = ""; - bool connect = MainClient.Connect(SerialPort.GetPortNames()[0], username, password, out error); + bool connect = MainClient.Connect("COM3", username, password, out error); if (connect) { diff --git a/ErgometerApplication/ErgometerApplication/MainClient.cs b/ErgometerApplication/ErgometerApplication/MainClient.cs index 2d8b6ec..90e5f92 100644 --- a/ErgometerApplication/ErgometerApplication/MainClient.cs +++ b/ErgometerApplication/ErgometerApplication/MainClient.cs @@ -153,7 +153,17 @@ namespace ErgometerApplication public static Meting SaveMeting(string meting) { - Meting m = Meting.Parse(meting); + Meting m = null; + + try + { + m = Meting.Parse(meting); + } + catch(Exception e) + { + return new Meting(0, 0, 0, 0, 0, 0, 0, 0, 0); + } + Metingen.Add(m); if (Doctor.Connected) { @@ -215,25 +225,37 @@ namespace ErgometerApplication case NetCommand.ValueType.DISTANCE: ComPort.Write("RS"); ComPort.Read(); - Thread.Sleep(500); + Thread.Sleep(200); + ComPort.Write("CM"); + ComPort.Read(); + Thread.Sleep(700); ComPort.Write("PD " + command.SetValue.ToString()); ComPort.Read(); break; case NetCommand.ValueType.ENERGY: ComPort.Write("RS"); ComPort.Read(); - Thread.Sleep(500); + Thread.Sleep(200); + ComPort.Write("CM"); + ComPort.Read(); + Thread.Sleep(700); ComPort.Write("PE " + command.SetValue.ToString()); ComPort.Read(); break; case NetCommand.ValueType.POWER: + ComPort.Write("CM"); + ComPort.Read(); + Thread.Sleep(200); ComPort.Write("PW " + command.SetValue.ToString()); ComPort.Read(); break; case NetCommand.ValueType.TIME: ComPort.Write("RS"); ComPort.Read(); - Thread.Sleep(500); + Thread.Sleep(200); + ComPort.Write("CM"); + ComPort.Read(); + Thread.Sleep(700); string temp = (command.SetValue / 60) + ""; if(temp.Length < 2) { diff --git a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll index d69de89..69afd8a 100644 Binary files a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll and b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll differ