Skip to content

Tab5 camera + other stuff#558

Merged
KenVanHoeylandt merged 4 commits into
TactilityProject:mainfrom
Shadowtrance:tab5-camera-new
Jul 10, 2026
Merged

Tab5 camera + other stuff#558
KenVanHoeylandt merged 4 commits into
TactilityProject:mainfrom
Shadowtrance:tab5-camera-new

Conversation

@Shadowtrance

@Shadowtrance Shadowtrance commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Tab5 camera driver - SC2356
Custom SliderBox widget - slider with plus and minus buttons + value label and snapping
Rtc Time service + rtc api
Sdk release - only include drivers built for that specific target, eg: sc2356 driver is mipi / p4 only.
No more hardcoded manual sdk cmakelists
New function to find device by compatible string match.

Summary by CodeRabbit

  • New Features
    • Added SC2356 (SC202CS) MIPI CSI camera support on supported devices, including frame capture, rotation, and JPEG encoding.
    • Introduced shared camera and RTC driver interfaces, with an RTC time service that syncs time and reports availability.
    • Added an LVGL SliderBox widget and improved early camera oscillator setup for M5Stack Tab5.
  • Bug Fixes
    • Improved application hide flow to reliably wait for shutdown completion.
  • Documentation
    • Clarified that the simulator is not supported on Windows.

Tab5 camera driver - SC2356
Custom SliderBox widget - slider with plus and minus buttons + value label and snapping
Rtc Time service + rtc api
Sdk release - only include drivers built for that specific target, eg: sc2356 driver is mipi / p4 only.
No more hardcoded manual sdk cmakelists
New function to find device by compatible string match. no more static cast bool wildness when trying to match a single device (like M5Stack PaperS3 for example)
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0ee323cb-6f19-4704-b0b7-e427e87d3f55

📥 Commits

Reviewing files that changed from the base of the PR and between 16adfbb and 7cf88ba.

📒 Files selected for processing (2)
  • Tactility/Source/Tactility.cpp
  • TactilityKernel/source/kernel_symbols.c
🚧 Files skipped from review as they are similar to previous changes (2)
  • TactilityKernel/source/kernel_symbols.c
  • Tactility/Source/Tactility.cpp

📝 Walkthrough

Walkthrough

This PR adds SC2356 MIPI CSI camera support with kernel camera APIs, module packaging, Tab5 hardware configuration, and camera clock initialization. It introduces a shared RTC interface, migrates existing RTC drivers, and adds RTC-based system time synchronization. SDK release generation now detects available driver archives and produces driver-specific CMake files. The PR also adds an LVGL SliderBox widget, exports additional LVGL symbols, synchronizes GUI application hiding, changes internal data paths, and updates simulator documentation.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title mentions Tab5 camera but then uses vague filler phrase "other stuff," which doesn't describe the rest of the changes. Replace it with a concise, specific summary of the main change, such as Tab5 camera driver and related RTC/SDK updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
Buildscripts/release-sdk.py (1)

124-141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a post-replacement assertion to catch silent placeholder failures.

str.replace() silently does nothing if the placeholder text or indentation in the template drifts from the search string. The generated CMake file would then contain a literal # DRIVER_*_PLACEHOLDER comment instead of actual driver entries, causing confusing downstream build failures that are hard to trace back to the generator.

♻️ Proposed fix: assert placeholder was replaced
 def generate_tactility_sdk_cmake(target_path, available_drivers):
     src = os.path.join('Buildscripts', 'TactilitySDK', 'TactilitySDK.cmake')
     with open(src) as f:
         content = f.read()
     components = "\n".join(f"        {d}" for d in available_drivers)
     content = content.replace("        # DRIVER_COMPONENTS_PLACEHOLDER", components)
+    assert "# DRIVER_COMPONENTS_PLACEHOLDER" not in content, "Placeholder not replaced in TactilitySDK.cmake template"
     with open(os.path.join(target_path, 'TactilitySDK.cmake'), 'w') as f:
         f.write(content)

 def generate_tactility_sdk_top_cmakelists(target_path, available_drivers):
     src = os.path.join('Buildscripts', 'TactilitySDK', 'CMakeLists.txt')
     with open(src) as f:
         content = f.read()
     include_dirs = "\n".join(f'        "Drivers/{d}/include"' for d in available_drivers)
     content = content.replace("        # DRIVER_INCLUDE_DIRS_PLACEHOLDER", include_dirs)
+    assert "# DRIVER_INCLUDE_DIRS_PLACEHOLDER" not in content, "Placeholder not replaced in CMakeLists.txt template"
     with open(os.path.join(target_path, 'CMakeLists.txt'), 'w') as f:
         f.write(content)
Drivers/sc2356-module/source/sc2356.cpp (1)

312-322: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add VIDIOC_STREAMOFF before unmapping buffers in error cleanup path.

When jpeg_new_encoder_engine fails (line 305), VIDIOC_STREAMON has already succeeded (line 293), but err_unmap munmaps buffers without first stopping the stream. While close(state->fd) in the err_close path will eventually tear down streaming, calling STREAMOFF before munmap is the correct V4L2 cleanup sequence and avoids potential DMA-into-unmapped-buffer races on implementations that don't defer cleanup to fd close.

🔧 Proposed fix: stop stream before unmapping
 err_unmap:
+    {
+        int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        ioctl(state->fd, VIDIOC_STREAMOFF, &type);
+    }
     for (int i = 0; i < VIDEO_BUFFER_COUNT; i++) {
         if (state->buffers[i]) munmap(state->buffers[i], state->buf_lengths[i]);
     }
Devices/m5stack-tab5/Source/Configuration.cpp (1)

