Use a MAX_DISTANCE instead of -1

This commit is contained in:
Paul Wieland 2025-01-28 15:58:26 -05:00
parent b7e5b356d7
commit caeccc0e2e
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@ namespace ratgdo {
static const char* const TAG = "ratgdo.sensor";
static const int MIN_DISTANCE = 100; // ignore bugs crawling on the distance sensor & dust protection film
static const int MAX_DISTANCE = 4500; // default maximum distance
void RATGDOSensor::setup()
{
@ -96,6 +97,8 @@ namespace ratgdo {
}
}
if(maxDistance < 0) maxDistance = MAX_DISTANCE;
//maxDistance = objCount == 0 ? -1 : pDistanceData->RangeData[objCount - 1].RangeMilliMeter;
/*
* if the sensor is pointed at glass, there are many error -1 readings which will fill the