c
Diff: GY80.cpp
- Revision:
- 5:9dc0f2d15783
- Parent:
- 4:cc026f60357a
--- a/GY80.cpp Sat Oct 19 17:33:40 2013 +0000 +++ b/GY80.cpp Thu Aug 08 16:06:48 2019 +0000 @@ -83,6 +83,11 @@ accel_v[0] = (accel[0] - ACCEL_X_OFFSET) * ACCEL_X_SCALE; accel_v[1] = (accel[1] - ACCEL_Y_OFFSET) * ACCEL_Y_SCALE; accel_v[2] = (accel[2] - ACCEL_Z_OFFSET) * ACCEL_Z_SCALE; + + accel_v[0] = (accel_v[0]/255.0)*1000; + accel_v[1] = (accel[1]/255.0)*1000; + accel_v[2] = (accel[2]/255.0)*1000; + } @@ -100,9 +105,11 @@ gyro[1] = (short) ((uint16_t) buff[3] << 8 | buff[2]); gyro[2] = (short) ((uint16_t) buff[5] << 8 | buff[4]); } + gyro_v[0] = DEG2RAD((gyro[0] - GYRO_X_OFFSET) * GYRO_GAIN_X); gyro_v[1] = DEG2RAD((gyro[1] - GYRO_Y_OFFSET) * GYRO_GAIN_Y); gyro_v[2] = DEG2RAD((gyro[2] - GYRO_Z_OFFSET) * GYRO_GAIN_Z); + } void GY80::Read_Magn(float* magn_v) @@ -120,6 +127,7 @@ mag[1] = (short) ((uint16_t) buff[3] << 8 | buff[2]); mag[2] = (short) ((uint16_t) buff[5] << 8 | buff[4]); } + magn_v[0] = (mag[0] - MAGN_X_OFFSET) * MAGN_X_SCALE; magn_v[1] = (mag[1] - MAGN_Y_OFFSET) * MAGN_Y_SCALE; magn_v[2] = (mag[2] - MAGN_Z_OFFSET) * MAGN_Z_SCALE;