mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix big frame size
This commit is contained in:
parent
cf9be6bf71
commit
41d531242a
@ -1 +1 @@
|
||||
Subproject commit 99b61b8ee4008872f61ed9849dbb7d9a1be40b80
|
||||
Subproject commit 00b1e2b44b58d84ed824c16cfbcca4dd4dd9def1
|
||||
@ -102,15 +102,15 @@ void usbdbg_control(void *buffer, uint8_t request, uint16_t length)
|
||||
|
||||
case USBDBG_FRAME_DUMP:
|
||||
xfer_bytes = 0;
|
||||
xfer_length = length;
|
||||
xfer_length =((uint32_t)length)<<2;
|
||||
break;
|
||||
|
||||
case USBDBG_FRAME_READY:
|
||||
/* return framebuffer status */
|
||||
case USBDBG_FRAME_LOCK:
|
||||
if (fb->ready == 0) {
|
||||
// no valid frame
|
||||
((uint8_t*)buffer)[0] = 0;
|
||||
} else {
|
||||
// try to lock FB, return 1 if locked
|
||||
((uint8_t*)buffer)[0] = mutex_try_lock(&fb->lock);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4,7 +4,7 @@ enum usbdbg_cmd {
|
||||
USBDBG_NONE=0,
|
||||
USBDBG_FRAME_SIZE,
|
||||
USBDBG_FRAME_DUMP,
|
||||
USBDBG_FRAME_READY,
|
||||
USBDBG_FRAME_LOCK,
|
||||
USBDBG_SCRIPT_EXEC,
|
||||
USBDBG_SCRIPT_STOP,
|
||||
USBDBG_SCRIPT_SAVE,
|
||||
|
||||
@ -18,13 +18,13 @@ __INTERFACE = 0
|
||||
__ALTSETTING = 1
|
||||
__IN_EP =0x81
|
||||
__OUT_EP =0x01
|
||||
__TIMEOUT =1000
|
||||
__TIMEOUT =3000
|
||||
__FB_HDR_SIZE =12
|
||||
|
||||
# USB Debug commands
|
||||
__USBDBG_FRAME_SIZE=1
|
||||
__USBDBG_FRAME_DUMP=2
|
||||
__USBDBG_FRAME_READY=3
|
||||
__USBDBG_FRAME_LOCK=3
|
||||
__USBDBG_SCRIPT_EXEC=4
|
||||
__USBDBG_SCRIPT_STOP=5
|
||||
__USBDBG_SCRIPT_SAVE=6
|
||||
@ -82,15 +82,15 @@ def fb_size():
|
||||
size = struct.unpack("III", buf)
|
||||
return size
|
||||
|
||||
def fb_ready():
|
||||
def fb_lock():
|
||||
global __dev
|
||||
buf = __dev.ctrl_transfer(0xC1, __USBDBG_FRAME_READY, 0, __INTERFACE, 1, __TIMEOUT)
|
||||
buf = __dev.ctrl_transfer(0xC1, __USBDBG_FRAME_LOCK, 0, __INTERFACE, 1, __TIMEOUT)
|
||||
return struct.unpack("B", buf)[0]
|
||||
|
||||
def fb_dump():
|
||||
global __dev
|
||||
|
||||
if (fb_ready() == 0):
|
||||
if (fb_lock() == 0):
|
||||
return None
|
||||
|
||||
size = fb_size()
|
||||
@ -100,7 +100,7 @@ def fb_dump():
|
||||
num_bytes = size[0]*size[1]*size[2]
|
||||
|
||||
# read fb data
|
||||
__dev.ctrl_transfer(0xC1, __USBDBG_FRAME_DUMP, num_bytes, __INTERFACE, 0, __TIMEOUT)
|
||||
__dev.ctrl_transfer(0xC1, __USBDBG_FRAME_DUMP, num_bytes/4, __INTERFACE, 0, __TIMEOUT)
|
||||
buff = __dev.read(__IN_EP, num_bytes, __INTERFACE, __TIMEOUT)
|
||||
|
||||
if (size[2] > 2):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user