[chronojump] chronopic.cs manages TimeOut (when chronopic has not the Auto port)



commit a209ef5b49b7b006c787d1a8f1808dc9b871703c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Sep 12 18:21:41 2014 +0200

    chronopic.cs manages TimeOut (when chronopic has not the Auto port)

 src/chronopic.cs |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/chronopic.cs b/src/chronopic.cs
index 48e87cb..262ce56 100644
--- a/src/chronopic.cs
+++ b/src/chronopic.cs
@@ -162,6 +162,16 @@ Console.Write("4");
                
                Console.WriteLine("ReadVarAutoOpened");
 
+               try {
+                       sp.Write("J");
+                       Console.WriteLine("Port scanning (should return 'J'): " + (char) sp.ReadByte());
+               } catch {
+                       this.error=ErrorType.Timeout;
+                       Console.WriteLine("Timeout. This is not Chronopic-Automatic-Firmware");
+                       return;
+               }
+
+               
                sp.Write("V");
                Console.WriteLine("Version: " + 
                                (char) sp.ReadByte() +
@@ -169,9 +179,6 @@ Console.Write("4");
                                (char) sp.ReadByte() 
                                );
 
-               sp.Write("J");
-               Console.WriteLine("Port scanning (should return 'J'): " + (char) sp.ReadByte());
-               
                int debounce = 0;
 
                sp.Write("a");


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