mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 10:43:34 +08:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user