mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
fix mpu6000: wrong buffer size
This commit is contained in:
@@ -100,7 +100,7 @@ MPU6000_I2C::read(unsigned reg_speed, void *data, unsigned count)
|
|||||||
*/
|
*/
|
||||||
uint32_t offset = count < sizeof(MPUReport) ? 0 : offsetof(MPUReport, status);
|
uint32_t offset = count < sizeof(MPUReport) ? 0 : offsetof(MPUReport, status);
|
||||||
uint8_t cmd = MPU6000_REG(reg_speed);
|
uint8_t cmd = MPU6000_REG(reg_speed);
|
||||||
int ret = transfer(&cmd, 1, &((uint8_t *)data)[offset], count);
|
int ret = transfer(&cmd, 1, &((uint8_t *)data)[offset], count - offset);
|
||||||
return ret == OK ? count : ret;
|
return ret == OK ? count : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user