uavcannode rangefinder: only publish reading too far or too close if less than or greater than. Not equal to.

This commit is contained in:
alexklimaj 2025-02-14 09:49:36 -07:00 committed by Daniel Agar
parent 61d595dc64
commit fd5bb9e69c

View File

@ -100,10 +100,10 @@ public:
}
// reading_type
if (dist.current_distance >= dist.max_distance) {
if (dist.current_distance > dist.max_distance) {
range_sensor.reading_type = uavcan::equipment::range_sensor::Measurement::READING_TYPE_TOO_FAR;
} else if (dist.current_distance <= dist.min_distance) {
} else if (dist.current_distance < dist.min_distance) {
range_sensor.reading_type = uavcan::equipment::range_sensor::Measurement::READING_TYPE_TOO_CLOSE;
} else if (dist.signal_quality != 0) {