286-286: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Consider logging when camera oscillator init fails.

initCameraOsc() logs internally on failure, but initBoot() continues silently. This is likely intentional (board functions without camera), but consider whether a warning at the initBoot() level would help diagnose camera issues at boot.

Tactility/Source/service/rtctime/RtcTimeService.cpp (1)

75-98: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Use localtime_r here for thread safety. localtime shares static storage, so concurrent callers can race and write the wrong time to the RTC. localtime_r is the safe drop-in replacement available in this build.

Source: Learnings


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ef68af0-790f-46b3-bdfe-c5b8b32cef01

📥 Commits

Reviewing files that changed from the base of the PR and between dbb96a8 and 889f078.

📒 Files selected for processing (43)
  • Buildscripts/TactilitySDK/CMakeLists.txt
  • Buildscripts/TactilitySDK/TactilitySDK.cmake
  • Buildscripts/release-sdk.py
  • Devices/generic-esp32p4/devicetree.yaml
  • Devices/m5stack-tab5/CMakeLists.txt
  • Devices/m5stack-tab5/Source/Configuration.cpp
  • Devices/m5stack-tab5/device.properties
  • Devices/m5stack-tab5/devicetree.yaml
  • Devices/m5stack-tab5/m5stack,tab5.dts
  • Documentation/README.md
  • Drivers/bm8563-module/include/drivers/bm8563.h
  • Drivers/bm8563-module/source/bm8563.cpp
  • Drivers/bm8563-module/source/module.cpp
  • Drivers/bm8563-module/source/symbols.c
  • Drivers/rx8130ce-module/include/drivers/rx8130ce.h
  • Drivers/rx8130ce-module/source/module.cpp
  • Drivers/rx8130ce-module/source/rx8130ce.cpp
  • Drivers/rx8130ce-module/source/symbols.c
  • Drivers/sc2356-module/CMakeLists.txt
  • Drivers/sc2356-module/LICENSE-Apache-2.0.md
  • Drivers/sc2356-module/README.md
  • Drivers/sc2356-module/bindings/smartsens,sc2356.yaml
  • Drivers/sc2356-module/devicetree.yaml
  • Drivers/sc2356-module/include/bindings/sc2356.h
  • Drivers/sc2356-module/include/drivers/sc2356.h
  • Drivers/sc2356-module/include/sc2356_module.h
  • Drivers/sc2356-module/source/module.cpp
  • Drivers/sc2356-module/source/sc2356.cpp
  • Drivers/sc2356-module/source/symbols.c
  • Firmware/idf_component.yml
  • Modules/lvgl-module/source/symbols.c
  • Tactility/Include/Tactility/lvgl/SliderBox.h
  • Tactility/Include/Tactility/service/rtctime/RtcTime.h
  • Tactility/Include/Tactility/service/rtctime/RtcTimeService.h
  • Tactility/Source/Tactility.cpp
  • Tactility/Source/lvgl/SliderBox.cpp
  • Tactility/Source/service/rtctime/RtcTime.cpp
  • Tactility/Source/service/rtctime/RtcTimeService.cpp
  • TactilityKernel/include/tactility/device.h
  • TactilityKernel/include/tactility/drivers/rtc.h
  • TactilityKernel/source/device.cpp
  • TactilityKernel/source/drivers/rtc.cpp
  • TactilityKernel/source/kernel_symbols.c
💤 Files with no reviewable changes (2)
  • Drivers/bm8563-module/source/symbols.c
  • Drivers/rx8130ce-module/source/symbols.c

Comment thread Buildscripts/release-sdk.py Outdated
Comment thread Drivers/sc2356-module/source/sc2356.cpp
Comment thread Tactility/Source/service/rtctime/RtcTimeService.cpp

@KenVanHoeylandt KenVanHoeylandt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, that looks solid! I had very little feedback.

Comment thread Buildscripts/release-sdk.py Outdated
Comment thread Drivers/sc2356-module/source/sc2356.cpp
Fixed external app user data path.
fix(gui): block app teardown until onHide() completes, preventing ELF unload racing a still-running app
added camera device type and api

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ddd5114-efe6-42cb-a796-05248888befc

📥 Commits

Reviewing files that changed from the base of the PR and between 889f078 and 43f23d8.

📒 Files selected for processing (11)
  • Buildscripts/release-sdk.py
  • Drivers/sc2356-module/include/drivers/sc2356.h
  • Drivers/sc2356-module/source/module.cpp
  • Drivers/sc2356-module/source/sc2356.cpp
  • Tactility/Private/Tactility/service/gui/GuiService.h
  • Tactility/Source/app/AppPaths.cpp
  • Tactility/Source/service/gui/GuiService.cpp
  • Tactility/Source/service/rtctime/RtcTimeService.cpp
  • TactilityKernel/include/tactility/drivers/camera.h
  • TactilityKernel/source/drivers/camera.cpp
  • TactilityKernel/source/kernel_symbols.c
🚧 Files skipped from review as they are similar to previous changes (2)
  • Tactility/Source/service/rtctime/RtcTimeService.cpp
  • Drivers/sc2356-module/source/sc2356.cpp

Comment thread Tactility/Source/app/AppPaths.cpp
Comment thread Tactility/Source/service/gui/GuiService.cpp
@KenVanHoeylandt

KenVanHoeylandt commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for the new features! I like that you added the camera API. The build is red cause I cancelled it after resolving the merge conflict.

@KenVanHoeylandt KenVanHoeylandt merged commit 7a7f09b into TactilityProject:main Jul 10, 2026
3 of 13 checks passed
@Shadowtrance Shadowtrance deleted the tab5-camera-new branch July 10, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants