From 0128fef8e0e7e7683a6c38b1b7ff0f20475852fa Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Sun, 24 May 2015 15:57:42 +0100 Subject: [PATCH] drivers: more adaptations to changed message --- src/drivers/mb12xx/mb12xx.cpp | 9 +++++---- src/drivers/sf0x/sf0x.cpp | 9 +++++---- src/drivers/trone/trone.cpp | 10 ++++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/drivers/mb12xx/mb12xx.cpp b/src/drivers/mb12xx/mb12xx.cpp index 7ecfa21c9d..7fa38e0ab4 100644 --- a/src/drivers/mb12xx/mb12xx.cpp +++ b/src/drivers/mb12xx/mb12xx.cpp @@ -575,13 +575,14 @@ MB12XX::collect() struct distance_sensor_s report; report.timestamp = hrt_absolute_time(); - report.id = 1; - report.type = 1; + report.type = distance_sensor_s::MAV_DISTANCE_SENSOR_ULTRASOUND; report.orientation = 8; report.current_distance = distance_m; report.min_distance = get_minimum_distance(); report.max_distance = get_maximum_distance(); report.covariance = 0.0f; + /* TODO: set proper ID */ + report.id = 0; /* publish it, if we are the primary */ if (_distance_sensor_topic >= 0) { @@ -828,7 +829,7 @@ test() } warnx("single read"); - warnx("time: %d", report.time_boot_ms); + warnx("time: %llu", report.timestamp); /* start the sensor polling at 2Hz */ if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) { @@ -856,7 +857,7 @@ test() } warnx("periodic read %u", i); - warnx("time: %d", report.time_boot_ms); + warnx("time: %llu", report.timestamp); } /* reset the sensor polling to default rate */ diff --git a/src/drivers/sf0x/sf0x.cpp b/src/drivers/sf0x/sf0x.cpp index 86a4967f19..71660c390a 100644 --- a/src/drivers/sf0x/sf0x.cpp +++ b/src/drivers/sf0x/sf0x.cpp @@ -575,13 +575,14 @@ SF0X::collect() struct distance_sensor_s report; report.timestamp = hrt_absolute_time(); - report.id = 2; - report.type = 0; + report.type = distance_sensor_s::MAV_DISTANCE_SENSOR_LASER; report.orientation = 8; report.current_distance = distance_m; report.min_distance = get_minimum_distance(); report.max_distance = get_maximum_distance(); report.covariance = 0.0f; + /* TODO: set proper ID */ + report.id = 0; /* publish it */ orb_publish(ORB_ID(distance_sensor), _distance_sensor_topic, &report); @@ -835,7 +836,7 @@ test() warnx("single read"); warnx("val: %0.2f m", (double)report.current_distance); - warnx("time: %d", report.time_boot_ms); + warnx("time: %llu", report.timestamp); /* start the sensor polling at 2 Hz rate */ if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) { @@ -866,7 +867,7 @@ test() warnx("read #%u", i); warnx("val: %0.3f m", (double)report.current_distance); - warnx("time: %d", report.time_boot_ms); + warnx("time: %llu", report.timestamp); } /* reset the sensor polling to the default rate */ diff --git a/src/drivers/trone/trone.cpp b/src/drivers/trone/trone.cpp index ffc262a570..aba9749717 100644 --- a/src/drivers/trone/trone.cpp +++ b/src/drivers/trone/trone.cpp @@ -572,13 +572,15 @@ TRONE::collect() struct distance_sensor_s report; report.timestamp = hrt_absolute_time(); - report.id = 3; - report.type = 0; + /* there is no enum item for a combined LASER and ULTRASOUND which it should be */ + report.type = distance_sensor_s::MAV_DISTANCE_SENSOR_LASER; report.orientation = 8; report.current_distance = distance_m; report.min_distance = get_minimum_distance(); report.max_distance = get_maximum_distance(); report.covariance = 0.0f; + /* TODO: set proper ID */ + report.id = 0; /* publish it, if we are the primary */ if (_distance_sensor_topic >= 0) { @@ -807,7 +809,7 @@ test() warnx("single read"); warnx("measurement: %0.2f m", (double)report.current_distance); - warnx("time: %d", report.time_boot_ms); + warnx("time: %llu", report.timestamp); /* start the sensor polling at 2Hz */ if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) { @@ -836,7 +838,7 @@ test() warnx("periodic read %u", i); warnx("measurement: %0.3f", (double)report.current_distance); - warnx("time: %d", report.time_boot_ms); + warnx("time: %llu", report.timestamp); } /* reset the sensor polling to default rate */