mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Set baudrate once when opening port
This commit is contained in:
parent
63b156cf48
commit
51907dc7cd
@ -208,7 +208,7 @@ class OMVGtk:
|
|||||||
def connect(self):
|
def connect(self):
|
||||||
try:
|
try:
|
||||||
# open VCP and configure the terminal
|
# open VCP and configure the terminal
|
||||||
self.serial = serial.Serial(self.config.get("main", "serial_port"), 115200, timeout=0.1)
|
self.serial = serial.Serial(self.config.get("main", "serial_port"), 12000000, timeout=0.1)
|
||||||
gobject.gobject.idle_add(omvgtk.update_terminal)
|
gobject.gobject.idle_add(omvgtk.update_terminal)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to open serial port (check prefernces)\n%s"%e)
|
self.show_message_dialog(gtk.MESSAGE_ERROR, "Failed to open serial port (check prefernces)\n%s"%e)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ __serial = None
|
|||||||
__FB_HDR_SIZE =12
|
__FB_HDR_SIZE =12
|
||||||
|
|
||||||
# USB Debug commands
|
# USB Debug commands
|
||||||
__USBDBG_CMD = 48
|
__USBDBG_CMD = 48
|
||||||
__USBDBG_FRAME_SIZE = 0x81
|
__USBDBG_FRAME_SIZE = 0x81
|
||||||
__USBDBG_FRAME_DUMP = 0x82
|
__USBDBG_FRAME_DUMP = 0x82
|
||||||
__USBDBG_FRAME_LOCK = 0x83
|
__USBDBG_FRAME_LOCK = 0x83
|
||||||
@ -43,7 +43,6 @@ ATTR_GAINCEILING=3
|
|||||||
def init(serial):
|
def init(serial):
|
||||||
global __serial
|
global __serial
|
||||||
__serial = serial
|
__serial = serial
|
||||||
__serial.baudrate =12000000
|
|
||||||
|
|
||||||
def _rgb(rgb):
|
def _rgb(rgb):
|
||||||
return struct.pack("BBB", ((rgb & 0xF800)>>11)*255/31, ((rgb & 0x07E0)>>5)*255/63, (rgb & 0x001F)*255/31)
|
return struct.pack("BBB", ((rgb & 0xF800)>>11)*255/31, ((rgb & 0x07E0)>>5)*255/63, (rgb & 0x001F)*255/31)
|
||||||
@ -140,7 +139,7 @@ if __name__ == '__main__':
|
|||||||
with open(sys.argv[1], 'r') as fin:
|
with open(sys.argv[1], 'r') as fin:
|
||||||
buf = fin.read()
|
buf = fin.read()
|
||||||
|
|
||||||
s = serial.Serial("/dev/openmvcam", 115200, timeout=1)
|
s = serial.Serial("/dev/openmvcam", 12000000, timeout=0.1)
|
||||||
init(s)
|
init(s)
|
||||||
exec_script(buf)
|
exec_script(buf)
|
||||||
tx_len = tx_buf_len()
|
tx_len = tx_buf_len()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user