Skip to content
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

docs: 2144 - ctrehan/2144 #2662

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

ChehakTrehan
Copy link
Contributor

@ChehakTrehan ChehakTrehan commented Apr 2, 2025

Updated Address of MPU6050

Summary by Sourcery

Update sensor address for MPU6050 and add localization strings for various sensors and UI elements

Enhancements:

  • Update MPU6050 sensor I2C address from 0x68 to 0x69 across multiple files

Documentation:

  • Add localization strings for documentation, color, sensor, and plot-related terms in multiple languages

Chores:

  • Minor formatting change for lux unit string

Copy link

sourcery-ai bot commented Apr 2, 2025

Reviewer's Guide by Sourcery

This pull request updates the I2C address of the MPU6050 sensor and adds new string resources for sensor data representation and a 'Documentation' navigation item. The sensor address was updated across multiple files to ensure consistency. New string resources were added to support the display of various sensor readings and a new navigation option in multiple languages.

Updated class diagram for MPU6050

classDiagram
  class MPU6050 {
    -int ADDRESS
    +MPU6050()
    +readSensor()
  }
  note for MPU6050 "Address changed from 0x68 to 0x69"
Loading

Updated class diagram for MPU925x

classDiagram
  class MPU925x {
    -int ADDRESS
    +MPU925x()
    +readSensor()
  }
  note for MPU925x "Address changed from 0x68 to 0x69"
Loading

File-Level Changes

Change Details Files
Updated the I2C address for the MPU6050 sensor from 0x68 to 0x69.
  • Changed the sensor address in SensorActivity.java.
  • Changed the sensor address in SensorDataLoggerActivity.java.
  • Changed the sensor address in SensorList.java.
  • Changed the sensor address in MPU6050.java.
  • Changed the sensor address in MPU925x.java.
app/src/main/java/io/pslab/activity/SensorActivity.java
app/src/main/java/io/pslab/activity/SensorDataLoggerActivity.java
app/src/main/java/io/pslab/communication/SensorList.java
app/src/main/java/io/pslab/communication/sensors/MPU6050.java
app/src/main/java/io/pslab/communication/sensors/MPU925x.java
Added new string resources for sensor data representation and navigation.
  • Added string resources for 'Documentation' navigation item.
  • Added string resources for representing sensor data like color values (red, green, blue), gesture, eCO2, eTVOC, proximity, and light intensity (lux).
  • Added string resources for plot labels and units related to lux and proximity.
app/src/main/res/values-ar/strings.xml
app/src/main/res/values-pl/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/main/res/values-si/string.xml
app/src/main/res/values/strings.xml

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

@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 @ChehakTrehan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The commit message should reflect both the address change and the string additions.
  • Be sure to check that MPU925x should also have its address updated.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

Comment on lines +81 to 84
sensorAddr.put(0x69, "MPU6050");
sensorAddr.put(0x40, "SHT21");
sensorAddr.put(0x39, "TSL2561");
sensorAddr.put(0x69, "MPU925x");
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Duplicate key mapping for 0x69 in sensorAddr may lead to unintended overrides.

Both MPU6050 and MPU925x are mapped to the same I2C address key (0x69), which means the latter mapping will overwrite the earlier one. It’s important to verify whether these devices should share the same address or if a distinct address or strategy (such as separate maps or composite values) is required.

Comment on lines +28 to 29
sensorList.put(0x69, new String[]{"MPU-6050/GY-521 accel+gyro+temp", "ITG3200", "DS1307", "DS3231"});
sensorList.put(0x69, new String[]{"ITG3200"});
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Conflicting entries for key 0x69 in sensorList could result in inadvertent data loss.

The first mapping for 0x69 (associating multiple sensor names including MPU-6050) is being overwritten by the second mapping (only "ITG3200") because map keys must be unique. Please double-check the intended sensor addressing to ensure both sets of sensor identifications are preserved or differentiated.

@ChehakTrehan ChehakTrehan changed the title Doc : 2144 - ctrehan/2144 docs : 2144 - ctrehan/2144 Apr 2, 2025
@ChehakTrehan ChehakTrehan changed the title docs : 2144 - ctrehan/2144 docs: 2144 - ctrehan/2144 Apr 2, 2025
@marcnause marcnause added the Status: Review Required Requested reviews from peers and maintainers label Apr 2, 2025
@marcnause marcnause self-requested a review April 2, 2025 21:01
@marcnause
Copy link
Contributor

@ChehakTrehan: Is this a duplicate of #2660? Should the ID of the MPU6050 really be changes or is this a mistake?

@AsCress
Copy link
Collaborator

AsCress commented Apr 4, 2025

@ChehakTrehan You might want to go through the discussion here.
Also, please always make your changes rebased over upstream development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Required Requested reviews from peers and maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants