[chronojump] ForceSensor: Fixed crash on repetitions detection
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ForceSensor: Fixed crash on repetitions detection
- Date: Mon, 17 Feb 2020 12:44:56 +0000 (UTC)
commit 0f779bb898f6e18a0119aeef627dfb2ea9b72651
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Feb 17 13:43:01 2020 +0100
ForceSensor: Fixed crash on repetitions detection
src/forceSensor.cs | 2 +-
src/forceSensorDynamics.cs | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 434a716c..5a2c0f95 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -1395,7 +1395,7 @@ public class ForceSensorAnalyzeInstant
double personWeight, ForceSensor.CaptureOptions fsco, double stiffness,
double eccMinDisplacement, double conMinDisplacement)
{
- LogB.Information("at readFile");
+ LogB.Information(string.Format("at readFile, start: {0}, end: {1}", start, end));
fscAIPoints = new ForceSensorCapturePoints(graphWidth, graphHeight, -1);
List<string> contents = Util.ReadFileAsStringList(file);
diff --git a/src/forceSensorDynamics.cs b/src/forceSensorDynamics.cs
index 59d87839..364a18b2 100644
--- a/src/forceSensorDynamics.cs
+++ b/src/forceSensorDynamics.cs
@@ -174,7 +174,9 @@ public abstract class ForceSensorDynamics
searchingFirstExtreme = false;
}
- prepareCheckAndSendRepetition(concentricFlag, yList, lastExtremeSample,
possibleExtremeSample);
+ LogB.Information("care to fix problem of sending both extremes at pos 0 on
the first rep (caused by samplePreFirst code)");
+ if(possibleExtremeSample > lastExtremeSample)
+ prepareCheckAndSendRepetition(concentricFlag, yList,
lastExtremeSample, possibleExtremeSample);
//Save the sample of the last extreme in order to compare new samples with it
lastExtremeSample = possibleExtremeSample;
@@ -190,11 +192,15 @@ public abstract class ForceSensorDynamics
currentSample += 1;
}
- prepareCheckAndSendRepetition(concentricFlag, yList, lastExtremeSample,
possibleExtremeSample);
+ if(possibleExtremeSample > lastExtremeSample)
+ prepareCheckAndSendRepetition(concentricFlag, yList, lastExtremeSample,
possibleExtremeSample);
}
private void prepareCheckAndSendRepetition(int concentricFlag, List<double> yList, int sampleStart,
int sampleEnd)
{
+ LogB.Information(string.Format("prepareCheckAndSendRepetition params: concentricFlag: {0},
yList.Count: {1}, sampleStart: {2}, sampleEnd: {3}",
+ concentricFlag, yList.Count, sampleStart, sampleEnd));
+
//on elastic do not accept eccentric reps
if(isElastic && concentricFlag == -1)
return;
@@ -244,7 +250,10 @@ public abstract class ForceSensorDynamics
// 4) check if displacement is ok, and add the repetition
if(displacementOk(concentricFlag, yList[sampleStart], yList[sampleEnd]))
+ {
+ LogB.Information(" Adding repetition ");
addRepetition(yList, sampleStart, sampleEnd);
+ }
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]