Skip to content

Commit 1af43c7

Browse files
committed
uvc: don't run the callback if uvc is off
this leaves the potential problem that the callback may run frequently even if not streaming, can improve this later.
1 parent f2c40d7 commit 1af43c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

shared-module/uvc/__init__.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,11 @@ STATIC void uvc_cb_fun(void *unused) {
172172
(void)result;
173173
}
174174

175+
175176
void usb_uvc_task(void) {
176-
background_callback_add(&uvc_cb, uvc_cb_fun, NULL);
177+
if (uvc_is_enabled) {
178+
background_callback_add(&uvc_cb, uvc_cb_fun, NULL);
179+
}
177180
}
178181

179182
void tud_video_frame_xfer_complete_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx) {

0 commit comments

Comments
 (0)