fix(i2c): Fix I2c::probe timeout not using configured timeout#414
Merged
fix(i2c): Fix I2c::probe timeout not using configured timeout#414
I2c::probe timeout not using configured timeout#414Conversation
* Update `I2c::probe` to use `config_.timeout_ms` to determine number of ticks for i2c transaction timeout instead of hardcoded 1000 ticks. Ensures the configured i2c timeout is used properly when probing the bus, instead of a hardcoded timeout * Build and run `i2c/example` on ESP32S3 and ensure it probes the bus quickly as it should (~1 second total for all addresses)
Contributor
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
components/i2c/include/i2c.hpp:279
- Consider verifying that config_.timeout_ms is always greater than or equal to portTICK_PERIOD_MS to prevent a zero tick timeout. This check can help avoid unintended behavior when the timeout value is too low.
if (i2c_master_cmd_begin(config_.port, cmd, config_.timeout_ms / portTICK_PERIOD_MS) == ESP_OK) {
|
✅Static analysis result - no issues found! ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I2c::probeto useconfig_.timeout_msto determine number of ticks for i2c transaction timeout instead of hardcoded 1000 ticks.Motivation and Context
Ensures the configured i2c timeout is used properly when probing the bus, instead of a hardcoded timeout
How has this been tested?
i2c/exampleon ESP32S3 and ensure it probes the bus quickly as it should (~1 second total for all addresses)Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
Checklist:
Software
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action.