3 Commits
Author SHA1 Message Date
kennyboy55 6714306f14 added .gitignore 2015-11-04 11:25:37 +01:00
kennyboy55 5efbf04277 Fix male starting too low 2015-11-04 11:25:26 +01:00
kennyboy55 2f85ba0a4f Bugfixes 2015-11-04 10:39:41 +01:00
5 changed files with 22 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
*.zip
@@ -75,7 +75,7 @@ namespace ErgometerApplication
{ {
string error = ""; string error = "";
bool connect = false; bool connect = false;
foreach(string comport in SerialPort.GetPortNames()) foreach(string comport in SerialPort.GetPortNames().Reverse())
{ {
connect = MainClient.Connect(comport, username, password, out error); connect = MainClient.Connect(comport, username, password, out error);
if (connect) if (connect)
@@ -42,9 +42,20 @@ namespace ErgometerApplication
this.client = client; this.client = client;
client.updateStepsText("U begint nu aan een warmup, probeer een tempo van 50 rpm aan te houden. De test gaat automatisch verder."); client.updateStepsText("U begint nu aan een warmup, probeer een tempo van 50 rpm aan te houden. De test gaat automatisch verder.");
workloads = new List<Workload>(); workloads = new List<Workload>();
if (gender == 'M')
{
MainClient.ComPort.Write("PW 50");
MainClient.ComPort.Read();
currentPower = 50;
}
else
{
MainClient.ComPort.Write("PW 25"); MainClient.ComPort.Write("PW 25");
MainClient.ComPort.Read(); MainClient.ComPort.Read();
currentPower = 25; currentPower = 25;
}
MainClient.Client.heartBeat.max = (int)CalculateMaximumHeartRate(); MainClient.Client.heartBeat.max = (int)CalculateMaximumHeartRate();
} }
@@ -62,7 +73,7 @@ namespace ErgometerApplication
else else
deviation = Math.Max(deviation-1, 0); deviation = Math.Max(deviation-1, 0);
if(deviation >= 60 && !failed) if(deviation >= 80 && !failed)
{ {
workloadStarted = MainClient.GetLastMeting().Seconds; workloadStarted = MainClient.GetLastMeting().Seconds;
currentstate = state.COOLINGDOWN; currentstate = state.COOLINGDOWN;
@@ -127,6 +138,7 @@ namespace ErgometerApplication
workloadStarted = MainClient.GetLastMeting().Seconds; workloadStarted = MainClient.GetLastMeting().Seconds;
currentstate = state.COOLINGDOWN; currentstate = state.COOLINGDOWN;
MainClient.SwitchTestModeAudio(); MainClient.SwitchTestModeAudio();
MainClient.SendNetCommand(new ErgometerLibrary.NetCommand(CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateZScore(), CalculateRating(), MainClient.Session));
client.updateStepsText("Uw hartslag heeft het kritieke punt bereikt, we beginnen nu aan de cooldown."); client.updateStepsText("Uw hartslag heeft het kritieke punt bereikt, we beginnen nu aan de cooldown.");
MainClient.ComPort.Write("PW 25"); MainClient.ComPort.Write("PW 25");
MainClient.ComPort.Read(); MainClient.ComPort.Read();
@@ -170,7 +182,6 @@ namespace ErgometerApplication
else if (workloads.Count > 1) else if (workloads.Count > 1)
{ {
MainClient.Client.updateStepsText(String.Format("De test is afgelopen. Uw test resultaten zijn: \n VO2MAX: {0:0.00} MET: {1:0.00} Gemiddelde: {2:0.00} \n {3} ", CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateRating())); MainClient.Client.updateStepsText(String.Format("De test is afgelopen. Uw test resultaten zijn: \n VO2MAX: {0:0.00} MET: {1:0.00} Gemiddelde: {2:0.00} \n {3} ", CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateRating()));
MainClient.SendNetCommand(new ErgometerLibrary.NetCommand(CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateZScore(), CalculateRating(), MainClient.Session));
} }
else else
{ {
@@ -80,7 +80,8 @@ namespace ErgometerApplication
if (ComPort.Connect(comport)) if (ComPort.Connect(comport))
{ {
ComPort.Write("RS"); ComPort.Write("RS");
string temp = ComPort.Read(); string temp = ComPort.Read().Replace("\r", "").Replace("\n", "");
Console.WriteLine(temp);
if (temp.ToLower() != "ack") if (temp.ToLower() != "ack")
{ {
ComPort.Disconnect(); ComPort.Disconnect();
@@ -77,6 +77,8 @@ namespace ErgometerServer
Thread.Sleep(10); Thread.Sleep(10);
sendToDoctor(new NetCommand(meting, input.Session)); sendToDoctor(new NetCommand(meting, input.Session));
} }
break; break;
case NetCommand.RequestType.ALLSESSIONS: case NetCommand.RequestType.ALLSESSIONS:
List<Tuple<int, string, double>> sessions = FileHandler.GetAllSessions(); List<Tuple<int, string, double>> sessions = FileHandler.GetAllSessions();