[chronojump] While encoder capture, showOnlyBars modes can change. Solving null encoderGraphDoPlot.
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] While encoder capture, showOnlyBars modes can change. Solving null encoderGraphDoPlot.
- Date: Tue, 20 Jul 2021 14:42:39 +0000 (UTC)
commit 3511cb803920423b327ff217b0445e617de6d28f
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jul 20 16:42:01 2021 +0200
While encoder capture, showOnlyBars modes can change. Solving null encoderGraphDoPlot.
src/config.cs | 5 +--
src/encoderCapture.cs | 3 +-
src/gui/app1/chronojump.cs | 32 +++++++-------
src/gui/app1/encoder.cs | 102 +++++++++++++++++++++++++--------------------
src/gui/networks.cs | 1 -
5 files changed, 78 insertions(+), 65 deletions(-)
---
diff --git a/src/config.cs b/src/config.cs
index 8dd2b9c34..b4811bf65 100644
--- a/src/config.cs
+++ b/src/config.cs
@@ -36,9 +36,8 @@ public class Config
//public bool UseVideo;
public bool OnlyEncoderGravitatory;
public bool OnlyEncoderInertial;
- public bool EncoderCaptureShowOnlyBars;
- public bool EncoderUpdateTreeViewWhileCapturing; //recomended: false. Make it false if
EncoderCaptureShowOnlyBars == true
- //because treeview will be in 2n page of notebook
+ public EncoderCaptureDisplay EncoderCaptureShowOnlyBars;
+ public bool EncoderUpdateTreeViewWhileCapturing = true; //user can change the 3 show checkboxes, so
have it true to be updated
public bool PersonWinHide;
public bool EncoderAnalyzeHide;
public SessionModeEnum SessionMode;
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index 593f86aab..181524aa4 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -94,7 +94,7 @@ public abstract class EncoderCapture
private Random rand;
protected bool finish;
protected bool capturingInertialBG;
- protected bool showOnlyBars;
+ protected bool showOnlyBars; //only false on inertia moment calculation
//get the moment where we cross 0 first time on inertial calibrated
//signal will be saved from here
@@ -433,7 +433,6 @@ public abstract class EncoderCapture
if(! showOnlyBars)
{
assignEncoderCapturePoints();
-
EncoderCapturePointsCaptured = i;
}
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 43c9cb16c..dc00cc6b5 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -7425,20 +7425,24 @@ LogB.Debug("mc finished 5");
double mainVariableHigher =
repetitiveConditionsWin.GetMainVariableHigher(mainVariableStr);
double mainVariableLower =
repetitiveConditionsWin.GetMainVariableLower(mainVariableStr);
//plotCurvesGraphDoPlot(mainVariableStr, mainVariableHigher,
mainVariableLower,
- encoderGraphDoPlot.NewPreferences(preferences);
- encoderGraphDoPlot.Start(
- mainVariableStr, mainVariableHigher,
mainVariableLower,
- secondaryVariableStr,
preferences.encoderCaptureShowLoss,
- false,
- findEccon(true),
- repetitiveConditionsWin,
- encoderConfigurationCurrent.has_inertia,
- configChronojump.PlaySoundsFromFile,
- captureCurvesBarsData,
- encoderCaptureListStore,
-
preferences.encoderCaptureMainVariableThisSetOrHistorical,
- sendMaxPowerSpeedForceIntersession(mainVariable),
- sendMaxPowerSpeedForceIntersessionDate(mainVariable));
+
+ if(encoderGraphDoPlot != null)
+ {
+ encoderGraphDoPlot.NewPreferences(preferences);
+ encoderGraphDoPlot.Start(
+ mainVariableStr, mainVariableHigher,
mainVariableLower,
+ secondaryVariableStr,
preferences.encoderCaptureShowLoss,
+ false,
+ findEccon(true),
+ repetitiveConditionsWin,
+ encoderConfigurationCurrent.has_inertia,
+ configChronojump.PlaySoundsFromFile,
+ captureCurvesBarsData,
+ encoderCaptureListStore,
+
preferences.encoderCaptureMainVariableThisSetOrHistorical,
+
sendMaxPowerSpeedForceIntersession(mainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(mainVariable));
+ }
} else
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea,
encoder_capture_curves_bars_pixmap);
}
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 42f8f02eb..7dc5d93f4 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -1390,7 +1390,8 @@ public partial class ChronoJumpWindow
if(preferences.encoderCaptureInfinite)
removeSignalFromGuiBecauseDeletedOrCancelled();
- if(configChronojump.EncoderCaptureShowOnlyBars && !
preferences.encoderCaptureInfinite)
+ if(//configChronojump.EncoderCaptureShowOnlyBars &&
+ ! preferences.encoderCaptureInfinite)
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, no repetitions matched your
criteria."));
}
@@ -5831,19 +5832,21 @@ public partial class ChronoJumpWindow
secondaryVariable = "";
double mainVariableHigher =
repetitiveConditionsWin.GetMainVariableHigher(mainVariable);
double mainVariableLower = repetitiveConditionsWin.GetMainVariableLower(mainVariable);
- encoderGraphDoPlot.Start(
- mainVariable, mainVariableHigher, mainVariableLower,
- secondaryVariable, preferences.encoderCaptureShowLoss,
- false, //not capturing
- findEccon(true),
- repetitiveConditionsWin,
- encoderConfigurationCurrent.has_inertia,
- configChronojump.PlaySoundsFromFile,
- captureCurvesBarsData,
- encoderCaptureListStore,
- preferences.encoderCaptureMainVariableThisSetOrHistorical,
-
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
-
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
+
+ if(encoderGraphDoPlot != null)
+ encoderGraphDoPlot.Start(
+ mainVariable, mainVariableHigher, mainVariableLower,
+ secondaryVariable, preferences.encoderCaptureShowLoss,
+ false, //not capturing
+ findEccon(true),
+ repetitiveConditionsWin,
+ encoderConfigurationCurrent.has_inertia,
+ configChronojump.PlaySoundsFromFile,
+ captureCurvesBarsData,
+ encoderCaptureListStore,
+ preferences.encoderCaptureMainVariableThisSetOrHistorical,
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
}
}
@@ -6072,7 +6075,8 @@ public partial class ChronoJumpWindow
//on continuous mode do not erase bars at beginning of capture in order to see last
bars
if(action == encoderActions.CAPTURE && preferences.encoderCaptureInfinite) {
prepareEncoderGraphs(false, true); //bars, signal
- encoderGraphDoPlot.ShowMessage("Previous set", true, false);
+ if(encoderGraphDoPlot != null)
+ encoderGraphDoPlot.ShowMessage("Previous set", true, false);
} else
prepareEncoderGraphs(true, true);
@@ -6093,7 +6097,8 @@ public partial class ChronoJumpWindow
if(encoder_capture_curves_bars_pixmap != null)
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea,
encoder_capture_curves_bars_pixmap);
- encoderGraphDoPlot.ShowMessage(Catalog.GetString("Capturing") + " …", false,
true);
+ if(encoderGraphDoPlot != null)
+ encoderGraphDoPlot.ShowMessage(Catalog.GetString("Capturing") + " …",
false, true);
encoderCaptureStringR = new List<string>();
encoderCaptureStringR.Add(
@@ -6143,7 +6148,8 @@ public partial class ChronoJumpWindow
findEccon(true),
portName,
(encoderConfigurationCurrent.has_inertia &&
eCaptureInertialBG != null),
- configChronojump.EncoderCaptureShowOnlyBars,
+ //configChronojump.EncoderCaptureShowOnlyBars,
+ false, //false to show all, and let user change this at any
moment
currentSession.Name == Constants.SessionSimulatedName &&
testsActive);
if(! success)
{
@@ -6708,20 +6714,23 @@ public partial class ChronoJumpWindow
//captureCurvesBarsData.Add(new EncoderBarsData(meanSpeed, maxSpeed,
meanPower, peakPower));
//captureCurvesBarsData.Add(new EncoderBarsData(20, 39, 10, 40));
- encoderGraphDoPlot.NewPreferences(preferences);
- encoderGraphDoPlot.Start(
- mainVariable, mainVariableHigher, mainVariableLower,
- secondaryVariable, preferences.encoderCaptureShowLoss,
- true, //capturing
- findEccon(true),
- repetitiveConditionsWin,
- encoderConfigurationCurrent.has_inertia,
- configChronojump.PlaySoundsFromFile,
- captureCurvesBarsData,
- encoderCaptureListStore,
- preferences.encoderCaptureMainVariableThisSetOrHistorical,
-
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
-
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
+ if(encoderGraphDoPlot != null)
+ {
+ encoderGraphDoPlot.NewPreferences(preferences);
+ encoderGraphDoPlot.Start(
+ mainVariable, mainVariableHigher, mainVariableLower,
+ secondaryVariable, preferences.encoderCaptureShowLoss,
+ true, //capturing
+ findEccon(true),
+ repetitiveConditionsWin,
+ encoderConfigurationCurrent.has_inertia,
+ configChronojump.PlaySoundsFromFile,
+ captureCurvesBarsData,
+ encoderCaptureListStore,
+
preferences.encoderCaptureMainVariableThisSetOrHistorical,
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
+ }
//}
needToRefreshTreeviewCapture = false;
@@ -7211,20 +7220,23 @@ public partial class ChronoJumpWindow
findMaxPowerSpeedForceIntersession();
- encoderGraphDoPlot.NewPreferences(preferences);
- encoderGraphDoPlot.Start(
- mainVariable, mainVariableHigher, mainVariableLower,
- secondaryVariable, preferences.encoderCaptureShowLoss,
- false, //not capturing
- findEccon(true),
- repetitiveConditionsWin,
- encoderConfigurationCurrent.has_inertia,
- configChronojump.PlaySoundsFromFile,
- captureCurvesBarsData,
- encoderCaptureListStore,
- preferences.encoderCaptureMainVariableThisSetOrHistorical,
-
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
-
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
+ if(encoderGraphDoPlot != null)
+ {
+ encoderGraphDoPlot.NewPreferences(preferences);
+ encoderGraphDoPlot.Start(
+ mainVariable, mainVariableHigher, mainVariableLower,
+ secondaryVariable, preferences.encoderCaptureShowLoss,
+ false, //not capturing
+ findEccon(true),
+ repetitiveConditionsWin,
+ encoderConfigurationCurrent.has_inertia,
+ configChronojump.PlaySoundsFromFile,
+ captureCurvesBarsData,
+ encoderCaptureListStore,
+
preferences.encoderCaptureMainVariableThisSetOrHistorical,
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
+ }
button_encoder_signal_save_comment.Label = Catalog.GetString("Save comment");
button_encoder_signal_save_comment.Sensitive = false;
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 6727b9c6d..a4aadfa7c 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -362,7 +362,6 @@ public partial class ChronoJumpWindow
configChronojump.Maximized = preferences.maximized;
configChronojump.PersonWinHide = preferences.personWinHide;
configChronojump.EncoderCaptureShowOnlyBars = preferences.encoderCaptureShowOnlyBars;
- configChronojump.EncoderUpdateTreeViewWhileCapturing = !
preferences.encoderCaptureShowOnlyBars;
configDo();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]