From 71fa064bc7dd054341ba95cbbda10fb076eb6b2c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 17 Jan 2017 12:06:14 +0100 Subject: [PATCH] MPU6K: Fix device ID --- src/drivers/mpu6500/mpu6500.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/drivers/mpu6500/mpu6500.cpp b/src/drivers/mpu6500/mpu6500.cpp index 3804a1fcc4..de36d2e84b 100644 --- a/src/drivers/mpu6500/mpu6500.cpp +++ b/src/drivers/mpu6500/mpu6500.cpp @@ -1833,8 +1833,8 @@ MPU6500::measure() arb.temperature_raw = report.temp; arb.temperature = _last_temperature; - /* Return class instance as a surrogate device ID */ - arb.device_id = _accel_class_instance; + /* return device ID */ + arb.device_id = _device_id; grb.x_raw = report.gyro_x; grb.y_raw = report.gyro_y; @@ -1869,9 +1869,8 @@ MPU6500::measure() grb.temperature_raw = report.temp; grb.temperature = _last_temperature; - /* Use class instance as a surrogate hardware ID */ - grb.device_id = _gyro->_gyro_class_instance; - grb.device_id = 0; + /* return device ID */ + grb.device_id = _gyro->_device_id; _accel_reports->force(&arb); _gyro_reports->force(&grb); @@ -2091,7 +2090,7 @@ start(bool external_bus, enum Rotation rotation, int range) fail: if (*g_dev_ptr != nullptr) { - delete(*g_dev_ptr); + delete *g_dev_ptr; *g_dev_ptr = nullptr; }