Skip to content

Commit e992d70

Browse files
committed
samples: drivers: video: capture: convert #ifdef into if()
Convert #ifdef CONFIG_TEST into if (IS_ENABLED(CONFIG_TEST)) to improve readability. Signed-off-by: Josuah Demangeon <me@josuah.net>
1 parent bcb81f5 commit e992d70

File tree

1 file changed

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

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ int main(void)
205205
video_set_ctrl(video_dev, &ctrl);
206206
}
207207

208-
#ifdef CONFIG_TEST
209-
ctrl.id = VIDEO_CID_TEST_PATTERN;
210-
video_set_ctrl(video_dev, &ctrl);
211-
#endif
208+
if (IS_ENABLED(CONFIG_TEST)) {
209+
ctrl.id = VIDEO_CID_TEST_PATTERN;
210+
video_set_ctrl(video_dev, &ctrl);
211+
}
212212

213213
#if DT_HAS_CHOSEN(zephyr_display)
214214
const struct device *const display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
@@ -267,11 +267,9 @@ int main(void)
267267
LOG_DBG("Got frame %u! size: %u; timestamp %u ms", frame++, vbuf->bytesused,
268268
vbuf->timestamp);
269269

270-
#ifdef CONFIG_TEST
271-
if (is_colorbar_ok(vbuf->buffer, fmt)) {
270+
if (IS_ENABLED(CONFIG_TEST) && is_colorbar_ok(vbuf->buffer, fmt)) {
272271
LOG_DBG("Pattern OK!\n");
273272
}
274-
#endif
275273

276274
#if DT_HAS_CHOSEN(zephyr_display)
277275
video_display_frame(display_dev, vbuf, fmt);

0 commit comments

Comments
 (0)