[chronojump] ForceSensor binary capture boolean



commit 219db0a3ba8490859e62ac58b7cf9d5ac26afe77
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jan 7 13:24:11 2019 +0100

    ForceSensor binary capture boolean

 glade/app1.glade       | 61 +++++++++++++++++++++-----------------------------
 src/forcePlatform.cs   |  2 +-
 src/gui/chronojump.cs  | 13 +++++++++++
 src/gui/forceSensor.cs | 13 ++++++-----
 4 files changed, 47 insertions(+), 42 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index b1863ffe..8ecefabc 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1805,6 +1805,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -5923,6 +5926,19 @@ EncoderInertialCapture</property>
                                                             <property name="position">2</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkCheckButton" 
id="check_force_sensor_capture_binary">
+                                                            <property name="label">Binary</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</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>
                                                         </child>
                                                       </widget>
@@ -19212,42 +19228,6 @@ Concentric</property>
                                                             <placeholder/>
                                                             </child>
                                                             <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_force_sensor_ai_rfd_a">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -19550,6 +19530,9 @@ Concentric</property>
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkCheckButton" 
id="checkbutton_force_sensor_ai_b">
                                                             <property name="width_request">30</property>
                                                             <property name="visible">True</property>
@@ -19650,6 +19633,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -27919,6 +27905,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/forcePlatform.cs b/src/forcePlatform.cs
index fc99e5ac..49ab5109 100644
--- a/src/forcePlatform.cs
+++ b/src/forcePlatform.cs
@@ -141,7 +141,7 @@ public class ForcePlatform
                                Math.Pow(256,1) * t1 +
                                Math.Pow(256,0) * t0));
 
-               //read data, four sensors, 1 byte each
+               //read data, four sensors, 2 bytes each
                for(int i = 0; i < 4; i ++)
                {
                        int b0 = sp.ReadByte(); //least significative
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index c83b89dd..f6478e7c 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -345,6 +345,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_activate_chronopics;
        [Widget] Gtk.Button button_threshold;
        [Widget] Gtk.Button button_force_sensor_adjust;
+       [Widget] Gtk.CheckButton check_force_sensor_capture_binary;
 
        //non standard icons    
        [Widget] Gtk.Image image_jump_reactive_bell;
@@ -3198,6 +3199,7 @@ public partial class ChronoJumpWindow
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
                        button_threshold.Visible = true;
                        button_force_sensor_adjust.Visible = false;
+                       check_force_sensor_capture_binary.Visible = false;
                        if(m == Constants.Menuitem_modes.JUMPSSIMPLE) 
                        {
                                notebooks_change(m);
@@ -3228,6 +3230,7 @@ public partial class ChronoJumpWindow
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
                        button_threshold.Visible = true;
                        button_force_sensor_adjust.Visible = false;
+                       check_force_sensor_capture_binary.Visible = false;
                        button_inspect_last_test.Visible = true;
 
                        if(m == Constants.Menuitem_modes.RUNSSIMPLE) 
@@ -3368,6 +3371,7 @@ public partial class ChronoJumpWindow
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
                        button_threshold.Visible = false;
                        button_force_sensor_adjust.Visible = true;
+                       check_force_sensor_capture_binary.Visible = true;
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
                        hbox_results_legend.Visible = false;
 
@@ -3386,6 +3390,7 @@ public partial class ChronoJumpWindow
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
                        button_threshold.Visible = false;
                        button_force_sensor_adjust.Visible = false;
+                       check_force_sensor_capture_binary.Visible = false;
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
                        hbox_results_legend.Visible = false;
 
@@ -3407,6 +3412,7 @@ public partial class ChronoJumpWindow
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
                        button_threshold.Visible = true;
                        button_force_sensor_adjust.Visible = false;
+                       check_force_sensor_capture_binary.Visible = false;
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
                }
                else {  //m == Constants.Menuitem_modes.OTHER (contacts / other)
@@ -3420,6 +3426,7 @@ public partial class ChronoJumpWindow
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
                        button_threshold.Visible = true;
                        button_force_sensor_adjust.Visible = false;
+                       check_force_sensor_capture_binary.Visible = false;
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
                }
 
@@ -7547,6 +7554,7 @@ LogB.Debug("mc finished 5");
                vbox_execute_test.Sensitive = false;
                button_execute_test.Sensitive = false;
                button_force_sensor_adjust.Sensitive = false;
+               check_force_sensor_capture_binary.Sensitive = false;
 
                encoderButtonsSensitive(encoderSensEnum.NOSESSION);
                
@@ -7567,6 +7575,7 @@ LogB.Debug("mc finished 5");
                button_contacts_person_change.Sensitive = true;
                button_encoder_person_change.Sensitive = true;
                button_force_sensor_adjust.Sensitive = false;
+               check_force_sensor_capture_binary.Sensitive = false;
                
                menuSessionSensitive(true);
                vbox_stats.Sensitive = true;
@@ -7594,6 +7603,7 @@ LogB.Debug("mc finished 5");
                menuPersonSelectedSensitive(false);
                vbox_execute_test.Sensitive = false;
                button_force_sensor_adjust.Sensitive = false;
+               check_force_sensor_capture_binary.Sensitive = false;
 
                label_top_person_name.Text = "";
                label_top_encoder_person_name.Text = "";
@@ -7629,6 +7639,7 @@ LogB.Debug("mc finished 5");
                combo_result_runs_interval.Sensitive = true;
                combo_pulses.Sensitive = true;
                button_force_sensor_adjust.Sensitive = true;
+               check_force_sensor_capture_binary.Sensitive = true;
                
                vbox_execute_test.Sensitive = true;
        }
