mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 05:03:34 +08:00
PX4FLOW driver: Prevent sensor from spamming the system on errors. Use the perf system call to look at error counters.
This commit is contained in:
@@ -200,7 +200,7 @@ PX4FLOW::PX4FLOW(int bus, int address) :
|
|||||||
_buffer_overflows(perf_alloc(PC_COUNT, "px4flow_buffer_overflows"))
|
_buffer_overflows(perf_alloc(PC_COUNT, "px4flow_buffer_overflows"))
|
||||||
{
|
{
|
||||||
// enable debug() calls
|
// enable debug() calls
|
||||||
_debug_enabled = true;
|
_debug_enabled = false;
|
||||||
|
|
||||||
// work_cancel in the dtor will explode if we don't do this...
|
// work_cancel in the dtor will explode if we don't do this...
|
||||||
memset(&_work, 0, sizeof(_work));
|
memset(&_work, 0, sizeof(_work));
|
||||||
@@ -240,7 +240,7 @@ PX4FLOW::init()
|
|||||||
_px4flow_topic = orb_advertise(ORB_ID(optical_flow), &zero_report);
|
_px4flow_topic = orb_advertise(ORB_ID(optical_flow), &zero_report);
|
||||||
|
|
||||||
if (_px4flow_topic < 0) {
|
if (_px4flow_topic < 0) {
|
||||||
debug("failed to create px4flow object. Did you start uOrb?");
|
warnx("failed to create px4flow object. Did you start uOrb?");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = OK;
|
ret = OK;
|
||||||
@@ -442,8 +442,6 @@ PX4FLOW::measure()
|
|||||||
|
|
||||||
if (OK != ret) {
|
if (OK != ret) {
|
||||||
perf_count(_comms_errors);
|
perf_count(_comms_errors);
|
||||||
log("i2c::transfer returned %d", ret);
|
|
||||||
printf("i2c::transfer flow returned %d", ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +463,7 @@ PX4FLOW::collect()
|
|||||||
ret = transfer(nullptr, 0, &val[0], 22);
|
ret = transfer(nullptr, 0, &val[0], 22);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
log("error reading from sensor: %d", ret);
|
debug("error reading from sensor: %d", ret);
|
||||||
perf_count(_comms_errors);
|
perf_count(_comms_errors);
|
||||||
perf_end(_sample_perf);
|
perf_end(_sample_perf);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -565,7 +563,7 @@ PX4FLOW::cycle()
|
|||||||
|
|
||||||
/* perform collection */
|
/* perform collection */
|
||||||
if (OK != collect()) {
|
if (OK != collect()) {
|
||||||
log("collection error");
|
debug("collection error");
|
||||||
/* restart the measurement state machine */
|
/* restart the measurement state machine */
|
||||||
start();
|
start();
|
||||||
return;
|
return;
|
||||||
@@ -592,7 +590,7 @@ PX4FLOW::cycle()
|
|||||||
|
|
||||||
/* measurement phase */
|
/* measurement phase */
|
||||||
if (OK != measure()) {
|
if (OK != measure()) {
|
||||||
log("measure error");
|
debug("measure error");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* next phase is collection */
|
/* next phase is collection */
|
||||||
|
|||||||
Reference in New Issue
Block a user