Skip to content

Commit

Permalink
Fix out of range data
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulWieland committed Dec 30, 2024
1 parent 89a5c28 commit 494af2b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/ratgdo/sensor/ratgdo_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace ratgdo {
VL53L4CX_MultiRangingData_t* pDistanceData = &distanceData;
uint8_t dataReady = 0;
int objCount = 0;
int16_t maxDistance = 0;
int16_t maxDistance = -1;
int status;

if (this->distance_sensor_.VL53L4CX_GetMeasurementDataReady(&dataReady) == 0 && dataReady) {
Expand All @@ -91,6 +91,7 @@ namespace ratgdo {
VL53L4CX_TargetRangeData_t *d = &pDistanceData->RangeData[i];
if (d->RangeStatus == 0) {
maxDistance = std::max(maxDistance, d->RangeMilliMeter);
maxDistance = maxDistance <= 25 ? -1 : maxDistance; // ignore the dust protection sticker
}
}

Expand Down

0 comments on commit 494af2b

Please sign in to comment.