Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b742acca9 | ||
|
|
50da579fc2 |
@@ -56,7 +56,7 @@ namespace ErgometerApplication
|
|||||||
currentPower = 25;
|
currentPower = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainClient.Client.heartBeat.max = (int)CalculateMaximumHeartRate();
|
MainClient.Client.heartBeat.max = (int)(CalculateMaximumHeartRate()*0.70);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void timerTick()
|
public void timerTick()
|
||||||
@@ -68,12 +68,12 @@ namespace ErgometerApplication
|
|||||||
MainClient.QuickBeepAudio();
|
MainClient.QuickBeepAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MainClient.GetLastMeting().RPM < 45 || MainClient.GetLastMeting().RPM > 55)
|
if (MainClient.GetLastMeting().RPM < 42 || MainClient.GetLastMeting().RPM > 58)
|
||||||
deviation++;
|
deviation++;
|
||||||
else
|
else
|
||||||
deviation = Math.Max(deviation-1, 0);
|
deviation = Math.Max(deviation-1, 0);
|
||||||
|
|
||||||
if(deviation >= 80 && !failed)
|
if(deviation >= 60 && !failed)
|
||||||
{
|
{
|
||||||
workloadStarted = MainClient.GetLastMeting().Seconds;
|
workloadStarted = MainClient.GetLastMeting().Seconds;
|
||||||
currentstate = state.COOLINGDOWN;
|
currentstate = state.COOLINGDOWN;
|
||||||
@@ -88,11 +88,11 @@ namespace ErgometerApplication
|
|||||||
switch(currentstate)
|
switch(currentstate)
|
||||||
{
|
{
|
||||||
case state.WARMUP:
|
case state.WARMUP:
|
||||||
if (MainClient.GetLastMeting().Seconds > 30)
|
if (MainClient.GetLastMeting().Seconds > 20)
|
||||||
{
|
{
|
||||||
List<ErgometerLibrary.Meting> last20 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 20, 20);
|
List<ErgometerLibrary.Meting> last10 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 10, 10);
|
||||||
int max = FindMaxValue(last20, x => x.HeartBeat);
|
int max = FindMaxValue(last10, x => x.HeartBeat);
|
||||||
int min = FindMinValue(last20, x => x.HeartBeat);
|
int min = FindMinValue(last10, x => x.HeartBeat);
|
||||||
if (max + min < 20)
|
if (max + min < 20)
|
||||||
{
|
{
|
||||||
client.updateStepsText("We detecteren geen hartslag. Controleer of de hartslagmeter is verbonden. De test gaat automatisch verder.");
|
client.updateStepsText("We detecteren geen hartslag. Controleer of de hartslagmeter is verbonden. De test gaat automatisch verder.");
|
||||||
@@ -110,7 +110,7 @@ namespace ErgometerApplication
|
|||||||
client.updateStepsText("De warmup is voltooid. De test gaat nu beginnen. U begint nu aan de " + NumToText(GetCurrentWorkload()) + " workload.");
|
client.updateStepsText("De warmup is voltooid. De test gaat nu beginnen. U begint nu aan de " + NumToText(GetCurrentWorkload()) + " workload.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MainClient.GetLastMeting().Seconds > 9 && MainClient.GetLastMeting().Seconds < 11)
|
if (MainClient.GetLastMeting().Seconds > 4 && MainClient.GetLastMeting().Seconds < 6)
|
||||||
{
|
{
|
||||||
if (MainClient.GetLastMeting().HeartBeat < 20)
|
if (MainClient.GetLastMeting().HeartBeat < 20)
|
||||||
{
|
{
|
||||||
@@ -119,21 +119,21 @@ namespace ErgometerApplication
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case state.WORKLOAD:
|
case state.WORKLOAD:
|
||||||
if (MainClient.GetLastMeting().Seconds - workloadStarted > 180)
|
if (MainClient.GetLastMeting().Seconds - workloadStarted > 30)
|
||||||
{
|
{
|
||||||
currentPower = GetWorkloadPower(GetCurrentWorkload());
|
currentPower = GetWorkloadPower(GetCurrentWorkload());
|
||||||
workloads.Add(new Workload(MainClient.GetLastMeting().Power, workloadHearthbeat));
|
workloads.Add(new Workload(MainClient.GetLastMeting().Power, workloadHearthbeat));
|
||||||
MainClient.ComPort.Write("PW " + currentPower);
|
MainClient.ComPort.Write("PW " + currentPower);
|
||||||
MainClient.ComPort.Read();
|
MainClient.ComPort.Read();
|
||||||
client.updateStepsText("U heeft de workload afgerond, u begint nu aan de " + NumToText(GetCurrentWorkload()) + " workload. Uw nieuwe weerstand is " + currentPower + " Watt.");
|
client.updateStepsText("U heeft de workload afgerond, u begint nu aan de " + NumToText(GetCurrentWorkload()) + " workload. Uw nieuwe weerstand is " + currentPower + " Watt.");
|
||||||
MainClient.SwitchWorkloadAudio();
|
|
||||||
|
|
||||||
workloadStarted = MainClient.GetLastMeting().Seconds;
|
workloadStarted = MainClient.GetLastMeting().Seconds;
|
||||||
workloadHearthbeat = 0;
|
workloadHearthbeat = 0;
|
||||||
Console.WriteLine("3:00 gefietst, workload" + (GetCurrentWorkload()) + " af, nieuwe waardes maken");
|
Console.WriteLine("3:00 gefietst, workload" + (GetCurrentWorkload()) + " af, nieuwe waardes maken");
|
||||||
|
|
||||||
//Checken of de heartrate niet groter is dan 75%, anders stoppen
|
//Checken of de heartrate niet groter is dan 70%, anders stoppen
|
||||||
if (workloadHearthbeat > (CalculateMaximumHeartRate() * 0.80))
|
if (workloadHearthbeat > (CalculateMaximumHeartRate() * 0.70) || GetCurrentWorkload() >= 4)
|
||||||
{
|
{
|
||||||
workloadStarted = MainClient.GetLastMeting().Seconds;
|
workloadStarted = MainClient.GetLastMeting().Seconds;
|
||||||
currentstate = state.COOLINGDOWN;
|
currentstate = state.COOLINGDOWN;
|
||||||
@@ -143,30 +143,32 @@ namespace ErgometerApplication
|
|||||||
MainClient.ComPort.Write("PW 25");
|
MainClient.ComPort.Write("PW 25");
|
||||||
MainClient.ComPort.Read();
|
MainClient.ComPort.Read();
|
||||||
currentPower = 25;
|
currentPower = 25;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainClient.SwitchWorkloadAudio();
|
||||||
}
|
}
|
||||||
else if (MainClient.GetLastMeting().Seconds - workloadStarted > 160 && workloadHearthbeat == 0)
|
else if (MainClient.GetLastMeting().Seconds - workloadStarted > 20 && workloadHearthbeat == 0)
|
||||||
{
|
{
|
||||||
List<ErgometerLibrary.Meting> last150 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 150, 150);
|
List<ErgometerLibrary.Meting> last35 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 35, 35);
|
||||||
workloadHearthbeat = FindAverageValue(last150, x => x.HeartBeat);
|
workloadHearthbeat = FindAverageValue(last35, x => x.HeartBeat);
|
||||||
Console.WriteLine("2:40 gefiets, gemiddelde harstslag berekenen:" + workloadHearthbeat);
|
|
||||||
client.updateStepsText("U bent nu met de " + NumToText(GetCurrentWorkload()) + " workload bezig. Uw gemiddelde hartslag is berekend als " + workloadHearthbeat + "bpm.");
|
client.updateStepsText("U bent nu met de " + NumToText(GetCurrentWorkload()) + " workload bezig. Uw gemiddelde hartslag is berekend als " + workloadHearthbeat + "bpm.");
|
||||||
}
|
}
|
||||||
else if(MainClient.GetLastMeting().Seconds - workloadStarted > 9 && MainClient.GetLastMeting().Seconds - workloadStarted < 11)
|
else if(MainClient.GetLastMeting().Seconds - workloadStarted > 4 && MainClient.GetLastMeting().Seconds - workloadStarted < 6)
|
||||||
{
|
{
|
||||||
client.updateStepsText("U bent nu met de " + NumToText(GetCurrentWorkload()) + " workload bezig. De fiets staat nu ingesteld op " + MainClient.GetLastMeting().Power + " Watt");
|
client.updateStepsText("U bent nu met de " + NumToText(GetCurrentWorkload()) + " workload bezig. De fiets staat nu ingesteld op " + MainClient.GetLastMeting().Power + " Watt");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case state.COOLINGDOWN:
|
case state.COOLINGDOWN:
|
||||||
if(MainClient.GetLastMeting().Seconds - workloadStarted > 360)
|
if(MainClient.GetLastMeting().Seconds - workloadStarted > 15)
|
||||||
{
|
{
|
||||||
currentstate = state.STOP;
|
currentstate = state.STOP;
|
||||||
MainClient.SwitchTestModeAudio();
|
MainClient.SwitchTestModeAudio();
|
||||||
client.updateStepsText("De test is afgelopen.");
|
client.updateStepsText("De test is afgelopen.");
|
||||||
}
|
}
|
||||||
else if(MainClient.GetLastMeting().Seconds - workloadStarted > 9 && MainClient.GetLastMeting().Seconds - workloadStarted < 11)
|
else if(MainClient.GetLastMeting().Seconds - workloadStarted > 4 && MainClient.GetLastMeting().Seconds - workloadStarted < 6)
|
||||||
{
|
{
|
||||||
client.updateStepsText("U bent momenteel met de cooldown bezig.");
|
client.updateStepsText("U bent momenteel met de cooldown bezig. U krijgt uw resulataten binnenkort te zien.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case state.STOP:
|
case state.STOP:
|
||||||
@@ -174,18 +176,23 @@ namespace ErgometerApplication
|
|||||||
MainClient.Client.beeptimer.Stop();
|
MainClient.Client.beeptimer.Stop();
|
||||||
MainClient.ComPort.Write("RS");
|
MainClient.ComPort.Write("RS");
|
||||||
MainClient.ComPort.Read();
|
MainClient.ComPort.Read();
|
||||||
currentPower = 0;
|
currentPower = 25;
|
||||||
|
if (workloads.Count > 1)
|
||||||
|
{
|
||||||
|
string str = "";
|
||||||
|
|
||||||
if (failed)
|
if (failed)
|
||||||
{
|
{
|
||||||
MainClient.Client.updateStepsText("De test is mislukt omdat u te vaak heeft afgeweken van 50rpm. Onze excuses voor het ongemak.");
|
MainClient.SendNetCommand(new ErgometerLibrary.NetCommand(CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateZScore(), CalculateRating(), MainClient.Session));
|
||||||
|
str = "De test is mislukt omdat u te vaak heeft afgeweken van 50rpm. De resultaten kunnen hierdoor afwijken. ";
|
||||||
}
|
}
|
||||||
else if (workloads.Count > 1)
|
else
|
||||||
{
|
str = "De test is afgelopen. ";
|
||||||
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(str + "Uw test resultaten zijn: \n VO2MAX: {0:0.00} MET: {1:0.00} Gemiddelde: {2:0.00} \n {3} ", CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateRating()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainClient.Client.updateStepsText("Er zijn te weinig 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.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user