This commit is contained in:
2015-11-03 16:08:55 +01:00
parent a7e9241ba6
commit 5ec521c2a5
3 changed files with 18 additions and 14 deletions
@@ -120,6 +120,7 @@ namespace ErgometerApplication
MainClient.ComPort.Read();
ergotest = new ErgometerTest(gewicht, lengte, leeftijd, geslacht, this);
updateTimer.Start();
beeptimer.Start();
}
@@ -75,16 +75,6 @@ namespace ErgometerApplication
case state.WORKLOAD:
if (MainClient.GetLastMeting().Seconds - workloadStarted > 180)
{
//Checken of de heartrate niet groter is dan 75%, anders stoppen
if (workloadHearthbeat > (CalculateMaximumHeartRate() * 0.80))
{
workloadStarted = MainClient.GetLastMeting().Seconds;
currentstate = state.COOLINGDOWN;
MainClient.SwitchTestModeAudio();
client.updateStepsText("Uw hartslag heeft het kritieke punt bereikt, we beginnen nu aan de cooldown.");
MainClient.ComPort.Write("PW 25");
}
int pw = GetWorkloadPower(GetCurrentWorkload());
workloads.Add(new Workload(MainClient.GetLastMeting().Power, workloadHearthbeat));
MainClient.ComPort.Write("PW " + pw);
@@ -95,6 +85,16 @@ namespace ErgometerApplication
workloadStarted = MainClient.GetLastMeting().Seconds;
workloadHearthbeat = 0;
Console.WriteLine("3:00 gefietst, workload" + (GetCurrentWorkload()) + " af, nieuwe waardes maken");
//Checken of de heartrate niet groter is dan 75%, anders stoppen
if (workloadHearthbeat > (CalculateMaximumHeartRate() * 0.80))
{
workloadStarted = MainClient.GetLastMeting().Seconds;
currentstate = state.COOLINGDOWN;
MainClient.SwitchTestModeAudio();
client.updateStepsText("Uw hartslag heeft het kritieke punt bereikt, we beginnen nu aan de cooldown.");
MainClient.ComPort.Write("PW 25");
}
}
else if (MainClient.GetLastMeting().Seconds - workloadStarted > 160 && workloadHearthbeat == 0)
{
@@ -130,7 +130,7 @@ namespace ErgometerApplication
}
else
{
MainClient.Client.updateStepsText("Er zijn teweinig workload tests afgenomen om een resultaat te maken. Onze excuses voor het ongemak.");
MainClient.Client.updateStepsText("Er zijn te weinig workload tests afgenomen om een resultaat te maken. Onze excuses voor het ongemak.");
}
break;
}
@@ -43,11 +43,14 @@ namespace ErgometerDoctorApplication
switch (command.Type)
{
case NetCommand.CommandType.DATA:
lock (Metingen)
if (command != null && command.Meting != null)
{
Metingen.Add(command.Meting);
lock (Metingen)
{
Metingen.Add(command.Meting);
}
window.Invoke(window.updateMetingen, new Object[] { command.Meting });
}
window.Invoke(window.updateMetingen, new Object[] { command.Meting });
break;
case NetCommand.CommandType.CHAT:
ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, command.IsDoctor);