sensor_mag.msg: add is_external flag & set it in the mag drivers

With this we don't have to use the ioctl MAGIOCGEXTERNAL, which does not
work on POSIX (eg. RPi).
This commit is contained in:
Beat Küng
2017-06-14 19:53:07 +02:00
committed by Lorenz Meier
parent 19cdbcfd4f
commit ce7d8d2270
15 changed files with 35 additions and 27 deletions
+3 -3
View File
@@ -251,7 +251,6 @@ BMM150 :: BMM150(int bus, const char *path, bool external, enum Rotation rotatio
_external(false),
_running(false),
_call_interval(0),
_report{0},
_reports(nullptr),
_collect_phase(false),
_scale{},
@@ -344,7 +343,7 @@ int BMM150::init()
}
/* allocate basic report buffers */
_reports = new ringbuffer::RingBuffer(2, sizeof(_report));
_reports = new ringbuffer::RingBuffer(2, sizeof(mag_report));
if (_reports == nullptr) {
goto out;
@@ -433,7 +432,7 @@ BMM150::stop()
ssize_t
BMM150::read(struct file *filp, char *buffer, size_t buflen)
{
unsigned count = buflen / sizeof(_report);
unsigned count = buflen / sizeof(mag_report);
struct mag_report *mag_buf = reinterpret_cast<struct mag_report *>(buffer);
int ret = 0;
@@ -684,6 +683,7 @@ BMM150::collect()
mrb.timestamp = hrt_absolute_time();
mrb.is_external = is_external();
// report the error count as the number of bad transfers.
// This allows the higher level code to decide if it
-1
View File
@@ -228,7 +228,6 @@ private:
unsigned _call_interval;
struct mag_report _report;
ringbuffer::RingBuffer *_reports;
bool _collect_phase;