[chronojump] DB 2.12 added: forceSensorAnalyzeMaxAVGInWindow. All working: gui, graph, SQL



commit 2e6ecac8ae1af2674ca9121d184be23493aeb4a6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Feb 15 22:34:57 2021 +0100

    DB 2.12 added: forceSensorAnalyzeMaxAVGInWindow. All working: gui, graph, SQL

 glade/app1.glade                   | 57 +++++++++++++++++++----------------
 glade/preferences_win.glade        | 62 ++++++++++++++++++++++++++++++++++++++
 src/forceSensor.cs                 |  4 +--
 src/gui/app1/chronojump.cs         |  2 ++
 src/gui/app1/forceSensor.cs        |  1 +
 src/gui/app1/forceSensorAnalyze.cs |  8 ++++-
 src/gui/preferences.cs             |  9 +++++-
 src/preferences.cs                 |  3 +-
 src/sqlite/main.cs                 | 12 ++++++--
 src/sqlite/preferences.cs          |  8 ++++-
 10 files changed, 132 insertions(+), 34 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index deae3e04..f288e897 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -24056,6 +24056,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -24241,20 +24244,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_force_sensor_ai_max_avg_in_window">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            <property name="label">Max AVG Force in 
1s</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="top_attach">3</property>
-                                                            <property name="bottom_attach">4</property>
-                                                            <property name="x_options">GTK_FILL</property>
-                                                            <property name="y_options">GTK_FILL</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_force_sensor_ai_max_avg_in_window">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -24291,6 +24280,19 @@ Concentric</property>
                                                             <property name="y_options">GTK_FILL</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_force_sensor_ai_max_avg_in_window">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="top_attach">3</property>
+                                                            <property name="bottom_attach">4</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            <property name="y_options">GTK_FILL</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -29208,18 +29210,6 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -29256,6 +29246,18 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -37565,6 +37567,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index c7dac6cc..8667b02b 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -4145,6 +4145,7 @@ It starts before and arrives there with some speed.</property>
                           <widget class="GtkNotebook" id="notebook1">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="tab_hborder">10</property>
                             <child>
                               <widget class="GtkAlignment" id="alignment21">
                                 <property name="visible">True</property>
@@ -4909,6 +4910,67 @@ It starts before and arrives there with some speed.</property>
                                                 <property name="position">2</property>
                                               </packing>
                                             </child>
+                                            <child>
+                                              <widget class="GtkHBox" id="hbox60">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="spacing">6</property>
+                                                <child>
+                                                  <widget class="GtkLabel" id="label118">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label" translatable="yes">Max average 
force in</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkSpinButton" 
id="spin_force_sensor_analyze_max_avg_force_in_window">
+                                                    <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">4</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">1 0.10000000000000001 99 
0.10000000000000001 1 0</property>
+                                                    <property name="climb_rate">1</property>
+                                                    <property name="digits">1</property>
+                                                    <property name="snap_to_ticks">True</property>
+                                                    <property name="numeric">True</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkLabel" id="label152">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label" translatable="yes">s</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">2</property>
+                                                  </packing>
+                                                </child>
+                                              </widget>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="position">3</property>
+                                              </packing>
+                                            </child>
                                           </widget>
                                         </child>
                                       </widget>
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index f7eb6a54..ff54c84d 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -2090,7 +2090,7 @@ public class ForceSensorAnalyzeInstant
        }
 
        //calculates from a range
-       public bool CalculateRangeParams(int countA, int countB)
+       public bool CalculateRangeParams(int countA, int countB, double 
forceSensorAnalyzeMaxAVGInWindowSeconds)
        {
                //countA will be the lowest and countB the highest to calcule Avg and max correctly no matter 
if B is before A
                if(countA > countB) {
@@ -2100,7 +2100,7 @@ public class ForceSensorAnalyzeInstant
                }
 
                fscAIPoints.GetAverageAndMaxForce(countA, countB, out ForceAVG, out ForceMAX);
-               fscAIPoints.GetForceMaxAvgInWindow (countA, countB, 1,
+               fscAIPoints.GetForceMaxAvgInWindow (countA, countB, forceSensorAnalyzeMaxAVGInWindowSeconds,
                                out ForceMaxAvgInWindow, out ForceMaxAvgInWindowSampleStart, out 
ForceMaxAvgInWindowSampleEnd,
                                out ForceMaxAvgInWindowError);
 
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 4780f520..6bc9e9cc 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -2886,6 +2886,8 @@ public partial class ChronoJumpWindow
 
                //TODO: only if have changed
                setForceSensorAnalyzeABSliderIncrements();
+               setForceSensorAnalyzeMaxAVGInWindow();
+
                // update force_capture_drawingarea
                if(current_menuitem_mode == Constants.Menuitem_modes.FORCESENSOR)// && 
radiobutton_force_sensor_analyze_manual.Active)
                        forceSensorDoGraphAI(false);
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index ce9b7821..a8712fa3 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -147,6 +147,7 @@ public partial class ChronoJumpWindow
                setRFDValues();
                setImpulseValue();
                setForceSensorAnalyzeABSliderIncrements();
+               setForceSensorAnalyzeMaxAVGInWindow();
        }
 
 
