@@ -116,13 +116,16 @@ def __init__(self):
116
116
self .active_classes = {}
117
117
self .fw_version_str = None
118
118
119
- self .setup ()
120
119
121
120
self .process_events_timer = PyQt6 .QtCore .QTimer ()
122
121
self .process_events_timer .timeout .connect (process_events ) # Kick eventloop when timeouting
123
122
self .axes = 0
124
123
124
+ self .setup ()
125
125
self .languagechanged .connect (self .restart_app )
126
+
127
+ # start the auto disconnect timer (call the board)
128
+ self .timer .start (5000 )
126
129
127
130
def setup (self ):
128
131
"""Init the systray, the serial, the toolbar, the status bar and the connection status."""
@@ -149,9 +152,6 @@ def setup(self):
149
152
150
153
self .actionDebug_mode .triggered .connect (self .toggle_debug )
151
154
152
- self .timer .start (5000 )
153
-
154
-
155
155
#self.serialchooser.connected.connect(self.effects_monitor_dlg.setEnabled) # Gets enabled in class management
156
156
self .effects_monitor_dlg .setEnabled (False )
157
157
@@ -194,7 +194,9 @@ def setup(self):
194
194
layout .setContentsMargins (0 , 0 , 0 , 0 )
195
195
layout .addWidget (self .profile_ui )
196
196
self .groupBox_main .setLayout (layout )
197
-
197
+
198
+
199
+ def autoconnect (self ) :
198
200
# after UI load get serial port and if only one : autoconnect
199
201
nb_device_compat = self .serialchooser .get_ports ()
200
202
self .serialchooser .auto_connect (nb_device_compat )
@@ -612,25 +614,27 @@ def version_check(self, ver):
612
614
613
615
def serial_connected (self , connected ):
614
616
"""Check the release when a board is connected."""
615
- self .serial_timer = PyQt6 .QtCore .QTimer ()
616
-
617
+
617
618
def timer_cb ():
618
619
if not self .connected :
619
620
self .log ("Can't detect board" )
620
621
self .reset_port ()
621
622
622
623
def id_cb (identifier ):
623
624
if identifier :
624
- self .connected = True
625
625
self .serial_timer .stop ()
626
+ self .connected = True
626
627
627
628
if connected :
628
- self .serial_timer .singleShot (500 , timer_cb )
629
629
self .get_value_async ("main" , "id" , id_cb , 0 )
630
630
self .errors_dlg .registerCallbacks ()
631
631
self .get_value_async ("sys" , "swver" , self .version_check )
632
632
self .get_value_async ("sys" , "hwtype" , self .wrapper_status_bar .set_board_text )
633
633
self .get_value_async ("sys" , "debug" , self .actionDebug_mode .setChecked ,0 ,int )
634
+
635
+ if (self .serial_timer is None ) :
636
+ self .serial_timer = PyQt6 .QtCore .QTimer (singleShot = True , timeout = timer_cb )
637
+ self .serial_timer .start (500 )
634
638
635
639
else :
636
640
self .connected = False
@@ -909,6 +913,7 @@ def process_events():
909
913
window .setWindowIcon (PyQt6 .QtGui .QIcon (helper .res_path ('app.ico' )))
910
914
window .show ()
911
915
window .check_configurator_update () # Check for updates after window is shown
916
+ window .autoconnect ()
912
917
913
918
exit_code = app .exec ()
914
919
# Check if we need to restart
0 commit comments