mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Modified error handling, fixed disconnect detect bug in gtk ide
This commit is contained in:
parent
0f9c7be631
commit
d6c7460aa9
@ -346,8 +346,9 @@ class OMVGtk:
|
||||
dialog.hide()
|
||||
|
||||
def reset_clicked(self, widget):
|
||||
if (self.connected):
|
||||
if self.connected:
|
||||
openmv.reset()
|
||||
self.disconnect()
|
||||
|
||||
def execute_clicked(self, widget):
|
||||
buf = self.buffer.get_text(self.buffer.get_start_iter(), self.buffer.get_end_iter())
|
||||
|
||||
@ -121,12 +121,8 @@ def fb_get():
|
||||
if fb_lock() == 0:
|
||||
return None
|
||||
|
||||
try:
|
||||
buf = __dev.ctrl_transfer(0xC1, __USBDBG_FRAME_SIZE, 0, __INTERFACE, __FB_HDR_SIZE, __TIMEOUT)
|
||||
except USBError as e:
|
||||
pass
|
||||
return None
|
||||
else:
|
||||
|
||||
size = struct.unpack("III", buf)
|
||||
|
||||
w = size[0]
|
||||
@ -172,8 +168,10 @@ def exec_script(buf):
|
||||
|
||||
|
||||
def stop_script():
|
||||
try:
|
||||
__dev.ctrl_transfer(0x41, __USBDBG_SCRIPT_STOP, 0, __INTERFACE, None, __TIMEOUT)
|
||||
|
||||
except USBError:
|
||||
pass
|
||||
|
||||
def save_template(x, y, w, h, path):
|
||||
buf = struct.pack("IIII", x, y, w, h) + path
|
||||
@ -208,7 +206,7 @@ def reset():
|
||||
try:
|
||||
# This will timeout.
|
||||
__dev.ctrl_transfer(0x41, __USBDBG_SYS_RESET, 0, __INTERFACE, None, __TIMEOUT)
|
||||
except USBError as e:
|
||||
except USBError:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user