From caeccc0e2e68c4c0e4b6c13e7853e87cb6a06c7b Mon Sep 17 00:00:00 2001 From: Paul Wieland
Date: Tue, 28 Jan 2025 15:58:26 -0500 Subject: [PATCH] Use a MAX_DISTANCE instead of -1 --- components/ratgdo/sensor/ratgdo_sensor.cpp | 3 +++ 1 file changed, 3 insertions(+) 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