mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 21:13:34 +08:00
ll40ls cleanup unnecessary Device CDev usage
This commit is contained in:
@@ -125,7 +125,7 @@ int LidarLiteI2C::init()
|
|||||||
&_orb_class_instance, ORB_PRIO_LOW);
|
&_orb_class_instance, ORB_PRIO_LOW);
|
||||||
|
|
||||||
if (_distance_sensor_topic == nullptr) {
|
if (_distance_sensor_topic == nullptr) {
|
||||||
DEVICE_DEBUG("failed to create distance_sensor object. Did you start uOrb?");
|
PX4_DEBUG("failed to create distance_sensor object. Did you start uOrb?");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = OK;
|
ret = OK;
|
||||||
@@ -185,9 +185,9 @@ int LidarLiteI2C::probe()
|
|||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEVICE_DEBUG("probe failed hw_version=0x%02x sw_version=0x%02x\n",
|
PX4_DEBUG("probe failed hw_version=0x%02x sw_version=0x%02x\n",
|
||||||
(unsigned)_hw_version,
|
(unsigned)_hw_version,
|
||||||
(unsigned)_sw_version);
|
(unsigned)_sw_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not found on any address
|
// not found on any address
|
||||||
@@ -309,7 +309,7 @@ int LidarLiteI2C::measure()
|
|||||||
|
|
||||||
if (OK != ret) {
|
if (OK != ret) {
|
||||||
perf_count(_comms_errors);
|
perf_count(_comms_errors);
|
||||||
DEVICE_DEBUG("i2c::transfer returned %d", ret);
|
PX4_DEBUG("i2c::transfer returned %d", ret);
|
||||||
|
|
||||||
// if we are getting lots of I2C transfer errors try
|
// if we are getting lots of I2C transfer errors try
|
||||||
// resetting the sensor
|
// resetting the sensor
|
||||||
@@ -407,7 +407,7 @@ int LidarLiteI2C::collect()
|
|||||||
read before it is ready, so only consider it
|
read before it is ready, so only consider it
|
||||||
an error if more than 100ms has elapsed.
|
an error if more than 100ms has elapsed.
|
||||||
*/
|
*/
|
||||||
DEVICE_DEBUG("error reading from sensor: %d", ret);
|
PX4_DEBUG("error reading from sensor: %d", ret);
|
||||||
perf_count(_comms_errors);
|
perf_count(_comms_errors);
|
||||||
|
|
||||||
if (perf_event_count(_comms_errors) % 10 == 0) {
|
if (perf_event_count(_comms_errors) % 10 == 0) {
|
||||||
@@ -581,7 +581,7 @@ void LidarLiteI2C::cycle()
|
|||||||
|
|
||||||
/* try a collection */
|
/* try a collection */
|
||||||
if (OK != collect()) {
|
if (OK != collect()) {
|
||||||
DEVICE_DEBUG("collection error");
|
PX4_DEBUG("collection error");
|
||||||
|
|
||||||
/* if we've been waiting more than 200ms then
|
/* if we've been waiting more than 200ms then
|
||||||
send a new acquire */
|
send a new acquire */
|
||||||
@@ -613,7 +613,7 @@ void LidarLiteI2C::cycle()
|
|||||||
if (_collect_phase == false) {
|
if (_collect_phase == false) {
|
||||||
/* measurement phase */
|
/* measurement phase */
|
||||||
if (OK != measure()) {
|
if (OK != measure()) {
|
||||||
DEVICE_DEBUG("measure error");
|
PX4_DEBUG("measure error");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* next phase is collection. Don't switch to
|
/* next phase is collection. Don't switch to
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <drivers/drv_pwm_input.h>
|
#include <drivers/drv_pwm_input.h>
|
||||||
|
|
||||||
LidarLitePWM::LidarLitePWM(const char *path, uint8_t rotation) :
|
LidarLitePWM::LidarLitePWM(const char *path, uint8_t rotation) :
|
||||||
CDev("LidarLitePWM", path),
|
CDev(path),
|
||||||
_rotation(rotation),
|
_rotation(rotation),
|
||||||
_work{},
|
_work{},
|
||||||
_reports(nullptr),
|
_reports(nullptr),
|
||||||
@@ -111,7 +111,7 @@ int LidarLitePWM::init()
|
|||||||
&_orb_class_instance, ORB_PRIO_LOW);
|
&_orb_class_instance, ORB_PRIO_LOW);
|
||||||
|
|
||||||
if (_distance_sensor_topic == nullptr) {
|
if (_distance_sensor_topic == nullptr) {
|
||||||
DEVICE_DEBUG("failed to create distance_sensor object. Did you start uOrb?");
|
PX4_DEBUG("failed to create distance_sensor object. Did you start uOrb?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return PX4_OK;
|
return PX4_OK;
|
||||||
@@ -167,7 +167,7 @@ int LidarLitePWM::measure()
|
|||||||
perf_begin(_sample_perf);
|
perf_begin(_sample_perf);
|
||||||
|
|
||||||
if (PX4_OK != collect()) {
|
if (PX4_OK != collect()) {
|
||||||
DEVICE_DEBUG("collection error");
|
PX4_DEBUG("collection error");
|
||||||
perf_count(_read_errors);
|
perf_count(_read_errors);
|
||||||
perf_end(_sample_perf);
|
perf_end(_sample_perf);
|
||||||
return PX4_ERROR;
|
return PX4_ERROR;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LidarLitePWM : public LidarLite, public device::CDev
|
class LidarLitePWM : public LidarLite, public cdev::CDev
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LidarLitePWM(const char *path, uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING);
|
LidarLitePWM(const char *path, uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING);
|
||||||
|
|||||||
Reference in New Issue
Block a user