[chronojump] Fixed encoder disconnect cable on Linux/MaxOSX



commit 8700ddfc0dd7630d3eb834b4cf94d063637f0fea
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 10 14:16:54 2015 +0100

    Fixed encoder disconnect cable on Linux/MaxOSX

 src/gui/chronojump.cs |    4 +++-
 src/gui/encoder.cs    |   28 ++++++++++++++++------------
 2 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index eeaf668..7facf63 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -4512,7 +4512,7 @@ public partial class ChronoJumpWindow
        private void chronopicEncoderLabels(bool colorize) {
                LogB.Information("at chronopicEncoderLabels");
                string encoderPort = chronopicWin.GetEncoderPort();
-               LogB.Information("gui/chronojump.cs encoderPort:", encoderPort);
+               LogB.Debug("gui/chronojump.cs encoderPort:", encoderPort);
 
                if(encoderPort != null && encoderPort != "" && encoderPort != Util.GetDefaultPort())
                        label_chronopic_encoder.Text = Catalog.GetString("Encoder connected");
@@ -4523,6 +4523,8 @@ public partial class ChronoJumpWindow
                        UtilGtk.ChronopicColors(viewport_chronopic_encoder, 
                                        label_chronopic_encoder, new Gtk.Label(),
                                        encoderPort != "");
+
+               LogB.Information("at chronopicEncoderLabels end");
        }
 
 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 3b227ac..5541349 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -373,20 +373,23 @@ public partial class ChronoJumpWindow
        }
 
        private bool encoderCheckPort() {
-               if(
-                               chronopicWin.GetEncoderPort() == "" ||
-                               chronopicWin.GetEncoderPort() == Util.GetDefaultPort()) 
-               {
-                       new DialogMessage(Constants.MessageTypes.WARNING, 
-                                       Catalog.GetString("Chronopic port is not configured."));
-                       /*
-                       UtilGtk.ChronopicColors(viewport_chronopic_encoder, 
-                                       label_chronopic_encoder, new Gtk.Label(),
-                                       false);
-                                       */
+               string port = chronopicWin.GetEncoderPort();
+               string errorMessage = "";
+
+               if( port == null || port == "" || port == Util.GetDefaultPort() )
+                       errorMessage = "Chronopic port is not configured";
+               else if( ! UtilAll.IsWindows() )
+                      if( ! File.Exists(port) )
+                               errorMessage = "Chronopic has been disconnected";
+
+
+               if(errorMessage != "") {
+                       LogB.Warning(errorMessage);
+                       new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString(errorMessage));
                        createChronopicWindow(true);
                        return false;
                }
+
                return true;
        }
 
@@ -2013,7 +2016,7 @@ public partial class ChronoJumpWindow
                int heightG = encoder_capture_signal_drawingarea.Allocation.Height;
                double realHeightG = 1000 * 2 * 
encoderCaptureOptionsWin.spin_encoder_capture_curves_height_range.Value;
                
-               LogB.Debug("runEncoderCaptureCsharp start");
+               LogB.Debug("runEncoderCaptureCsharp start port:", port);
                SerialPort sp = new SerialPort(port);
                sp.BaudRate = 115200;
                LogB.Information("sp created");
@@ -2092,6 +2095,7 @@ public partial class ChronoJumpWindow
                                break;
                        }
 
+
                        if(byteReadedRaw > 128)
                                byteReadedRaw = byteReadedRaw - 256;
 


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