[chronojump] Inertial with cont mode. Calibration done first time.
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Inertial with cont mode. Calibration done first time.
- Date: Thu, 26 Jan 2017 17:02:08 +0000 (UTC)
commit aad74a6d26e227673cdbbb1d3e07a57e11598ce5
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jan 26 18:01:41 2017 +0100
Inertial with cont mode. Calibration done first time.
glade/app1.glade | 56 ++++++++++++++++++++++++++++++++++++++++++---
src/encoderCapture.cs | 1 +
src/gui/chronojump.cs | 4 +-
src/gui/encoder.cs | 60 +++++++++++++++++++++++++++++++++++++++++-------
4 files changed, 106 insertions(+), 15 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 66eb92a..b9f7e05 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -13851,7 +13851,6 @@ Concentric</property>
<child>
<widget class="GtkButton"
id="button_encoder_inertial_calibrate">
<property name="label"
translatable="yes">Calibrate</property>
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked"
handler="on_button_encoder_inertial_calibrate_clicked" swapped="no"/>
@@ -15462,10 +15461,9 @@ Concentric</property>
<widget class="GtkVBox" id="vbox81">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">8</property>
+ <property name="spacing">12</property>
<child>
<widget class="GtkImage"
id="image_encoder_inertial_instructions">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property
name="stock">gtk-missing-image</property>
</widget>
@@ -15477,7 +15475,6 @@ Concentric</property>
</child>
<child>
<widget class="GtkTable" id="table1">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
@@ -15578,6 +15575,54 @@ Concentric</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="label135">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Inital calibration.
Please put the inertial machine at zero position and click calibrate</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton"
id="button_encoder_inertial_calibrate_2">
+ <property name="label"
translatable="yes">Calibrate</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_encoder_inertial_calibrate_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_wait">
+ <property name="can_focus">False</property>
+ <property name="label">Please, wait 3
seconds.</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">1</property>
@@ -18629,6 +18674,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index a69a6de..b636ec9 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -162,6 +162,7 @@ public abstract class EncoderCapture
lastNonZero = 0;
//this will be used to stop encoder automatically (on !cont mode)
+ //or to save this set and wait for the next on cont mode
consecutiveZeros = -1;
consecutiveZerosMax = timeEnd * 1000;
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 73bf1d3..b756fb4 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3112,7 +3112,7 @@ public partial class ChronoJumpWindow
hbox_combo_encoder_analyze_1RM.Visible=true;
radiobutton_encoder_analyze_neuromuscular_profile.Visible = true;
}
- hbox_encoder_capture_1_or_cont.Visible = true;
+ //hbox_encoder_capture_1_or_cont.Visible = true;
hbox_encoder_inertial_calibrate.Visible = false;
label_encoder_not_menu.Text = Catalog.GetString("Gravitatory");
@@ -3139,7 +3139,7 @@ public partial class ChronoJumpWindow
radiobutton_encoder_analyze_neuromuscular_profile.Visible = false;
radio_encoder_capture_1set.Active = true;
- hbox_encoder_capture_1_or_cont.Visible = false;
+ //hbox_encoder_capture_1_or_cont.Visible = false;
hbox_encoder_inertial_calibrate.Visible = true;
label_encoder_not_menu.Text = Catalog.GetString("Inertial");
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 6373948..4883f8e 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -67,6 +67,8 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radio_encoder_capture_1set;
[Widget] Gtk.RadioButton radio_encoder_capture_cont;
[Widget] Gtk.Button button_encoder_capture;
+ [Widget] Gtk.Button button_encoder_inertial_calibrate_2;
+ [Widget] Gtk.Label label_wait;
[Widget] Gtk.Label label_encoder_not_menu;
[Widget] Gtk.Button button_gravitatory_not_menu;
@@ -623,8 +625,10 @@ public partial class ChronoJumpWindow
{
//TODO: At the moment, button_encoder_inertial_calibrate can only be sensitive while not
capturing
//check if chronopics have changed
+ /*
if(! canCaptureEncoder())
return;
+ */
/*
* if user calibrates again: put 0 value
@@ -633,7 +637,9 @@ public partial class ChronoJumpWindow
if(encoderThreadBG != null && encoderThreadBG.IsAlive)
eCaptureInertialBG.AngleNow = 0;
else
+ {
encoderThreadStart(encoderActions.CAPTURE_BG);
+ }
}
double maxPowerIntersessionOnCapture;
@@ -645,18 +651,32 @@ public partial class ChronoJumpWindow
maxPowerIntersessionOnCapture = findMaxPowerIntersession();
//LogB.Information("maxPower: " + maxPowerIntersessionOnCapture);
- //if we are not capturing on the background, check if chronopics have changed
- if( ! (encoderThreadBG != null && encoderThreadBG.IsAlive) && ! canCaptureEncoder() )
- return;
-
- // stop capturing inertial on the background if we start capturing gravitatory
- if(! encoderConfigurationCurrent.has_inertia && encoderThreadBG != null &&
encoderThreadBG.IsAlive)
+ if(encoderThreadBG != null && encoderThreadBG.IsAlive) //if we are capturing on the
background ...
{
- stopCapturingInertialBG();
+ // stop capturing on the background if we start capturing gravitatory
+ if(! encoderConfigurationCurrent.has_inertia)
+ {
+ stopCapturingInertialBG();
+ }
+ }
+ else //if we are NOT capturing on the background ...
+ {
+ //check if chronopics have changed
+ if(! canCaptureEncoder() )
+ return;
+
+ if(encoderConfigurationCurrent.has_inertia)
+ {
+ //show inertia calibrate instructions. User will click on calibrate and this
method will be called again
+
+ button_encoder_inertial_calibrate_2.Sensitive = true;
+ label_wait.Visible = false;
+ notebook_encoder_capture_or_instructions.Page = 1;
+
+ return;
+ }
}
- if(encoderConfigurationCurrent.has_inertia)
- notebook_encoder_capture_or_instructions.Page = 1; //show inertia instructions
//This notebook has capture (signal plotting), and curves (shows R graph)
if(notebook_encoder_capture.CurrentPage == 1)
@@ -4584,6 +4604,10 @@ public partial class ChronoJumpWindow
if(action == encoderActions.CAPTURE_BG)
{
+ shownWaitAtInertialCapture = false;
+ calledCaptureInertial = false;
+ timeCalibrated = DateTime.Now;
+
eCaptureInertialBG = new EncoderCaptureInertialBackground(
chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.ENCODER).Port);
encoderThreadBG = new Thread(new ThreadStart(encoderDoCaptureBG));
@@ -5029,12 +5053,30 @@ public partial class ChronoJumpWindow
}
}
+ bool shownWaitAtInertialCapture;
+ bool calledCaptureInertial;
+ DateTime timeCalibrated;
private bool pulseGTKEncoderCaptureBG ()
{
if(! encoderThreadBG.IsAlive) {
return false;
}
+ if(! shownWaitAtInertialCapture)
+ {
+ button_encoder_inertial_calibrate_2.Sensitive = false;
+ label_wait.Visible = true;
+ shownWaitAtInertialCapture = true;
+ }
+
+ if(! calledCaptureInertial && DateTime.Now.Subtract(timeCalibrated).TotalSeconds > 3)
+ {
+ //capture starts in 3 seconds
+ //System.Threading.Thread.Sleep(3000);
+ calledCaptureInertial = true;
+ on_button_encoder_capture_clicked (new object (), new EventArgs ());
+ }
+
//resize hscale if needed
int newValue = eCaptureInertialBG.AngleNow;
int lower = Convert.ToInt32(hscale_encoder_capture_inertial_angle_now.Adjustment.Lower);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]