[chronojump] encoder save best do avg ecc-con on ecc-con
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder save best do avg ecc-con on ecc-con
- Date: Thu, 28 Apr 2016 11:31:57 +0000 (UTC)
commit 9f47e9f59a4af6c3541c3d84c12c60b2922e416e
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 28 13:28:58 2016 +0200
encoder save best do avg ecc-con on ecc-con
src/encoder.cs | 30 +++++++++++++++++++++++++++++-
src/gui/encoderTreeviews.cs | 32 ++++++++------------------------
2 files changed, 37 insertions(+), 25 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index abaea7d..197600e 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -405,7 +405,6 @@ public class EncoderSignal
//this can be an eccentric or concentric curve
public int FindPosOfBest(string variable) {
- //TODO: change for the rest of stuff
double bestValue = 0;
int bestValuePos = 0;
int i = 0;
@@ -422,6 +421,35 @@ public class EncoderSignal
return bestValuePos;
}
+ //this is an ecc-con curve
+ public int FindPosOfBestEccCon(string variable)
+ {
+ double eccValue = 0;
+ double conValue = 0;
+
+ double bestValue = 0; //will be ecc-con average
+ int bestValuePos = 0; //will be the position of the ecc
+ int i = 0;
+
+ bool ecc = true;
+ foreach(EncoderCurve curve in curves)
+ {
+ if(ecc) {
+ eccValue = curve.GetParameter(variable);
+ } else {
+ conValue = curve.GetParameter(variable);
+ if( ( (eccValue + conValue) / 2 ) > bestValue) {
+ bestValue = (eccValue + conValue) / 2;
+ bestValuePos = i -1;
+ }
+ }
+
+ ecc = ! ecc;
+ i ++;
+ }
+ return bestValuePos;
+ }
+
~EncoderSignal() {}
}
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 3497c20..f0de421 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -334,17 +334,14 @@ public partial class ChronoJumpWindow
{
int bestRow = 0;
if(saveOption == Constants.EncoderAutoSaveCurve.BEST) {
- //get the concentric curves
- EncoderSignal encoderSignal = new
EncoderSignal(treeviewEncoderCaptureCurvesGetCurves(AllEccCon.CON));
- bestRow = encoderSignal.FindPosOfBest(mainVariable);
-
- //convert from c to ec. eg.
- //three concentric curves: c[0], c[1], c[2]
- //coming from three ecc-con: e[0], c[1], e[2], c[3], e[4], c[5]
- //if from first list, c[2] is the best, then on second list it will be the ec curve:
e[4],c[5]
- //always multiply *2
- if(ecconLast != "c")
- bestRow *= 2;
+ if(ecconLast == "c") {
+ //get the concentric curves
+ EncoderSignal encoderSignal = new
EncoderSignal(treeviewEncoderCaptureCurvesGetCurves(AllEccCon.CON));
+ bestRow = encoderSignal.FindPosOfBest(mainVariable);
+ } else {
+ EncoderSignal encoderSignal = new
EncoderSignal(treeviewEncoderCaptureCurvesGetCurves(AllEccCon.ALL));
+ bestRow = encoderSignal.FindPosOfBestEccCon(mainVariable); //will be pos of
the ecc
+ }
}
@@ -413,19 +410,6 @@ public partial class ChronoJumpWindow
iterOk = encoderCaptureListStore.IterNext (ref iter);
}
- //combo_encoder_capture_show_save_curve_button();
-
- /* temporarily removed message
- *
- string message = "";
- if(saveOption == Constants.EncoderAutoSaveCurve.NONE)
- message = Catalog.GetString("Removed");
- else
- message = Catalog.GetString("Saved");
- label_encoder_curve_action.Text = message + " " + messageRows;
- */
-
-
updateUserCurvesLabelsAndCombo(true);
Sqlite.Close();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]