[chronojump/FS-TFT-Menu] Discover can found an rfid (fast)



commit 20fe0ad87ccf80f167c721b62e495f9765d768f0
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Apr 29 20:10:33 2022 +0200

    Discover can found an rfid (fast)

 src/execute/arduinoCapture.cs | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/src/execute/arduinoCapture.cs b/src/execute/arduinoCapture.cs
index 9e228ea3b..1a026cb27 100644
--- a/src/execute/arduinoCapture.cs
+++ b/src/execute/arduinoCapture.cs
@@ -499,7 +499,6 @@ public class MicroDiscover : MicroComms
                        {
                                flush(); //after connect
                                if (! discoverDo115200 ())
-                               {
                                        if (! discoverOldWichros ())
                                        {
                                                //try at 9600
@@ -511,7 +510,6 @@ public class MicroDiscover : MicroComms
                                                        discoverDo9600 ();
                                                }
                                        }
-                               }
                        } else
                                micro.Discovered = ChronopicRegisterPort.Types.UNKNOWN;
 
@@ -540,23 +538,35 @@ public class MicroDiscover : MicroComms
                for (int i = 0; i < micro_l.Count; i ++)
                {
                        if(! microDiscoverManage_l[i].ConnectOk)
-                               microDiscoverManage_l[i].Discovered = ChronopicRegisterPort.Types.UNKNOWN;
-                       else
                        {
-                               //wait the ms since connect
-                               while (! microDiscoverManage_l[i].PassedMsSinceConnect (2000))
-                                       ;
+                               microDiscoverManage_l[i].Discovered = ChronopicRegisterPort.Types.UNKNOWN;
+                               micro.ClosePort (); //close even connect failed?
+                               continue;
+                       }
 
-                               //TODO: right now have to wait at each getVersion, improve it
-                               micro = micro_l[i]; //micro is the protected variable
-                               flush();
-                               if (! discoverDo115200 ())
-                                       discoverOldWichros ();
+                       //wait the ms since connect
+                       while (! microDiscoverManage_l[i].PassedMsSinceConnect (2000))
+                               ;
 
-                               microDiscoverManage_l[i].Discovered = micro.Discovered;
-                       }
+                       //TODO: right now have to wait at each getVersion, improve it
+                       micro = micro_l[i]; //micro is the protected variable
+                       flush();
+                       if (! discoverDo115200 ())
+                               if (! discoverOldWichros ())
+                               {
+                                       //try at 9600
+                                       micro.ClosePort ();
+                                       micro.Bauds = 9600;
+                                       if(connectAndSleep ())
+                                       {
+                                               flush(); //after connect
+                                               discoverDo9600 ();
+                                       }
+                               }
 
-                       micro.ClosePort (); //close even connect failed?
+                       microDiscoverManage_l[i].Discovered = micro.Discovered;
+
+                       micro.ClosePort ();
                        discovered_l.Add(microDiscoverManage_l[i].ResultStr ());
                }
 


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