[chronojump] Fixed do not use extra weight (Kg) in inertia calculations



commit 7732478a823a8cd6a78ab82760423f88a04e7469
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue May 26 16:18:31 2015 +0200

    Fixed do not use extra weight (Kg) in inertia calculations

 src/encoder.cs     |    6 +++---
 src/gui/encoder.cs |   13 +++++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 942531d..0e79dc5 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -915,9 +915,9 @@ public class EncoderConfiguration {
        public int gearedDown;  //demultiplication
        
        public int inertiaTotal; //this is the inertia used by R
-       public int extraWeightN; //how much extra weights
-       public int extraWeightGrams; //weight of each extra weight
-       public double extraWeightLength; //length from center to center (cm)
+       public int extraWeightN; //how much extra weights (inertia)
+       public int extraWeightGrams; //weight of each extra weight (inertia)
+       public double extraWeightLength; //length from center to center (cm) (inertia)
 
 
        public string textDefault = Catalog.GetString("Linear encoder attached to a barbell.") + "\n" + 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index ebc6397..8f19fc7 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3054,13 +3054,18 @@ public partial class ChronoJumpWindow
        */
 
        //BODY and EXTRA are at EncoderParams and sent to graph.R       
-       private double findMass(Constants.MassType massType) {
+       private double findMass(Constants.MassType massType) 
+       {
+               double extraWeight = spin_encoder_extra_weight.Value;
+               if(encoderConfigurationCurrent.has_inertia)
+                       extraWeight = 0;
+
                if(massType == Constants.MassType.BODY)
                        return currentPersonSession.Weight;
                else if(massType == Constants.MassType.EXTRA)
-                       return spin_encoder_extra_weight.Value;
+                       return extraWeight;
                else //(massType == Constants.MassType.DISPLACED)
-                       return spin_encoder_extra_weight.Value + 
+                       return extraWeight + 
                                ( currentPersonSession.Weight * getExercisePercentBodyWeightFromCombo() ) / 
100.0;
        }
 
@@ -3936,7 +3941,7 @@ public partial class ChronoJumpWindow
                encoder_capture_signal_pixmap.DrawPoints(pen_black_encoder_capture, paintPoints);
 
                layout_encoder_capture_signal.SetMarkup(currentPerson.Name + " (" + 
-                               spin_encoder_extra_weight.Value.ToString() + "Kg)");
+                               findMass(Constants.MassType.EXTRA).ToString() + "Kg)");
                encoder_capture_signal_pixmap.DrawLayout(pen_blue_encoder_capture, 5, 5, 
layout_encoder_capture_signal);
 
                if(refreshAreaOnly) {


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