[chronojump] DB: 1.85 preferences: 5 vars EncoderCapture... to record feedback vars
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] DB: 1.85 preferences: 5 vars EncoderCapture... to record feedback vars
- Date: Wed, 5 Feb 2020 16:08:38 +0000 (UTC)
commit aef4a99d5d23b57effb603565e9b438f691d68f5
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Feb 5 17:06:53 2020 +0100
DB: 1.85 preferences: 5 vars EncoderCapture... to record feedback vars
src/gui/app1/chronojump.cs | 40 +++++++++++++++++++++++++++---
src/gui/app1/icons.cs | 6 ++++-
src/gui/repetitiveConditions.cs | 55 ++++++++++++++++++++++++++++++++---------
src/preferences.cs | 12 ++++++---
src/sqlite/main.cs | 14 ++++++++++-
src/sqlite/preferences.cs | 20 +++++++++++++++
6 files changed, 126 insertions(+), 21 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index b7782ca8..04902ac2 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -629,7 +629,8 @@ public partial class ChronoJumpWindow
rand = new Random(40);
formatModeMenu();
- putNonStandardIcons();
+
+ putNonStandardIcons(preferences.encoderCaptureMainVariableGreaterActive ||
preferences.encoderCaptureMainVariableLowerActive);
eventExecutePutNonStandardIcons();
//eventExecuteCreateComboGraphResultsSize();
@@ -6954,11 +6955,13 @@ LogB.Debug("mc finished 5");
image_encoder_bell.Pixbuf = pixbuf;
+ Sqlite.Open();
+
//mainVariable
Constants.EncoderVariablesCapture mainVariable = Constants.SetEncoderVariablesCapture(
repetitiveConditionsWin.GetMainVariable);
if( preferences.encoderCaptureMainVariable != mainVariable ) {
- SqlitePreferences.Update("encoderCaptureMainVariable",
mainVariable.ToString(), false);
+ SqlitePreferences.Update("encoderCaptureMainVariable",
mainVariable.ToString(), true);
preferences.encoderCaptureMainVariable = mainVariable;
}
string mainVariableStr = Constants.GetEncoderVariablesCapture(mainVariable);
@@ -6967,7 +6970,7 @@ LogB.Debug("mc finished 5");
Constants.EncoderVariablesCapture secondaryVariable =
Constants.SetEncoderVariablesCapture(
repetitiveConditionsWin.GetSecondaryVariable);
if( preferences.encoderCaptureSecondaryVariable != secondaryVariable ) {
- SqlitePreferences.Update("encoderCaptureSecondaryVariable",
secondaryVariable.ToString(), false);
+ SqlitePreferences.Update("encoderCaptureSecondaryVariable",
secondaryVariable.ToString(), true);
preferences.encoderCaptureSecondaryVariable = secondaryVariable;
}
string secondaryVariableStr = Constants.GetEncoderVariablesCapture(secondaryVariable);
@@ -6975,12 +6978,41 @@ LogB.Debug("mc finished 5");
//secondaryVariableShow
bool secondaryVariableShow = repetitiveConditionsWin.GetSecondaryVariableShow;
if( preferences.encoderCaptureSecondaryVariableShow != secondaryVariableShow ) {
- SqlitePreferences.Update("encoderCaptureSecondaryVariableShow",
secondaryVariableShow.ToString(), false);
+ SqlitePreferences.Update("encoderCaptureSecondaryVariableShow",
secondaryVariableShow.ToString(), true);
preferences.encoderCaptureSecondaryVariableShow = secondaryVariableShow;
}
if(! secondaryVariableShow)
secondaryVariableStr = "";
+ preferences.encoderCaptureMainVariableThisSetOrHistorical =
Preferences.PreferencesChange(
+ SqlitePreferences.EncoderCaptureMainVariableThisSetOrHistorical,
+ preferences.encoderCaptureMainVariableThisSetOrHistorical,
+ repetitiveConditionsWin.EncoderRelativeToSet);
+
+ preferences.encoderCaptureMainVariableGreaterActive = Preferences.PreferencesChange(
+ SqlitePreferences.EncoderCaptureMainVariableGreaterActive,
+ preferences.encoderCaptureMainVariableGreaterActive,
+ repetitiveConditionsWin.EncoderAutomaticHigherActive);
+
+ preferences.encoderCaptureMainVariableGreaterValue = Preferences.PreferencesChange(
+ SqlitePreferences.EncoderCaptureMainVariableGreaterValue,
+ preferences.encoderCaptureMainVariableGreaterValue,
+ repetitiveConditionsWin.EncoderAutomaticHigherValue);
+
+ preferences.encoderCaptureMainVariableLowerActive = Preferences.PreferencesChange(
+ SqlitePreferences.EncoderCaptureMainVariableLowerActive,
+ preferences.encoderCaptureMainVariableLowerActive,
+ repetitiveConditionsWin.EncoderAutomaticLowerActive);
+
+ preferences.encoderCaptureMainVariableLowerValue = Preferences.PreferencesChange(
+ SqlitePreferences.EncoderCaptureMainVariableLowerValue,
+ preferences.encoderCaptureMainVariableLowerValue,
+ repetitiveConditionsWin.EncoderAutomaticLowerValue);
+
+
+ Sqlite.Close();
+
+
//treeview_encoder should be updated (to colorize some cells)
//only if there was data
//this avoids misbehaviour when bell is pressed and there's no data in treeview
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 1c1fde28..509ed8ca 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -228,7 +228,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_message_permissions_at_boot;
[Widget] Gtk.Image image_camera_at_boot;
- private void putNonStandardIcons()
+ private void putNonStandardIcons(bool encoderBellActive)
{
Pixbuf pixbuf;
@@ -600,6 +600,10 @@ public partial class ChronoJumpWindow
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_none.png");
image_contacts_bell.Pixbuf = pixbuf;
+
+ if(encoderBellActive)
+ pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_active.png");
+
image_encoder_bell.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "preferences-system.png");
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index d61f61ec..6ebb1ce4 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -204,6 +204,7 @@ public class RepetitiveConditionsWindow
public enum BestSetValueEnum { CAPTURE_MAIN_VARIABLE, AUTOMATIC_FEEDBACK}
private double bestSetValueCaptureMainVariable;
private double bestSetValueAutomaticFeedback;
+ private bool update_checkbuttons_encoder_automatic;
static RepetitiveConditionsWindow RepetitiveConditionsWindowBox;
@@ -251,9 +252,16 @@ public class RepetitiveConditionsWindow
if (RepetitiveConditionsWindowBox == null) {
RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow ();
}
+ RepetitiveConditionsWindowBox.update_checkbuttons_encoder_automatic = true;
RepetitiveConditionsWindowBox.showWidgets(bellMode,
preferences.encoderCaptureMainVariable,
preferences.encoderCaptureSecondaryVariable,
- preferences.encoderCaptureSecondaryVariableShow, encoderRhythm,
+ preferences.encoderCaptureSecondaryVariableShow,
+ preferences.encoderCaptureMainVariableThisSetOrHistorical,
+ preferences.encoderCaptureMainVariableGreaterActive,
+ preferences.encoderCaptureMainVariableGreaterValue,
+ preferences.encoderCaptureMainVariableLowerActive,
+ preferences.encoderCaptureMainVariableLowerValue,
+ encoderRhythm,
preferences.forceSensorCaptureFeedbackActive,
preferences.forceSensorCaptureFeedbackAt,
preferences.forceSensorCaptureFeedbackRange);
@@ -267,6 +275,11 @@ public class RepetitiveConditionsWindow
Constants.EncoderVariablesCapture encoderMainVariable,
Constants.EncoderVariablesCapture encoderSecondaryVariable,
bool encoderSecondaryVariableShow,
+ bool encoderCaptureMainVariableThisSetOrHistorical,
+ bool encoderCaptureMainVariableGreaterActive,
+ int encoderCaptureMainVariableGreaterValue,
+ bool encoderCaptureMainVariableLowerActive,
+ int encoderCaptureMainVariableLowerValue,
EncoderRhythm encoderRhythm,
bool forceSensorCaptureFeedbackActive,
int forceSensorCaptureFeedbackAt,
@@ -323,6 +336,20 @@ public class RepetitiveConditionsWindow
//need to do it "manually" at start
hbox_combo_encoder_secondary_variable.Visible =
check_encoder_show_secondary_variable.Active;
+ if(encoderCaptureMainVariableThisSetOrHistorical ||
+ encoderMainVariable != Constants.EncoderVariablesCapture.MeanPower)
//MeanPower is the only one who has historical
+ radio_encoder_relative_to_set.Active = true;
+ else
+ radio_encoder_relative_to_historical.Active = true;
+
+ //the change on spinbuttons here will not have to provoque changes on checkbuttons
+ update_checkbuttons_encoder_automatic = false;
+ checkbutton_encoder_automatic_greater.Active =
encoderCaptureMainVariableGreaterActive;
+ spinbutton_encoder_automatic_greater.Value = encoderCaptureMainVariableGreaterValue;
+ checkbutton_encoder_automatic_lower.Active = encoderCaptureMainVariableLowerActive;
+ spinbutton_encoder_automatic_lower.Value = encoderCaptureMainVariableLowerValue;
+ update_checkbuttons_encoder_automatic = true;
+
notebook_main.GetNthPage(RHYTHMPAGE).Show();
encoder_rhythm_set_values(encoderRhythm);
hbox_test_bells.Show();
@@ -565,11 +592,15 @@ public class RepetitiveConditionsWindow
}
- void on_spinbutton_encoder_automatic_greater_value_changed (object o, EventArgs args) {
- checkbutton_encoder_automatic_greater.Active = true;
+ void on_spinbutton_encoder_automatic_greater_value_changed (object o, EventArgs args)
+ {
+ if(update_checkbuttons_encoder_automatic)
+ checkbutton_encoder_automatic_greater.Active = true;
}
- void on_spinbutton_encoder_automatic_lower_value_changed (object o, EventArgs args) {
- checkbutton_encoder_automatic_lower.Active = true;
+ void on_spinbutton_encoder_automatic_lower_value_changed (object o, EventArgs args)
+ {
+ if(update_checkbuttons_encoder_automatic)
+ checkbutton_encoder_automatic_lower.Active = true;
}
void on_button_encoder_automatic_greater_minus_1_clicked (object o, EventArgs args)
@@ -665,7 +696,7 @@ public class RepetitiveConditionsWindow
{
BestSetValueEnum b = BestSetValueEnum.AUTOMATIC_FEEDBACK;
string encoderVar = GetMainVariable;
- if(encoderAutomaticHigher || encoderAutomaticLower)
+ if(EncoderAutomaticHigherActive || EncoderAutomaticLowerActive)
{
if(encoderVar == Constants.MeanSpeed)
UpdateBestSetValue(b, curve.MeanSpeedD);
@@ -707,9 +738,9 @@ public class RepetitiveConditionsWindow
//called from previous function, gui/encoder.cs plotCurvesGraphDoPlot
public string AssignColorAutomatic(BestSetValueEnum b, double currentValue)
{
- if(encoderAutomaticHigher && currentValue > getBestSetValue(b) * encoderAutomaticHigherValue
/ 100)
+ if(EncoderAutomaticHigherActive && currentValue > getBestSetValue(b) *
EncoderAutomaticHigherValue / 100)
return UtilGtk.ColorGood;
- else if (encoderAutomaticLower && currentValue < getBestSetValue(b) *
encoderAutomaticLowerValue/ 100)
+ else if (EncoderAutomaticLowerActive && currentValue < getBestSetValue(b) *
EncoderAutomaticLowerValue/ 100)
return UtilGtk.ColorBad;
return UtilGtk.ColorNothing;
@@ -950,16 +981,16 @@ public class RepetitiveConditionsWindow
/* ENCODER */
//automatic
- private bool encoderAutomaticHigher {
+ public bool EncoderAutomaticHigherActive {
get { return checkbutton_encoder_automatic_greater.Active; }
}
- private int encoderAutomaticHigherValue {
+ public int EncoderAutomaticHigherValue {
get { return Convert.ToInt32(spinbutton_encoder_automatic_greater.Value); }
}
- private bool encoderAutomaticLower {
+ public bool EncoderAutomaticLowerActive {
get { return checkbutton_encoder_automatic_lower.Active; }
}
- private int encoderAutomaticLowerValue {
+ public int EncoderAutomaticLowerValue {
get { return Convert.ToInt32(spinbutton_encoder_automatic_lower.Value); }
}
diff --git a/src/preferences.cs b/src/preferences.cs
index 154c88c3..c5281a55 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -59,9 +59,6 @@ public class Preferences
//encoder capture
public int encoderCaptureTime;
public int encoderCaptureInactivityEndTime; // -1 if not automatically end
- public Constants.EncoderVariablesCapture encoderCaptureMainVariable;
- public Constants.EncoderVariablesCapture encoderCaptureSecondaryVariable;
- public bool encoderCaptureSecondaryVariableShow;
public int encoderCaptureMinHeightGravitatory;
public int encoderCaptureMinHeightInertial;
public int encoderCaptureInertialDiscardFirstN;
@@ -132,6 +129,15 @@ public class Preferences
public int encoderRhythmRepsCluster;
public double encoderRhythmRestClustersSeconds;
+ public Constants.EncoderVariablesCapture encoderCaptureMainVariable;
+ public Constants.EncoderVariablesCapture encoderCaptureSecondaryVariable;
+ public bool encoderCaptureSecondaryVariableShow;
+ public bool encoderCaptureMainVariableThisSetOrHistorical;
+ public bool encoderCaptureMainVariableGreaterActive;
+ public int encoderCaptureMainVariableGreaterValue;
+ public bool encoderCaptureMainVariableLowerActive;
+ public int encoderCaptureMainVariableLowerValue;
+
//forceSensor
public string forceSensorTareDateTime;
public double forceSensorTare;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 2d26cc64..b47b93f4 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
- static string lastChronojumpDatabaseVersion = "1.84";
+ static string lastChronojumpDatabaseVersion = "1.85";
public Sqlite() {
}
@@ -2608,7 +2608,18 @@ class Sqlite
currentVersion = updateVersion("1.84");
}
+ if(currentVersion == "1.84")
+ {
+ LogB.SQL("Inserted 5 vars into preferences: EncoderCaptureMainVariable...");
+
+ SqlitePreferences.Insert
(SqlitePreferences.EncoderCaptureMainVariableThisSetOrHistorical, "True");
+ SqlitePreferences.Insert
(SqlitePreferences.EncoderCaptureMainVariableGreaterActive, "False");
+ SqlitePreferences.Insert
(SqlitePreferences.EncoderCaptureMainVariableGreaterValue, "90");
+ SqlitePreferences.Insert
(SqlitePreferences.EncoderCaptureMainVariableLowerActive, "False");
+ SqlitePreferences.Insert
(SqlitePreferences.EncoderCaptureMainVariableLowerValue, "70");
+ currentVersion = updateVersion("1.85");
+ }
/*
if(currentVersion == "1.79")
@@ -2821,6 +2832,7 @@ class Sqlite
//changes [from - to - desc]
//just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved
stiffnessString records there
//
+ //1.84 - 1.85 Converted DB to 1.85 Inserted 5 vars into preferences:
EncoderCaptureMainVariable...
//1.83 - 1.84 Converted DB to 1.84 Inserted into preferences: forceSensorMIFDuration
Mode/Seconds/Percent
//1.82 - 1.83 Converted DB to 1.83 Added missing agility_t_test image
//1.81 - 1.82 Converted DB to 1.82 Doing alter table jump, jumpRj, tempJumpRj add datetime
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index a1f69ed7..2897745b 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -52,6 +52,11 @@ class SqlitePreferences : Sqlite
public const string EncoderRhythmRestAfterEccStr = "encoderRhythmRestAfterEcc";
public const string EncoderRhythmRepsClusterStr = "encoderRhythmRepsCluster";
public const string EncoderRhythmRestClustersSecondsStr = "encoderRhythmRestClustersSeconds";
+ public const string EncoderCaptureMainVariableThisSetOrHistorical =
"encoderCaptureMainVariableThisSetOrHistorical";
+ public const string EncoderCaptureMainVariableGreaterActive =
"encoderCaptureMainVariableGreaterActive";
+ public const string EncoderCaptureMainVariableGreaterValue = "encoderCaptureMainVariableGreaterValue";
+ public const string EncoderCaptureMainVariableLowerActive = "encoderCaptureMainVariableLowerActive";
+ public const string EncoderCaptureMainVariableLowerValue = "encoderCaptureMainVariableLowerValue";
//forceSensor
public const string ForceSensorCaptureWidthSeconds = "forceSensorCaptureWidthSeconds";
@@ -150,6 +155,11 @@ class SqlitePreferences : Sqlite
Insert ("encoderCaptureMainVariable",
Constants.EncoderVariablesCapture.MeanPower.ToString(), dbcmdTr);
Insert ("encoderCaptureSecondaryVariable",
Constants.EncoderVariablesCapture.RangeAbsolute.ToString(), dbcmdTr);
Insert ("encoderCaptureSecondaryVariableShow", "True", dbcmdTr);
+ Insert (EncoderCaptureMainVariableThisSetOrHistorical, "True", dbcmdTr);
+ Insert (EncoderCaptureMainVariableGreaterActive, "False", dbcmdTr);
+ Insert (EncoderCaptureMainVariableGreaterValue, "90", dbcmdTr);
+ Insert (EncoderCaptureMainVariableLowerActive, "False", dbcmdTr);
+ Insert (EncoderCaptureMainVariableLowerValue, "70", dbcmdTr);
Insert ("encoderCaptureMinHeightGravitatory", "20", dbcmdTr);
Insert ("encoderCaptureMinHeightInertial", "5", dbcmdTr);
Insert ("encoderCaptureInertialDiscardFirstN", "3", dbcmdTr);
@@ -370,6 +380,16 @@ class SqlitePreferences : Sqlite
Enum.Parse(typeof(Constants.EncoderVariablesCapture),
reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureSecondaryVariableShow")
preferences.encoderCaptureSecondaryVariableShow = reader[1].ToString() ==
"True";
+ else if(reader[0].ToString() == EncoderCaptureMainVariableThisSetOrHistorical)
+ preferences.encoderCaptureMainVariableThisSetOrHistorical =
reader[1].ToString() == "True";
+ else if(reader[0].ToString() == EncoderCaptureMainVariableGreaterActive)
+ preferences.encoderCaptureMainVariableGreaterActive = reader[1].ToString() ==
"True";
+ else if(reader[0].ToString() == EncoderCaptureMainVariableGreaterValue)
+ preferences.encoderCaptureMainVariableGreaterValue =
Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == EncoderCaptureMainVariableLowerActive)
+ preferences.encoderCaptureMainVariableLowerActive = reader[1].ToString() ==
"True";
+ else if(reader[0].ToString() == EncoderCaptureMainVariableLowerValue)
+ preferences.encoderCaptureMainVariableLowerValue =
Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureMinHeightGravitatory")
preferences.encoderCaptureMinHeightGravitatory =
Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureMinHeightInertial")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]