[chronojump] forceSensor recalculate changes maxForceRaw and maxAvgForce1s on set sql



commit 92c76ea392e14d18fdaf70fbd3133e666d3c3dbb
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 25 13:52:39 2022 +0100

    forceSensor recalculate changes maxForceRaw and maxAvgForce1s on set sql

 src/forceSensor.cs          |  8 ++++++++
 src/gui/app1/forceSensor.cs | 21 +++++++++++++++++++++
 2 files changed, 29 insertions(+)
---
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index f9f52768c..30a75dde3 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -401,6 +401,14 @@ public class ForceSensor
                get { return exerciseName; }
                set { exerciseName = value; }
        }
+       public double MaxForceRaw
+       {
+               set { maxForceRaw = value; }
+       }
+       public double MaxAvgForce1s
+       {
+               set { maxAvgForce1s = value; }
+       }
 }
 
 public class ForceSensorExercise
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index f1ea1f548..e9d71ef18 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -2538,6 +2538,7 @@ LogB.Information(" fs R ");
                //currentForceSensor.Comments = 
UtilGtk.TextViewGetCommentValidSQL(textview_force_sensor_capture_comment);
                currentForceSensor.Comments = 
UtilGtk.TextViewGetCommentValidSQL(textview_contacts_signal_comment);
 
+
                double stiffness;
                string stiffnessString;
                getStiffnessAndStiffnessStringFromSQL(out stiffness, out stiffnessString);
@@ -2557,6 +2558,26 @@ LogB.Information(" fs R ");
                        forceSensorDoGraphAI(false);
                }
 
+               //to update maxAvgForce in 1s and fmax need to have fscPoints changed according to 
CaptureOption. So do it here
+               currentForceSensor.MaxForceRaw = forceSensorValues.Max;
+
+               //get maxAvgForce in 1s start ---->
+               double maxAvgForce1s = -1; //default value
+               double forceMaxAvgInWindow;
+               int forceMaxAvgInWindowSampleStart;
+               int forceMaxAvgInWindowSampleEnd;
+               string forceMaxAvgInWindowError;
+               fscPoints.GetForceMaxAvgInWindow(0, fscPoints.NumCaptured -1, 1,
+                               out forceMaxAvgInWindow,
+                               out forceMaxAvgInWindowSampleStart,
+                               out forceMaxAvgInWindowSampleEnd,
+                               out forceMaxAvgInWindowError);
+               if(forceMaxAvgInWindowError == "")
+                       maxAvgForce1s = forceMaxAvgInWindow;
+               currentForceSensor.MaxAvgForce1s = maxAvgForce1s;
+               //<---- get maxAvgForce in 1s end
+
+
                currentForceSensor.UpdateSQL(false);
 
                //notebook_force_sensor_analyze_top.CurrentPage = 
Convert.ToInt32(notebook_force_sensor_analyze_top_pages.CURRENTSETSIGNAL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]