[chronojump/FS-TFT-Menu] Saving an ecc-con rep stores meanPower, meanSpeed, meanForce according to EncoderRepetitionCriteria



commit 578572e320e1f0ef8795242e01fb28c29f014d61
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 6 11:58:39 2022 +0200

    Saving an ecc-con rep stores meanPower, meanSpeed, meanForce according to EncoderRepetitionCriteria

 src/gui/app1/encoder.cs | 23 ++++++++++++++++++++---
 src/preferences.cs      |  2 +-
 2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 83a20dc60..db5a8b539 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -3042,9 +3042,25 @@ public partial class ChronoJumpWindow
                                //duration is duration of ecc + duration of iso + duration of concentric
                                duration += (isometricDuration + curveConDuration);
                        
-                               meanPowerStr = curveNext.MeanPower; //concentric phase
-                               meanSpeedStr = curveNext.MeanSpeed; //concentric phase
-                               meanForceStr = curveNext.MeanForce; //concentric phase
+                               Preferences.EncoderRepetitionCriteria repCriteria =
+                                       preferences.GetEncoderRepetitionCriteria (current_mode);
+
+                               if(repCriteria == Preferences.EncoderRepetitionCriteria.ECC_CON)
+                               {
+                                       meanPowerStr = UtilAll.DivideSafe(curve.MeanPowerD + 
curveNext.MeanPowerD, 2).ToString();
+                                       meanSpeedStr = UtilAll.DivideSafe(curve.MeanSpeedD + 
curveNext.MeanSpeedD, 2).ToString();
+                                       meanForceStr = UtilAll.DivideSafe(curve.MeanForceD + 
curveNext.MeanForceD, 2).ToString();
+                               } else if(repCriteria == Preferences.EncoderRepetitionCriteria.ECC)
+                               {
+                                       meanPowerStr = curve.MeanPower;
+                                       meanSpeedStr = curve.MeanSpeed;
+                                       meanForceStr = curve.MeanForce;
+                               } else //if(repCriteria == Preferences.EncoderRepetitionCriteria.CON)
+                               {
+                                       meanPowerStr = curveNext.MeanPower;
+                                       meanSpeedStr = curveNext.MeanSpeed;
+                                       meanForceStr = curveNext.MeanForce;
+                               }
                        }
                        
                        /*
@@ -3054,6 +3070,7 @@ public partial class ChronoJumpWindow
                         * (depending on the rotating sign of inertial machine at that curve)
                         * if it's concentric, and it's full of -1,-2, … we have to change sign
                         * if it's eccentric-concentric, and in the eccentric phase is positive, then we 
should change sign of both phases
+                        * This is done on UtilEncoder.EncoderSaveCurve()
                         */
                        int inertialCheckStart = 0;
                        int inertialCheckDuration = 0;
diff --git a/src/preferences.cs b/src/preferences.cs
index b9a268c0e..2d7956275 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- *  Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com> 
+ *  Copyright (C) 2004-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;


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