Skip to content

examples/camera: fix build error and still capture logic#3425

Merged
simbit18 merged 2 commits intoapache:masterfrom
JianyuWang0623:examples_camera_fix_boardctl
Mar 16, 2026
Merged

examples/camera: fix build error and still capture logic#3425
simbit18 merged 2 commits intoapache:masterfrom
JianyuWang0623:examples_camera_fix_boardctl

Conversation

@JianyuWang0623
Copy link
Contributor

Summary

Fix two issues in examples/camera:

  1. Build error: camera_bkgd.c calls boardctl(BOARDIOC_NX_START, 0) but is missing #include <sys/boardctl.h>, causing:

    • implicit declaration of function 'boardctl'
    • 'BOARDIOC_NX_START' undeclared
  2. Logic fix: camera_main.c unconditionally enters still-capture frame size enumeration (VIDIOC_ENUM_FRAMESIZES for V4L2_BUF_TYPE_STILL_CAPTURE) even when the user requested video capture. Added capture_type == V4L2_BUF_TYPE_STILL_CAPTURE guard so the still-specific path is only taken when appropriate.

Impact

  • Fixes build failure when CONFIG_EXAMPLES_CAMERA_OUTPUT_LCD=y (NX backend path).
  • Corrects runtime behavior: video capture mode no longer attempts still-capture frame size enumeration.
  • No API or configuration changes.

Testing

Build verified with lckfb-szpi-esp32s3/camera config (ESP32-S3, GC0308 DVP camera + ST7789 LCD):

  • Host: Ubuntu x86_64, GCC (xtensa-esp32s3-elf)
  • Target: xtensa, lckfb-szpi-esp32s3:camera
  • Build: make -j8 — passes without errors

Add missing #include <sys/boardctl.h> in camera_bkgd.c to fix
implicit declaration of boardctl() and undeclared BOARDIOC_NX_START.

Also fix capture_num check in camera_main.c to only apply still
capture size enumeration when capture_type is STILL_CAPTURE.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
@cederom
Copy link
Contributor

cederom commented Mar 16, 2026

Thank you @JianyuWang0623 :-) Could you please also update typos reported by CI? :-)

    1: .codespellrc
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/camera/camera_bkgd.c:252: defaul ==> default
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/camera/camera_main.c:537: memorys ==> memories
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/camera/camera_main.c:583: freame ==> frame
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/camera/camera_main.c:585: memorys ==> memories
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/camera/camera_main.c:606: valiable ==> variable, valuable, available

Fix typos found by codespell:
- camera_bkgd.c: defaul -> default
- camera_main.c: memorys -> memories (2 occurrences)
- camera_main.c: freame -> frame
- camera_main.c: valiable -> variable

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @JianyuWang0623 good catch! :-)

Lets just make sure CI completes without complaining :D

@simbit18 simbit18 merged commit 8cd9e9a into apache:master Mar 16, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants