[chronojump/FS-TFT-Menu] Gui for last commit (also with chronoDebug)



commit 331227fff7ca52709d415e4f2ef8ebaaa53af5c6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Apr 29 19:29:59 2022 +0200

    Gui for last commit (also with chronoDebug)

 glade/preferences_win.glade | 14 ++++++++++++++
 src/gui/preferences.cs      | 22 ++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index d68618726..fd9d90337 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -6994,6 +6994,20 @@ version:</property>
                                                     <property name="position">2</property>
                                                   </packing>
                                                 </child>
+                                                <child>
+                                                  <widget class="GtkButton" 
id="button_discover_devices_fast">
+                                                    <property name="label">Discover devices (fast)</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">True</property>
+                                                    <signal name="clicked" 
handler="on_button_discover_devices_fast_clicked" swapped="no"/>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">3</property>
+                                                  </packing>
+                                                </child>
                                               </widget>
                                               <packing>
                                                 <property name="expand">True</property>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 8048b3d70..3bc087239 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -1772,15 +1772,33 @@ public class PreferencesWindow
 
        private void on_button_discover_devices_clicked (object o, EventArgs args)
        {
+               discoverDevices (false);
+       }
+       private void on_button_discover_devices_fast_clicked (object o, EventArgs args)
+       {
+               discoverDevices (true);
+       }
+       private void discoverDevices (bool fast)
+       {
+               ChronoDebug cDebug = new ChronoDebug("Discover fast? " + fast.ToString());
+               cDebug.Start();
+
                List<string> list_discover_ports = Util.StringArrayToListString (ChronopicPorts.GetPorts ());
                MicroDiscover md = new MicroDiscover (list_discover_ports); //all ports
-               List<string> discovered_l = md.Discover ();
+               List<string> discovered_l = new List<string> ();
+               if(fast)
+                       discovered_l = md.DiscoverNotSequential ();
+               else
+                       discovered_l = md.Discover ();
+
+               cDebug.StopAndPrint();
 
                string discoveredStr = "Discovered: ";
                foreach (string str in discovered_l)
                        discoveredStr += "\n- " + str;
 
-               new DialogMessage(Constants.MessageTypes.INFO, discoveredStr);
+               new DialogMessage( Constants.MessageTypes.INFO, discoveredStr +
+                               string.Format("\n{0} ms", cDebug.StartToEndInMs()) );
        }
 
        private void on_debug_mode_clicked (object o, EventArgs args) {


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