[chronojump] Fixing port open on autodetection



commit 57109c64382721fc4a09e296599a50765815abb3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jun 16 09:27:21 2015 +0200

    Fixing port open on autodetection

 src/chronopicDetect.cs |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/chronopicDetect.cs b/src/chronopicDetect.cs
index dab574e..1bce310 100644
--- a/src/chronopicDetect.cs
+++ b/src/chronopicDetect.cs
@@ -318,12 +318,19 @@ public abstract class ChronopicAuto
 
                if (sp == null) 
                        return false;
-               
-               if (sp != null) 
-                       if (sp.IsOpen)
-                               sp.Close(); //close to ensure no bytes are comming
+       
+               LogB.Information("opening port... ");
+               try {   
+                       if (sp != null) 
+                               if (sp.IsOpen)
+                                       sp.Close(); //close to ensure no bytes are comming
 
-               sp.Open();
+                       sp.Open();
+               } catch {
+                       LogB.Warning("catched!");
+                       return false;
+               }
+               LogB.Information("opened");
                        
                if(IsEncoder)
                        setEncoderBauds();


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