mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 14:04:06 +08:00
drivers/lsm303agr: fixed bug incorrectly assembling signed 16 bit integer from bytes
This commit is contained in:
parent
01e3f0d586
commit
3fb8f5df62
@ -315,9 +315,9 @@ int LSM303AGR::collect()
|
||||
const hrt_abstime timestamp_sample = hrt_absolute_time();
|
||||
|
||||
// switch to right hand coordinate system in place
|
||||
float 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);
|
||||
float z_raw = -(read_reg(OUTZ_L_REG_M) + (read_reg(OUTZ_H_REG_M) << 8));
|
||||
int16_t x_raw = read_reg(OUTX_L_REG_M) + (read_reg(OUTX_H_REG_M) << 8);
|
||||
int16_t y_raw = read_reg(OUTY_L_REG_M) + (read_reg(OUTY_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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user