Return 0 if FB is not ready.

* Fix bug introduced in last commit.
This commit is contained in:
iabdalkader 2016-08-21 03:01:21 +02:00
parent 5b8de6f867
commit a998acbe22

View File

@ -92,12 +92,12 @@ void usbdbg_data_in(void *buffer, int length)
}
case USBDBG_FRAME_SIZE:
// Return 0 if FB is locked or not ready.
((uint32_t*)buffer)[0] = 0;
// Try to lock FB. If header size == 0 frame is not ready
if (mutex_try_lock(&JPEG_FB()->lock, MUTEX_TID_IDE)) {
// If header size == 0 frame is not ready
if (JPEG_FB()->size == 0) {
// Return 0
((uint32_t*)buffer)[0] = 0;
// unlock FB
mutex_unlock(&JPEG_FB()->lock, MUTEX_TID_IDE);
} else {