[chronojump] Better chronopic detection/connection



commit a1e95c0c8c4692c444b6296bb635289f992e7be9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 6 15:02:51 2015 +0200

    Better chronopic detection/connection

 src/chronopicDetect.cs |    8 +++++---
 src/gui/chronojump.cs  |    8 ++++----
 src/gui/chronopic.cs   |    8 +++++---
 3 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/chronopicDetect.cs b/src/chronopicDetect.cs
index 3350ecf..43321bf 100644
--- a/src/chronopicDetect.cs
+++ b/src/chronopicDetect.cs
@@ -99,9 +99,11 @@ public class ChronopicDetect
 
                Detected = cad.Detected;
                
-               needToChangeProgressbarText = true;
-
-               connectNormal(Detected);
+               if(Detected != null && Detected != "") 
+               {
+                       needToChangeProgressbarText = true;
+                       connectNormal(Detected);
+               }
                LogB.Debug("detectNormal ended");
        }
 
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index df3daa6..b9393d2 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2379,7 +2379,7 @@ public partial class ChronoJumpWindow
                LogB.Information("Bye!");
 
                if(chronopicWin.Connected == true) {
-                       chronopicWin.SerialPortsClose();
+                       chronopicWin.SerialPortsCloseIfNeeded();
                }
        
                try {   
@@ -6255,7 +6255,7 @@ LogB.Debug("X");
                
                //notebooks
                notebook_execute.Sensitive = false;
-               hbox_chronopics.Sensitive = false;
+               //hbox_chronopics.Sensitive = false;
                notebook_results.Sensitive = false;
                notebook_options.Sensitive = false;
                notebook_encoder_sup.Sensitive = false;
@@ -6296,7 +6296,7 @@ LogB.Debug("X");
                encoderPersonChanged();
 
                notebook_execute.Sensitive = false;
-               hbox_chronopics.Sensitive = false;
+               //hbox_chronopics.Sensitive = false;
                notebook_results.Sensitive = false;
                notebook_options.Sensitive = false;
                notebook_encoder_sup.Sensitive = false;
@@ -6315,7 +6315,7 @@ LogB.Debug("X");
                encoderPersonChanged();
 
                notebook_execute.Sensitive = true;
-               hbox_chronopics.Sensitive = true;
+               //hbox_chronopics.Sensitive = true;
                notebook_results.Sensitive = true;
                notebook_options.Sensitive = true;
                notebook_encoder_sup.Sensitive = true;
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index 9db0fbb..a26670e 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -678,9 +678,11 @@ public class ChronopicWindow
                new HelpPorts();
        }
        
-       public void SerialPortsClose() {
-               LogB.Information("Closing sp");
-               sp.Close();
+       public void SerialPortsCloseIfNeeded() {
+               if(sp != null && sp.IsOpen) {
+                       LogB.Information("Closing sp");
+                       sp.Close();
+               }
        }
 
 


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