diff --git a/src/gui/app1/forceSensorAnalyze.cs b/src/gui/app1/forceSensorAnalyze.cs
index 5cfa99b7..150e97d9 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -152,6 +152,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_force_sensor_ai_feedback_values;
        [Widget] Gtk.Label label_force_sensor_ai_variability_cvrmssd;
        [Widget] Gtk.Label label_force_sensor_ai_variability_units;
+       [Widget] Gtk.Label label_force_sensor_ai_max_avg_in_window;
 
        [Widget] Gtk.Notebook notebook_force_sensor_export;
        [Widget] Gtk.Label label_force_sensor_export_data;
@@ -602,6 +603,11 @@ public partial class ChronoJumpWindow
                label_hscale_force_sensor_ai_b_pre_1s.Text = string.Format("{0}s", 
preferences.forceSensorAnalyzeABSliderIncrement);
                label_hscale_force_sensor_ai_b_post_1s.Text = string.Format("{0}s", 
preferences.forceSensorAnalyzeABSliderIncrement);
        }
+       private void setForceSensorAnalyzeMaxAVGInWindow()
+       {
+               label_force_sensor_ai_max_avg_in_window.Text = string.Format("Max AVG Force in {0} s",
+                               preferences.forceSensorAnalyzeMaxAVGInWindow);
+       }
 
        private void on_button_force_rfd_default_clicked (object o, EventArgs args)
        {
@@ -1956,7 +1962,7 @@ public partial class ChronoJumpWindow
                double timeB = fsAI.GetTimeMS(countB);
                double forceA = fsAI.GetForceAtCount(countA);
                double forceB = fsAI.GetForceAtCount(countB);
-               bool success = fsAI.CalculateRangeParams(countA, countB);
+               bool success = fsAI.CalculateRangeParams(countA, countB, 
preferences.forceSensorAnalyzeMaxAVGInWindow);
                if(success) {
                        label_force_sensor_ai_time_diff.Text = Math.Round(timeB - timeA, 1).ToString();
                        label_force_sensor_ai_force_diff.Text = Math.Round(forceB - forceA, 1).ToString();
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index d64d3549..b6616eb7 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -185,6 +185,7 @@ public class PreferencesWindow
        [Widget] Gtk.RadioButton radio_force_sensor_variability_old;
        [Widget] Gtk.RadioButton radio_force_sensor_variability_cvrmssd;
        [Widget] Gtk.SpinButton spin_force_sensor_analyze_ab_slider_increment;
+       [Widget] Gtk.SpinButton spin_force_sensor_analyze_max_avg_force_in_window;
 
        //runEncoder tab
        [Widget] Gtk.SpinButton spin_run_encoder_acceleration;
@@ -735,6 +736,7 @@ public class PreferencesWindow
                        PreferencesWindowBox.radio_force_sensor_variability_cvrmssd.Active = true;
 
                PreferencesWindowBox.spin_force_sensor_analyze_ab_slider_increment.Value = 
preferences.forceSensorAnalyzeABSliderIncrement;
+               PreferencesWindowBox.spin_force_sensor_analyze_max_avg_force_in_window.Value = 
preferences.forceSensorAnalyzeMaxAVGInWindow;
 
                //runEncoder -->
                PreferencesWindowBox.spin_run_encoder_acceleration.Value = preferences.runEncoderMinAccel;
@@ -2178,6 +2180,11 @@ public class PreferencesWindow
                                preferences.forceSensorAnalyzeABSliderIncrement,
                                Convert.ToDouble(spin_force_sensor_analyze_ab_slider_increment.Value));
 
+               preferences.forceSensorAnalyzeMaxAVGInWindow = Preferences.PreferencesChange(
+                               SqlitePreferences.ForceSensorAnalyzeMaxAVGInWindow,
+                               preferences.forceSensorAnalyzeMaxAVGInWindow,
+                               Convert.ToDouble(spin_force_sensor_analyze_max_avg_force_in_window.Value));
+
                //runEncoder ----
 
                preferences.runEncoderMinAccel = Preferences.PreferencesChange(
diff --git a/src/preferences.cs b/src/preferences.cs
index 6a29e085..62d18c4b 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- *  Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com> 
+ *  Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -125,6 +125,7 @@ public class Preferences
        public enum VariabilityMethodEnum { CHRONOJUMP_OLD, CVRMSSD };
        public VariabilityMethodEnum forceSensorVariabilityMethod;
        public double forceSensorAnalyzeABSliderIncrement;
+       public double forceSensorAnalyzeMaxAVGInWindow;
        public int forceSensorGraphsLineWidth;
 
        //runEncoder
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index d1ba085e..7669abef 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "2.11";
+       static string lastChronojumpDatabaseVersion = "2.12";
 
        public Sqlite()
        {
@@ -2869,7 +2869,14 @@ class Sqlite
 
                                currentVersion = updateVersion("2.11");
                        }
+                       if(currentVersion == "2.11")
+                       {
+                               LogB.SQL("Inserted into preferences: forceSensorAnalyzeMaxAVGInWindow");
+
+                               SqlitePreferences.Insert (SqlitePreferences.ForceSensorAnalyzeMaxAVGInWindow, 
"1");
 
+                               currentVersion = updateVersion("2.12");
+                       }
                        /*
                        if(currentVersion == "1.79")
                        {
@@ -3087,6 +3094,7 @@ class Sqlite
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 
 
+               //2.11 - 2.12 Converted DB to 2.12 Inserted prefs: forceSensorAnalyzeMaxAVGInWindow
                //2.10 - 2.11 Converted DB to 2.11 Inserted prefs: clientNewsDatetime
                //2.09 - 2.10 Converted DB to 2.10 Inserted prefs: encoderCaptureShowLoss, runEncoderPPS
                //2.08 - 2.09 Converted DB to 2.09 Inserted into preferences: 
forceSensorAnalyzeABSliderIncrement
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index fcdd6cd7..d856dd9c 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -102,6 +102,7 @@ class SqlitePreferences : Sqlite
        public const string ForceSensorMIFDurationSeconds = "forceSensorMIFDurationSeconds";
        public const string ForceSensorMIFDurationPercent = "forceSensorMIFDurationPercent";
        public const string ForceSensorAnalyzeABSliderIncrement = "forceSensorAnalyzeABSliderIncrement";
+       public const string ForceSensorAnalyzeMaxAVGInWindow = "forceSensorAnalyzeMaxAVGInWindow";
 
        //runEncoder
        public const string RunEncoderMinAccel = "runEncoderMinAccel";
@@ -290,6 +291,7 @@ class SqlitePreferences : Sqlite
                                Insert (ForceSensorMIFDurationSeconds, "2", dbcmdTr);
                                Insert (ForceSensorMIFDurationPercent, "5", dbcmdTr);
                                Insert (ForceSensorAnalyzeABSliderIncrement, "1", dbcmdTr);
+                               Insert (ForceSensorAnalyzeMaxAVGInWindow, "1", dbcmdTr);
 
                                //runEncoder
                                Insert (RunEncoderMinAccel, "10.0", dbcmdTr);
@@ -714,6 +716,10 @@ class SqlitePreferences : Sqlite
                                preferences.forceSensorAnalyzeABSliderIncrement = Convert.ToDouble(
                                                Util.ChangeDecimalSeparator(reader[1].ToString()));
 
+                       else if(reader[0].ToString() == ForceSensorAnalyzeMaxAVGInWindow)
+                               preferences.forceSensorAnalyzeMaxAVGInWindow = Convert.ToDouble(
+                                               Util.ChangeDecimalSeparator(reader[1].ToString()));
+
                        //runEncoder
                        else if(reader[0].ToString() == RunEncoderMinAccel)
                                preferences.runEncoderMinAccel = Convert.ToDouble(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]