@@ -7691,6 +7702,7 @@ LogB.Debug("mc finished 5");
                button_activate_chronopics.Sensitive = false;
                button_threshold.Sensitive = false;
                button_force_sensor_adjust.Sensitive = false;
+               check_force_sensor_capture_binary.Sensitive = false;
                button_auto_start.Sensitive = false;
                notebook_options_top.Sensitive = false;
                event_execute_button_update.Sensitive = false;
@@ -7756,6 +7768,7 @@ LogB.Debug("mc finished 5");
                button_activate_chronopics.Sensitive = true;
                button_threshold.Sensitive = true;
                button_force_sensor_adjust.Sensitive = true;
+               check_force_sensor_capture_binary.Sensitive = true;
                button_auto_start.Sensitive = true;
                notebook_options_top.Sensitive = true;
                event_execute_button_update.Sensitive = true;
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 8867f67a..15a396af 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -65,7 +65,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.MenuItem menuitem_force_sensor_open_folder;
        [Widget] Gtk.MenuItem menuitem_force_sensor_check_version;
 
-       //capture tab tab
+       //capture tab
        [Widget] Gtk.HBox hbox_force_capture_buttons;
        [Widget] Gtk.Box hbox_combo_force_sensor_exercise;
        [Widget] Gtk.ComboBox combo_force_sensor_exercise;
@@ -116,9 +116,6 @@ public partial class ChronoJumpWindow
        SerialPort portFS; //Attention!! Don't reopen port because arduino makes reset and tare, 
calibration... is lost
        bool portFSOpened;
 
-       //TODO: clean this
-       bool forceSensorBinary = false;
-
        Gdk.GC pen_black_force_capture;
        Gdk.GC pen_red_force_capture;
        Gdk.GC pen_gray_force_capture;
@@ -208,7 +205,7 @@ public partial class ChronoJumpWindow
                Thread.Sleep(3000); //sleep to let arduino start reading serial event
 
                //At the moment, binary code do not check version, tare, calibrate
-               if(forceSensorBinary)
+               if(forceSensorBinaryCapture())
                {
                        portFSOpened = true;
                        return true;
@@ -576,6 +573,11 @@ public partial class ChronoJumpWindow
                forceCaptureThread.Start();
        }
 
+       private bool forceSensorBinaryCapture()
+       {
+               return check_force_sensor_capture_binary.Active;
+       }
+
        private bool readBinaryRowMark()
        {
                if(portFS.ReadByte() != 255)
@@ -661,6 +663,7 @@ public partial class ChronoJumpWindow
                writer.WriteLine("Time (micros);Force(N)");
                str = "";
                int firstTime = 0;
+               bool forceSensorBinary = forceSensorBinaryCapture();
 
                //LogB.Information("pre bucle");
                //LogB.Information(string.Format("forceProcessFinish: {0}, forceProcessCancel: {1}, 
forceProcessError: {2}", forceProcessFinish, forceProcessCancel, forceProcessError));


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