[chronojump] Close serial port (if open) when Chronopic is disconnected.



commit 2f4e7313c879d5e2ee42d7fc4e0fe2ea709200f4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Oct 18 07:57:49 2016 +0200

    Close serial port (if open) when Chronopic is disconnected.
    
    On Linux: uses same /dev/ttyUSB* on reconnect
    On OSX: hopefully port will not get blocked

 src/gui/chronojump.cs |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 119c8d8..3072d6e 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3616,7 +3616,7 @@ public partial class ChronoJumpWindow
 
                if(numContacts == 0) {
                        if(currentSession.Name != Constants.SessionSimulatedName)
-                               new DialogMessage(Constants.MessageTypes.WARNING, "Chronopic jumps/runs is 
not connected");
+                               LogB.Warning("Chronopic jumps/runs is not connected");
 
                        return false;
                }
@@ -3684,6 +3684,13 @@ public partial class ChronoJumpWindow
                                 */
                        }
                } else {
+                       /*
+                        * if serial port gets opened, then a new USB connection will use different ttyUSB on 
Linux
+                        * and maybe is the cause for blocking the port on OSX
+                        * close the port if opened
+                        */
+                       cp2016.SerialPortsCloseIfNeeded();
+
                        //simulated tests are only allowed on SIMULATED session
                        if(currentSession.Name != Constants.SessionSimulatedName) {
                                new DialogMessage(Constants.MessageTypes.WARNING, 
Constants.SimulatedTestsNotAllowed);


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