Skip to content

feat: ported VL53L0X sensor screen. #2827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: flutter
Choose a base branch
from

Conversation

Yugesh-Kumar-S
Copy link
Contributor

@Yugesh-Kumar-S Yugesh-Kumar-S commented Aug 10, 2025

Fixes #2824

Changes

  • Ported VL53L0X sensor screen.

Screenshots / Recordings

screen-20250810-013854.mp4

Checklist:

  • No hard coding: I have used resources from strings.xml, dimens.xml and colors.xml without hard coding any value.
  • No end of file edits: No modifications done at end of resource files strings.xml, dimens.xml or colors.xml.
  • Code reformatting: I have reformatted code and fixed indentation in every file included in this pull request.
  • No extra space: My code does not contain any extra lines or extra spaces than the ones that are necessary.

Summary by Sourcery

Port the VL53L0X time-of-flight sensor by adding its communication driver, provider logic, UI screen, localization entries, and menu integration

New Features:

  • Add VL53L0X I2C driver with initialization and distance reading methods
  • Introduce VL53L0XProvider for periodic data collection and chart data management
  • Implement VL53L0XScreen UI showcasing raw distance values, live chart, and control widgets
  • Integrate 'VL53L0X' option into the sensors selection screen

Enhancements:

  • Add localization entries for distance label and its unit (mm)

Copy link
Contributor

sourcery-ai bot commented Aug 10, 2025

Reviewer's Guide

This PR adds full support for the VL53L0X distance sensor by introducing new localization keys, updating the main sensors screen navigation, implementing the I2C driver, and creating a dedicated provider and UI screen with real-time charting and controls.

File-Level Changes

Change Details Files
Extend localizations for VL53L0X labels
  • Added distance and distanceUnitLabel getters
  • Provided English translations in .arb file
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_en.dart
lib/l10n/app_en.arb
Wire VL53L0X into main sensor navigation
  • Imported VL53L0XScreen
  • Added case 'VL53L0X' in sensor selection switch
lib/view/sensors_screen.dart
Implement VL53L0X I2C communication driver
  • Created initialization sequence with register configs
  • Added methods for SPAD config, calibration, and raw reads
  • Exposed getRaw and getDistance APIs
lib/communication/sensors/vl53l0x.dart
Build Flutter UI for VL53L0X sensor screen
  • Designed raw data panel with image and value display
  • Integrated line chart widget for distance over time
  • Hooked up play/pause, looping, and control widgets
lib/view/vl53l0x_screen.dart
Add VL53L0XProvider for state management
  • Initialized sensor asynchronously with error callbacks
  • Managed periodic data collection, looping, and limits
  • Handled chart data buffering and provider disposal
lib/providers/vl53l0x_provider.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#2824 Integrate the VL53L0X (time of flight) sensor into the codebase.
#2824 Port the VL53L0X sensor screen, providing a UI for sensor data display and interaction.

Possibly linked issues

  • #0: The PR integrates the VL53L0X sensor and adds its dedicated screen, directly fulfilling the issue's requirements.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Yugesh-Kumar-S - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `lib/view/vl53l0x_screen.dart:276` </location>
<code_context>
+
+  @override
+  void dispose() {
+    _provider.dispose();
+    super.dispose();
+  }
</code_context>

<issue_to_address>
Manual dispose of provider may be redundant with ChangeNotifierProvider lifecycle.

Rely on ChangeNotifierProvider to manage disposal and remove the manual _provider.dispose() call to avoid double disposal or side effects.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
  @override
  void dispose() {
    _provider.dispose();
    super.dispose();
  }
=======
  @override
  void dispose() {
    super.dispose();
  }
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

github-actions bot commented Aug 10, 2025

Yugesh-Kumar-S and others added 2 commits August 10, 2025 22:21
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port the VL53L0X sensor screen.
1 participant