sns/VL53L1X: improve sensor setup and validation#2313
Open
ruimarinho wants to merge 1 commit intoxoseperez:devfrom
Open
sns/VL53L1X: improve sensor setup and validation#2313ruimarinho wants to merge 1 commit intoxoseperez:devfrom
ruimarinho wants to merge 1 commit intoxoseperez:devfrom
Conversation
mcspr
reviewed
Aug 2, 2020
Comment on lines
+2037
to
+2043
| #if (VL53L1X_INTER_MEASUREMENT_PERIOD <= (VL53L1X_MEASUREMENT_TIMING_BUDGET + 4)) | ||
| #error "[VL53L1X] Intermeasurement period must be greater than the timing budget + 4ms" | ||
| #endif | ||
|
|
||
| #if (VL53L1X_MEASUREMENT_TIMING_BUDGET < 20 || VL53L1X_MEASUREMENT_TIMING_BUDGET > 500) | ||
| #error "[VL53L1X] Timing budget is limited to [20, 500]" | ||
| #endif |
Collaborator
There was a problem hiding this comment.
idk if this is necessary here
- looking at the library source, you could just check setMeasurementTimingBudget() boolean result by proxying it via the sensor method and setting internal error
- this could also happen with setInterMeasurementPeriod(), never allowing startContiniuous in the begin()
thus, replacing #error with debug_msg_p() call
mcspr
reviewed
Aug 2, 2020
| void setMeasurementTimingBudget(uint32_t budget_us) { | ||
| _vl53l1x->setMeasurementTimingBudget(budget_us); | ||
| void setMeasurementTimingBudget(uint16_t budget_ms) { | ||
| _vl53l1x->setMeasurementTimingBudget(budget_ms * 1000); |
Collaborator
There was a problem hiding this comment.
Just to note, this implicitly means:
_vl53l1x->setMeasurementTimingBudget(static_cast<uint32_t>(static_cast<int>(budget_ms) * 1000)));
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.
Small improvements to VL53L1X although I am getting more and more inclined to switch to the ultra lite driver version given the difference in accuracy.
Normalizes periods to milliseconds and adds some basic config validation.