Commit bb82d88d authored by Xavier de Blas's avatar Xavier de Blas

DB: 1.63 encoderCaptureInertialDiscardFirstN on preferences

parent bc18dff4
......@@ -1866,7 +1866,7 @@ It starts before and arrives there with some speed.</property>
<widget class="GtkHBox" id="hbox23">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">20</property>
<property name="spacing">16</property>
<child>
<widget class="GtkLabel" id="label64">
<property name="visible">True</property>
......@@ -1937,6 +1937,82 @@ It starts before and arrives there with some speed.</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox32">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">16</property>
<child>
<widget class="GtkCheckButton" id="checkbutton_encoder_capture_inertial_discard_first_n">
<property name="label" translatable="yes">On inertial discard first repetitions</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_checkbutton_encoder_capture_inertial_discard_first_n_toggled" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox_encoder_capture_inertial_discard_first_n">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<child>
<widget class="GtkSpinButton" id="spin_encoder_capture_inertial_discard_first_n">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Minimal height</property>
<property name="invisible_char"></property>
<property name="width_chars">1</property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<property name="adjustment">3 1 9 1 10 0</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label79">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Recommended: 3</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
......
......@@ -3472,21 +3472,6 @@
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_inertial_discard_first_three">
<property name="label" translatable="yes">On inertial discard first three repetitions.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
......
......@@ -6940,7 +6940,7 @@ LogB.Debug("mc finished 5");
double mainVariableHigher = repetitiveConditionsWin.GetMainVariableHigher(mainVariableStr);
double mainVariableLower = repetitiveConditionsWin.GetMainVariableLower(mainVariableStr);
plotCurvesGraphDoPlot(mainVariableStr, mainVariableHigher, mainVariableLower, captureCurvesBarsData,
repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
preferences.encoderCaptureInertialDiscardFirstN,
false); //not capturing
} else
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, encoder_capture_curves_bars_pixmap);
......
......@@ -5072,7 +5072,7 @@ public partial class ChronoJumpWindow
//if we are capturing, play sounds
void plotCurvesGraphDoPlot(string mainVariable, double mainVariableHigher, double mainVariableLower,
ArrayList data6Variables, bool discardFirstThree, bool capturing)
ArrayList data6Variables, int discardFirstN, bool capturing)
{
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, encoder_capture_curves_bars_pixmap);
......@@ -5114,12 +5114,8 @@ public partial class ChronoJumpWindow
if(d < minThisSet)
minThisSet = d;
if(
encoderConfigurationCurrent.has_inertia && count == 0
||
( encoderConfigurationCurrent.has_inertia && discardFirstThree &&
((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
)
if( encoderConfigurationCurrent.has_inertia && discardFirstN > 0 &&
((eccon == "c" && count < discardFirstN) || (eccon != "c" && count < discardFirstN * 2)) )
LogB.Information("Discarded phase");
else {
countValid ++;
......@@ -5299,12 +5295,10 @@ public partial class ChronoJumpWindow
bool discarded = false;
if(encoderConfigurationCurrent.has_inertia) {
if(eccon == "c" && discardFirstThree && count < 3)
if(eccon == "c" && discardFirstN > 0 && count < discardFirstN)
discarded = true;
else if(eccon != "c" && discardFirstThree && count < 6)
else if(eccon != "c" && discardFirstN > 0 && count < discardFirstN * 2)
discarded = true;
else if ((eccon == "ec" || eccon == "ecS") && count == 0)
discarded = true; //on inertial devices "ec" or "ecS", the first ecc cannot have feedback
}
if( ! discarded && ( myColor == UtilGtk.ColorGood || (mainVariableHigher != -1 && d >= mainVariableHigher) ) )
......@@ -5335,12 +5329,9 @@ public partial class ChronoJumpWindow
if (eccon == "ec" || eccon == "ecS") {
bool isEven = Util.IsEven(count +1);
//on inertial devices "ec" or "ecS", the first ecc has to be gray
if(encoderConfigurationCurrent.has_inertia && count == 0)
my_pen = pen_gray;
//on inertial if discard first three, they have to be gray
else if( encoderConfigurationCurrent.has_inertia && discardFirstThree &&
((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
//on inertial if discardFirstN , they have to be gray
if( encoderConfigurationCurrent.has_inertia && discardFirstN > 0 &&
((eccon == "c" && count < discardFirstN) || (eccon != "c" && count < discardFirstN * 2)) )
my_pen = pen_gray;
else {
if(isEven) //par, concentric
......@@ -5349,8 +5340,8 @@ public partial class ChronoJumpWindow
my_pen = my_pen_ecc_con_e;
}
} else {
if( encoderConfigurationCurrent.has_inertia && discardFirstThree &&
((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
if( encoderConfigurationCurrent.has_inertia && discardFirstN > 0 &&
((eccon == "c" && count < discardFirstN) || (eccon != "c" && count < discardFirstN * 2)) )
my_pen = pen_gray;
else
my_pen = my_pen_con;
......@@ -5451,6 +5442,9 @@ public partial class ChronoJumpWindow
units = "W";
decimals = 1;
}
//LogB.Information(string.Format("sumValid: {0}, countValid: {1}, div: {2}", sumValid, countValid, sumValid / countValid));
//LogB.Information(string.Format("sumSaved: {0}, countSaved: {1}, div: {2}", sumSaved, countSaved, sumSaved / countSaved));
//add avg and avg of saved values
string title = mainVariable + " [X = " +
......@@ -5513,7 +5507,7 @@ public partial class ChronoJumpWindow
double mainVariableHigher = repetitiveConditionsWin.GetMainVariableHigher(mainVariable);
double mainVariableLower = repetitiveConditionsWin.GetMainVariableLower(mainVariable);
plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower, captureCurvesBarsData,
repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
preferences.encoderCaptureInertialDiscardFirstN,
false); //not capturing
} else if( ! ( radio_encoder_capture_cont.Active && ! firstSetOfCont) )
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, encoder_capture_curves_bars_pixmap);
......@@ -6384,7 +6378,7 @@ public partial class ChronoJumpWindow
//captureCurvesBarsData.Add(new EncoderBarsData(20, 39, 10, 40));
plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower, captureCurvesBarsData,
repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
preferences.encoderCaptureInertialDiscardFirstN,
true); //capturing
//}
......@@ -6894,7 +6888,7 @@ public partial class ChronoJumpWindow
maxPowerIntersession = findMaxPowerIntersession();
plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower, captureCurvesBarsData,
repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
preferences.encoderCaptureInertialDiscardFirstN,
false); //not capturing
button_encoder_signal_save_comment.Label = Catalog.GetString("Save comment");
......
......@@ -107,6 +107,9 @@ public class PreferencesWindow
[Widget] Gtk.VBox vbox_encoder_inertial; //change Visible param to not have a vertical big first page with only one row of info
[Widget] Gtk.SpinButton spin_encoder_capture_min_height_gravitatory;
[Widget] Gtk.SpinButton spin_encoder_capture_min_height_inertial;
[Widget] Gtk.CheckButton checkbutton_encoder_capture_inertial_discard_first_n;
[Widget] Gtk.HBox hbox_encoder_capture_inertial_discard_first_n;
[Widget] Gtk.SpinButton spin_encoder_capture_inertial_discard_first_n;
[Widget] Gtk.CheckButton check_appearance_encoder_only_bars;
[Widget] Gtk.HBox hbox_restart;
[Widget] Gtk.SpinButton spin_encoder_capture_show_only_some_bars;
......@@ -459,7 +462,17 @@ public class PreferencesWindow
PreferencesWindowBox.spin_encoder_capture_min_height_gravitatory.Value = preferences.encoderCaptureMinHeightGravitatory;
PreferencesWindowBox.spin_encoder_capture_min_height_inertial.Value = preferences.encoderCaptureMinHeightInertial;
if(preferences.encoderCaptureInertialDiscardFirstN > 0) {
PreferencesWindowBox.checkbutton_encoder_capture_inertial_discard_first_n.Active = true;
PreferencesWindowBox.spin_encoder_capture_inertial_discard_first_n.Value = preferences.encoderCaptureInertialDiscardFirstN;
PreferencesWindowBox.hbox_encoder_capture_inertial_discard_first_n.Visible = true;
} else {
PreferencesWindowBox.checkbutton_encoder_capture_inertial_discard_first_n.Active = false;
PreferencesWindowBox.spin_encoder_capture_inertial_discard_first_n.Value = 3;
PreferencesWindowBox.hbox_encoder_capture_inertial_discard_first_n.Visible = false;
}
if(preferences.encoderCaptureShowOnlyBars)
PreferencesWindowBox.check_appearance_encoder_only_bars.Active = true;
else
......@@ -684,6 +697,11 @@ public class PreferencesWindow
hbox_restart.Visible = ! check_appearance_encoder_only_bars.Active;
}
private void on_checkbutton_encoder_capture_inertial_discard_first_n_toggled (object obj, EventArgs args)
{
hbox_encoder_capture_inertial_discard_first_n.Visible = (checkbutton_encoder_capture_inertial_discard_first_n.Active);
}
// ---- multimedia stuff
......@@ -1416,6 +1434,15 @@ public class PreferencesWindow
preferences.encoderCaptureMinHeightInertial,
(int) PreferencesWindowBox.spin_encoder_capture_min_height_inertial.Value);
int spinEncoderCaptureDiscardFirstN = Convert.ToInt32(PreferencesWindowBox.spin_encoder_capture_inertial_discard_first_n.Value);
if(! checkbutton_encoder_capture_inertial_discard_first_n.Active)
spinEncoderCaptureDiscardFirstN = 0;
if(spinEncoderCaptureDiscardFirstN != preferences.encoderCaptureInertialDiscardFirstN)
{
SqlitePreferences.Update("encoderCaptureInertialDiscardFirstN", spinEncoderCaptureDiscardFirstN.ToString(), true);
preferences.encoderCaptureInertialDiscardFirstN = spinEncoderCaptureDiscardFirstN;
}
if( preferences.encoderCaptureShowOnlyBars != PreferencesWindowBox.check_appearance_encoder_only_bars.Active ) {
SqlitePreferences.Update("encoderCaptureShowOnlyBars", PreferencesWindowBox.check_appearance_encoder_only_bars.Active.ToString(), true);
preferences.encoderCaptureShowOnlyBars = PreferencesWindowBox.check_appearance_encoder_only_bars.Active;
......
......@@ -114,7 +114,6 @@ public class RepetitiveConditionsWindow
[Widget] Gtk.SpinButton spinbutton_encoder_peakpower_higher;
[Widget] Gtk.SpinButton spinbutton_encoder_power_lower;
[Widget] Gtk.SpinButton spinbutton_encoder_peakpower_lower;
[Widget] Gtk.CheckButton checkbutton_inertial_discard_first_three;
[Widget] Gtk.Button button_test_good;
......@@ -257,7 +256,6 @@ public class RepetitiveConditionsWindow
frame_encoder_automatic_conditions.Hide();
vbox_encoder_manual.Hide();
notebook_encoder_conditions.Hide();
checkbutton_inertial_discard_first_three.Hide();
vbox_encoder_stuff.Hide();
notebook_main.GetNthPage(RHYTHMPAGE).Hide();
......@@ -282,9 +280,6 @@ public class RepetitiveConditionsWindow
if(checkbutton_encoder_show_manual_feedback.Active)
notebook_encoder_conditions.Show();
if(bellMode == Constants.BellModes.ENCODERINERTIAL)
checkbutton_inertial_discard_first_three.Show();
combo_encoder_main_variable.Active = UtilGtk.ComboMakeActive(combo_encoder_main_variable,
Constants.GetEncoderVariablesCapture(encoderMainVariable));
......@@ -1018,10 +1013,5 @@ public class RepetitiveConditionsWindow
public int EncoderPeakPowerLowerValue {
get { return Convert.ToInt32(spinbutton_encoder_peakpower_lower.Value); }
}
public bool EncoderInertialDiscardFirstThree {
get { return checkbutton_inertial_discard_first_three.Active; }
}
}
......@@ -61,6 +61,7 @@ public class Preferences
public Constants.EncoderVariablesCapture encoderCaptureMainVariable;
public int encoderCaptureMinHeightGravitatory;
public int encoderCaptureMinHeightInertial;
public int encoderCaptureInertialDiscardFirstN;
public bool encoderCaptureCheckFullyExtended;
public int encoderCaptureCheckFullyExtendedValue;
public Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
......
......@@ -125,7 +125,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
static string lastChronojumpDatabaseVersion = "1.62";
static string lastChronojumpDatabaseVersion = "1.63";
public Sqlite() {
}
......@@ -2387,6 +2387,14 @@ class Sqlite
currentVersion = updateVersion("1.62");
}
if(currentVersion == "1.62")
{
LogB.SQL("Added to preferences: encoderCaptureInertialDiscardFirstN");
SqlitePreferences.Insert ("encoderCaptureInertialDiscardFirstN", "3");
currentVersion = updateVersion("1.63");
}
......@@ -2576,6 +2584,9 @@ class Sqlite
SqliteJson.createTableUploadExhibitionTestTemp ();
//changes [from - to - desc]
//1.62 - 1.63 Converted DB to 1.63 Added to preferences: encoderCaptureInertialDiscardFirstN
//1.61 - 1.62 Converted DB to 1.62 Added to preferences: videoStopAfter
//1.60 - 1.61 Converted DB to 1.61 Added to preferences: videoDeviceResolution, videoDeviceFramerate
//1.59 - 1.60 Converted DB to 1.60 Created table UploadExhibitionTestTemp
//1.58 - 1.59 Converted DB to 1.59 Created ForceSensorExercise
//1.57 - 1.58 Converted DB to 1.58 Added to preferences: encoderCaptureShowNRepetitions
......
......@@ -127,6 +127,7 @@ class SqlitePreferences : Sqlite
Insert ("encoderCaptureMainVariable", Constants.EncoderVariablesCapture.MeanPower.ToString(), dbcmdTr);
Insert ("encoderCaptureMinHeightGravitatory", "20", dbcmdTr);
Insert ("encoderCaptureMinHeightInertial", "5", dbcmdTr);
Insert ("encoderCaptureInertialDiscardFirstN", "3", dbcmdTr);
Insert ("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
Insert ("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
Insert ("encoderCaptureBarplotFontSize", "14", dbcmdTr);
......@@ -320,6 +321,8 @@ class SqlitePreferences : Sqlite
preferences.encoderCaptureMinHeightGravitatory = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureMinHeightInertial")
preferences.encoderCaptureMinHeightInertial = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureInertialDiscardFirstN")
preferences.encoderCaptureInertialDiscardFirstN = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureCheckFullyExtended")
preferences.encoderCaptureCheckFullyExtended = reader[1].ToString() == "True";
else if(reader[0].ToString() == "encoderCaptureCheckFullyExtendedValue")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment