mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Open serial port after calling openmv.init
* Handle the case where init changes the configuration
This commit is contained in:
parent
a9a59070ff
commit
874e4b99bb
@ -192,14 +192,6 @@ class OMVGtk:
|
|||||||
sleep(wait)
|
sleep(wait)
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
try:
|
|
||||||
# open VCP and configure the terminal
|
|
||||||
self.serial = serial.Serial(self.config.get("main", "serial_port"), 115200, timeout=0.001)
|
|
||||||
gobject.gobject.idle_add(omvgtk.update_terminal)
|
|
||||||
except Exception as e:
|
|
||||||
self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to connect to OpenMV\n%s"%e)
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# init openmv
|
# init openmv
|
||||||
openmv.init()
|
openmv.init()
|
||||||
@ -211,6 +203,14 @@ class OMVGtk:
|
|||||||
self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to connect to OpenMV\n%s"%e)
|
self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to connect to OpenMV\n%s"%e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
# open VCP and configure the terminal
|
||||||
|
self.serial = serial.Serial(self.config.get("main", "serial_port"), 115200, timeout=0.001)
|
||||||
|
gobject.gobject.idle_add(omvgtk.update_terminal)
|
||||||
|
except Exception as e:
|
||||||
|
self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to connect to OpenMV\n%s"%e)
|
||||||
|
return
|
||||||
|
|
||||||
self.connected = True
|
self.connected = True
|
||||||
self._update_title()
|
self._update_title()
|
||||||
self.connect_button.set_sensitive(False)
|
self.connect_button.set_sensitive(False)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user