From b7e5b356d7ba49b0da677aea657123963a359402 Mon Sep 17 00:00:00 2001 From: Paul Wieland Date: Tue, 31 Dec 2024 15:27:34 -0500 Subject: [PATCH] update min-distance to 100mm --- components/ratgdo/ratgdo.cpp | 4 ---- components/ratgdo/sensor/ratgdo_sensor.cpp | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 309ff85..90907fa 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -32,7 +32,6 @@ namespace ratgdo { static const int CLEAR_PRESENCE = 60000; // how long to keep arriving/leaving active static const int PRESENCE_DETECT_WINDOW = 300000; // how long to calculate presence after door state change - static const int MIN_DISTANCE = 20; // ignore bugs crawling on the distance sensor void RATGDOComponent::setup() { @@ -368,9 +367,6 @@ namespace ratgdo { void RATGDOComponent::set_distance_measurement(int16_t distance) { - if (distance > 0 && distance < MIN_DISTANCE) - return; - this->last_distance_measurement = distance; // current value = [0], last value = [1] diff --git a/components/ratgdo/sensor/ratgdo_sensor.cpp b/components/ratgdo/sensor/ratgdo_sensor.cpp index 8a5217f..db9b29a 100644 --- a/components/ratgdo/sensor/ratgdo_sensor.cpp +++ b/components/ratgdo/sensor/ratgdo_sensor.cpp @@ -6,6 +6,7 @@ namespace esphome { 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 void RATGDOSensor::setup() { @@ -91,7 +92,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 + maxDistance = maxDistance <= MIN_DISTANCE ? -1 : maxDistance; } }