1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-475 Use signed int for sensor data to avoid data overflow corruption when applying adjustment factor.

This commit is contained in:
Vladimir Zidar 2017-01-19 17:07:15 +01:00
parent 01679ee02b
commit 100d073e95

View File

@ -117,7 +117,7 @@ typedef union {
} data;
} __attribute__((__packed__)) mpu9250_data_t;
#define GET_SENSOR_DATA(mpudataptr, sensor) (mpudataptr.data.sensor##_h << 8 | mpudataptr.data.sensor##_l)
#define GET_SENSOR_DATA(mpudataptr, sensor) ((int16_t)((mpudataptr.data.sensor##_h << 8 | mpudataptr.data.sensor##_l)))
static PIOS_SENSORS_3Axis_SensorsWithTemp *queue_data = 0;
static PIOS_SENSORS_3Axis_SensorsWithTemp *mag_data = 0;