Close serial port when connecting/disconnecting.

This commit is contained in:
iabdalkader 2016-04-29 20:35:52 +02:00
parent 6b581af1b1
commit d6890e7912

View File

@ -454,6 +454,7 @@ class OMVGtk:
def connect(self): def connect(self):
connected = False connected = False
openmv.disconnect()
for i in range(10): for i in range(10):
try: try:
# opens CDC port. # opens CDC port.
@ -512,6 +513,7 @@ class OMVGtk:
except: except:
pass pass
openmv.disconnect()
self.connected = False self.connected = False
self._update_title() self._update_title()
self.stop_button.set_sensitive(False) self.stop_button.set_sensitive(False)
@ -524,6 +526,7 @@ class OMVGtk:
def reset_clicked(self, widget): def reset_clicked(self, widget):
if (self.connected): if (self.connected):
openmv.reset() openmv.reset()
openmv.disconnect()
def execute_clicked(self, widget): def execute_clicked(self, widget):
buf = self.buffer.get_text(self.buffer.get_start_iter(), self.buffer.get_end_iter()) buf = self.buffer.get_text(self.buffer.get_start_iter(), self.buffer.get_end_iter())