[chronojump] Encoder Fixed cells color when capture main var != auto feedback var
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder Fixed cells color when capture main var != auto feedback var
- Date: Wed, 31 Jan 2018 11:59:28 +0000 (UTC)
commit b42d335de67bb6711b5af2635ae8093ff9c447f3
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 31 12:57:51 2018 +0100
Encoder Fixed cells color when capture main var != auto feedback var
src/gui/encoder.cs | 8 +++--
src/gui/encoderTreeviews.cs | 28 ++++++++++++-----
src/gui/repetitiveConditions.cs | 65 ++++++++++++++++++++++++++------------
3 files changed, 69 insertions(+), 32 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 7c7fa18..f335c3e 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -4720,8 +4720,9 @@ public partial class ChronoJumpWindow
maxAbsolute = maxPowerIntersession;
}
- repetitiveConditionsWin.ResetBestSetValue();
- repetitiveConditionsWin.UpdateBestSetValue(maxAbsolute);
+
repetitiveConditionsWin.ResetBestSetValue(RepetitiveConditionsWindow.BestSetValueEnum.CAPTURE_MAIN_VARIABLE);
+ repetitiveConditionsWin.UpdateBestSetValue(
+ RepetitiveConditionsWindow.BestSetValueEnum.CAPTURE_MAIN_VARIABLE,
maxAbsolute);
int textWidth = 1;
int textHeight = 1;
@@ -4831,7 +4832,8 @@ public partial class ChronoJumpWindow
dWidth = 1;
//select pen color for bars and sounds
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(d);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.CAPTURE_MAIN_VARIABLE, d);
bool discarded = false;
if(encoderConfigurationCurrent.has_inertia) {
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 974e313..9ecdeae 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -138,7 +138,7 @@ public partial class ChronoJumpWindow
encoderCaptureListStore = new Gtk.ListStore (typeof (EncoderCurve));
- repetitiveConditionsWin.ResetBestSetValue();
+
repetitiveConditionsWin.ResetBestSetValue(RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK);
foreach (EncoderCurve curve in encoderCaptureCurves) {
encoderCaptureListStore.AppendValues (curve);
@@ -600,7 +600,7 @@ public partial class ChronoJumpWindow
encoderAnalyzeListStore = new Gtk.ListStore (typeof (EncoderCurve));
- repetitiveConditionsWin.ResetBestSetValue();
+
repetitiveConditionsWin.ResetBestSetValue(RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK);
foreach (EncoderCurve curve in encoderAnalyzeCurves) {
encoderAnalyzeListStore.AppendValues (curve);
@@ -1066,7 +1066,9 @@ public partial class ChronoJumpWindow
if(curve.N == "MAX" || curve.N == "AVG" || curve.N == "SD")
(cell as Gtk.CellRendererText).Foreground = null; //will show default color
else {
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(curve,
Constants.MeanSpeed);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK,
+ curve, Constants.MeanSpeed);
if(myColor == "")
myColor = assignColor(
@@ -1093,7 +1095,9 @@ public partial class ChronoJumpWindow
if(curve.N == "MAX" || curve.N == "AVG" || curve.N == "SD")
(cell as Gtk.CellRendererText).Foreground = null; //will show default color
else {
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(curve,
Constants.MaxSpeed);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK,
+ curve, Constants.MaxSpeed);
if(myColor == "")
myColor = assignColor(
@@ -1128,7 +1132,9 @@ public partial class ChronoJumpWindow
if(curve.N == "MAX" || curve.N == "AVG" || curve.N == "SD")
(cell as Gtk.CellRendererText).Foreground = null; //will show default color
else {
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(curve,
Constants.MeanPower);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK,
+ curve, Constants.MeanPower);
if(myColor == "")
myColor = assignColor(
@@ -1154,7 +1160,9 @@ public partial class ChronoJumpWindow
if(curve.N == "MAX" || curve.N == "AVG" || curve.N == "SD")
(cell as Gtk.CellRendererText).Foreground = null; //will show default color
else {
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(curve,
Constants.PeakPower);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK,
+ curve, Constants.PeakPower);
if(myColor == "")
myColor = assignColor(
@@ -1197,7 +1205,9 @@ public partial class ChronoJumpWindow
if(curve.N == "MAX" || curve.N == "AVG" || curve.N == "SD")
(cell as Gtk.CellRendererText).Foreground = null; //will show default color
else {
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(curve,
Constants.MeanForce);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK,
+ curve, Constants.MeanForce);
if(myColor == "")
myColor = assignColor(
@@ -1223,7 +1233,9 @@ public partial class ChronoJumpWindow
if(curve.N == "MAX" || curve.N == "AVG" || curve.N == "SD")
(cell as Gtk.CellRendererText).Foreground = null; //will show default color
else {
- string myColor = repetitiveConditionsWin.AssignColorAutomatic(curve,
Constants.MaxForce);
+ string myColor = repetitiveConditionsWin.AssignColorAutomatic(
+ RepetitiveConditionsWindow.BestSetValueEnum.AUTOMATIC_FEEDBACK,
+ curve, Constants.MaxForce);
if(myColor == "")
myColor = assignColor(
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index a5c4917..8a05211 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -177,7 +177,9 @@ public class RepetitiveConditionsWindow
bool volumeOn;
public Preferences.GstreamerTypes gstreamer;
- private double bestSetValue;
+ public enum BestSetValueEnum { CAPTURE_MAIN_VARIABLE, AUTOMATIC_FEEDBACK}
+ private double bestSetValueCaptureMainVariable;
+ private double bestSetValueAutomaticFeedback;
static RepetitiveConditionsWindow RepetitiveConditionsWindowBox;
@@ -197,7 +199,8 @@ public class RepetitiveConditionsWindow
createComboEncoderAutomaticVariable();
- bestSetValue = 0;
+ bestSetValueCaptureMainVariable = 0;
+ bestSetValueCaptureMainVariable = 0;
notebook_encoder_conditions.CurrentPage = 3; //power
putNonStandardIcons();
@@ -529,51 +532,71 @@ public class RepetitiveConditionsWindow
checkbutton_encoder_peakpower_lower.Active = true;
}
-
- public void ResetBestSetValue() {
- bestSetValue = 0;
+ private double getBestSetValue (BestSetValueEnum b)
+ {
+ if(b == BestSetValueEnum.AUTOMATIC_FEEDBACK)
+ return bestSetValueAutomaticFeedback;
+ else // b == BestSetValueEnum.CAPTURE_MAIN_VARIABLE
+ return bestSetValueCaptureMainVariable;
+ }
+
+ public void ResetBestSetValue (BestSetValueEnum b)
+ {
+ if(b == BestSetValueEnum.AUTOMATIC_FEEDBACK)
+ bestSetValueAutomaticFeedback = 0;
+ else // b == BestSetValueEnum.CAPTURE_MAIN_VARIABLE
+ bestSetValueCaptureMainVariable = 0;
}
- public void UpdateBestSetValue(EncoderCurve curve)
+ public void UpdateBestSetValue (EncoderCurve curve)
{
+ BestSetValueEnum b = BestSetValueEnum.AUTOMATIC_FEEDBACK;
string autoVar = encoderAutomaticVariable;
if(encoderAutomaticHigher || encoderAutomaticLower)
{
if(autoVar == Constants.MeanSpeed)
- UpdateBestSetValue(curve.MeanSpeedD);
+ UpdateBestSetValue(b, curve.MeanSpeedD);
else if(autoVar == Constants.MaxSpeed)
- UpdateBestSetValue(curve.MaxSpeedD);
+ UpdateBestSetValue(b, curve.MaxSpeedD);
else if(autoVar == Constants.MeanPower)
- UpdateBestSetValue(curve.MeanPowerD);
+ UpdateBestSetValue(b, curve.MeanPowerD);
else if(autoVar == Constants.PeakPower)
- UpdateBestSetValue(curve.PeakPowerD);
+ UpdateBestSetValue(b, curve.PeakPowerD);
else if(autoVar == Constants.MeanForce)
- UpdateBestSetValue(curve.MeanForceD);
+ UpdateBestSetValue(b, curve.MeanForceD);
else if(autoVar == Constants.MaxForce)
- UpdateBestSetValue(curve.MaxForceD);
+ UpdateBestSetValue(b, curve.MaxForceD);
}
}
- public void UpdateBestSetValue(double d) {
- if(d > bestSetValue)
- bestSetValue = d;
+ public void UpdateBestSetValue(BestSetValueEnum b, double d)
+ {
+ if(b == BestSetValueEnum.AUTOMATIC_FEEDBACK)
+ {
+ if(d > bestSetValueAutomaticFeedback)
+ bestSetValueAutomaticFeedback = d;
+ } else
+ { // b == BestSetValueEnum.CAPTURE_MAIN_VARIABLE
+ if(d > bestSetValueCaptureMainVariable)
+ bestSetValueCaptureMainVariable = d;
+ }
}
//called from gui/encoderTreeviews.cs
- public string AssignColorAutomatic(EncoderCurve curve, string variable)
+ public string AssignColorAutomatic(BestSetValueEnum b, EncoderCurve curve, string variable)
{
if(encoderAutomaticVariable != variable)
return UtilGtk.ColorNothing;
double currentValue = curve.GetParameter(variable);
- return AssignColorAutomatic(currentValue);
+ return AssignColorAutomatic(b, currentValue);
}
- //called from gui/encoder.cs plotCurvesGraphDoPlot
- public string AssignColorAutomatic(double currentValue)
+ //called from previous function, gui/encoder.cs plotCurvesGraphDoPlot
+ public string AssignColorAutomatic(BestSetValueEnum b, double currentValue)
{
- if(encoderAutomaticHigher && currentValue > bestSetValue * encoderAutomaticHigherValue / 100)
+ if(encoderAutomaticHigher && currentValue > getBestSetValue(b) * encoderAutomaticHigherValue
/ 100)
return UtilGtk.ColorGood;
- else if (encoderAutomaticLower && currentValue < bestSetValue * encoderAutomaticLowerValue/
100)
+ else if (encoderAutomaticLower && currentValue < getBestSetValue(b) *
encoderAutomaticLowerValue/ 100)
return UtilGtk.ColorBad;
return UtilGtk.ColorNothing;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]