Skip to content

Commit 1c9f890

Browse files
ngphibangdanieldegrasse
authored andcommitted
samples: video: capture: Add condition for test pattern test
Add condition to do the test pattern fixture test only if the test pattern control was successfully set. Signed-off-by: Phi Bang Nguyen <[email protected]>
1 parent 706895c commit 1c9f890

File tree

1 file changed

+5
-2
lines changed
  • samples/drivers/video/capture/src

1 file changed

+5
-2
lines changed

samples/drivers/video/capture/src/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ int main(void)
246246

247247
/* Set controls */
248248
struct video_control ctrl = {.id = VIDEO_CID_HFLIP, .val = 1};
249+
int tp_set_ret = -ENOTSUP;
249250

250251
if (IS_ENABLED(CONFIG_VIDEO_CTRL_HFLIP)) {
251252
video_set_ctrl(video_dev, &ctrl);
@@ -258,7 +259,7 @@ int main(void)
258259

259260
if (IS_ENABLED(CONFIG_TEST)) {
260261
ctrl.id = VIDEO_CID_TEST_PATTERN;
261-
video_set_ctrl(video_dev, &ctrl);
262+
tp_set_ret = video_set_ctrl(video_dev, &ctrl);
262263
}
263264

264265
#if DT_HAS_CHOSEN(zephyr_display)
@@ -320,7 +321,9 @@ int main(void)
320321
frame++, vbuf->bytesused, vbuf->timestamp);
321322

322323
#ifdef CONFIG_TEST
323-
if (is_colorbar_ok(vbuf->buffer, fmt)) {
324+
if (tp_set_ret < 0) {
325+
LOG_DBG("Test pattern control was not successful. Skip test");
326+
} else if (is_colorbar_ok(vbuf->buffer, fmt)) {
324327
LOG_DBG("Pattern OK!\n");
325328
}
326329
#endif

0 commit comments

Comments
 (0)