mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 04:31:38 +08:00
drivers/lsm303agr: fixed bug incorrectly assembling signed 16 bit integer from bytes
This commit is contained in:
@@ -315,9 +315,9 @@ int LSM303AGR::collect()
|
|||||||
const hrt_abstime timestamp_sample = hrt_absolute_time();
|
const hrt_abstime timestamp_sample = hrt_absolute_time();
|
||||||
|
|
||||||
// switch to right hand coordinate system in place
|
// switch to right hand coordinate system in place
|
||||||
float x_raw = read_reg(OUTX_L_REG_M) + (read_reg(OUTX_H_REG_M) << 8);
|
int16_t x_raw = read_reg(OUTX_L_REG_M) + (read_reg(OUTX_H_REG_M) << 8);
|
||||||
float y_raw = read_reg(OUTY_L_REG_M) + (read_reg(OUTY_H_REG_M) << 8);
|
int16_t y_raw = read_reg(OUTY_L_REG_M) + (read_reg(OUTY_H_REG_M) << 8);
|
||||||
float z_raw = -(read_reg(OUTZ_L_REG_M) + (read_reg(OUTZ_H_REG_M) << 8));
|
int16_t z_raw = -(read_reg(OUTZ_L_REG_M) + (read_reg(OUTZ_H_REG_M) << 8));
|
||||||
|
|
||||||
_px4_mag.update(timestamp_sample, x_raw, y_raw, z_raw);
|
_px4_mag.update(timestamp_sample, x_raw, y_raw, z_raw);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user