Refactored debug() and log() in CDev

These functions used vprintf which is not available on all platforms.
They also do not enable line and file debug output.

Changed to macros that preserve the output format.  Uses new macro that
can be used to implement per object, runtime selectable logging

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-08-11 12:07:06 -07:00
parent be58c6abd3
commit a589d15c52
47 changed files with 202 additions and 261 deletions
+5 -5
View File
@@ -245,7 +245,7 @@ PX4FLOW::init()
&_orb_class_instance, ORB_PRIO_HIGH);
if (_distance_sensor_topic == nullptr) {
log("failed to create distance_sensor object. Did you start uOrb?");
DEVICE_LOG("failed to create distance_sensor object. Did you start uOrb?");
}
}
@@ -452,7 +452,7 @@ PX4FLOW::measure()
if (OK != ret) {
perf_count(_comms_errors);
debug("i2c::transfer returned %d", ret);
DEVICE_DEBUG("i2c::transfer returned %d", ret);
return ret;
}
@@ -480,7 +480,7 @@ PX4FLOW::collect()
}
if (ret < 0) {
debug("error reading from sensor: %d", ret);
DEVICE_DEBUG("error reading from sensor: %d", ret);
perf_count(_comms_errors);
perf_end(_sample_perf);
return ret;
@@ -598,12 +598,12 @@ void
PX4FLOW::cycle()
{
if (OK != measure()) {
debug("measure error");
DEVICE_DEBUG("measure error");
}
/* perform collection */
if (OK != collect()) {
debug("collection error");
DEVICE_DEBUG("collection error");
/* restart the measurement state machine */
start();
return;