diff --git a/components/ratgdo/sensor/ratgdo_sensor.cpp b/components/ratgdo/sensor/ratgdo_sensor.cpp index db9b29a..4a0d831 100644 --- a/components/ratgdo/sensor/ratgdo_sensor.cpp +++ b/components/ratgdo/sensor/ratgdo_sensor.cpp @@ -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