cm8jl65: move to PX4Rangefinder and cleanup

* cm8jl65 split out header and main
* cm8jl65: move to PX4Rangefinder
* PX4Rangefinder: move signal_quality handling to PX4Rangefinder
This commit is contained in:
Daniel Agar
2019-09-25 12:52:45 -04:00
committed by GitHub
parent a217e15c5f
commit 88fb6f7b8e
7 changed files with 744 additions and 749 deletions
@@ -79,9 +79,16 @@ PX4Rangefinder::update(const hrt_abstime timestamp, const float distance, const
{
distance_sensor_s &report = _distance_sensor_pub.get();
report.timestamp = timestamp;
report.current_distance = distance;
report.signal_quality = quality;
report.timestamp = timestamp;
report.signal_quality = quality;
// if quality is unavailable (-1) set to 0 if distance is outside bounds
if (quality < 0) {
if ((distance < report.min_distance) || (distance > report.max_distance)) {
report.signal_quality = 0;
}
}
_distance_sensor_pub.update();
}
@@ -46,7 +46,7 @@ class PX4Rangefinder : public cdev::CDev
public:
PX4Rangefinder(const uint32_t device_id,
const uint8_t priority,
const uint8_t priority = ORB_PRIO_DEFAULT,
const uint8_t device_orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING);
~PX4Rangefinder() override;