From 874e4b99bb37f92763b51d4e6da96d25595cb60c Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 3 Nov 2014 17:00:28 +0200 Subject: [PATCH] Open serial port after calling openmv.init * Handle the case where init changes the configuration --- usr/openmv-ide.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr/openmv-ide.py b/usr/openmv-ide.py index 07d6d3476..a527029e2 100755 --- a/usr/openmv-ide.py +++ b/usr/openmv-ide.py @@ -192,14 +192,6 @@ class OMVGtk: sleep(wait) 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: # init openmv openmv.init() @@ -211,6 +203,14 @@ class OMVGtk: self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to connect to OpenMV\n%s"%e) 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._update_title() self.connect_button.set_sensitive(False)