Nucleo-64 version
Dependents: particle_filter_test read_sensor_data Bike_Sensor_Fusion Encoder ... more
Diff: LSM9DS0.cpp
- Revision:
- 10:73660c3d38f6
- Parent:
- 8:08932ac08cb2
- Child:
- 11:9f14f399d569
diff -r 08932ac08cb2 -r 73660c3d38f6 LSM9DS0.cpp --- a/LSM9DS0.cpp Tue Oct 25 06:21:28 2016 +0000 +++ b/LSM9DS0.cpp Tue Nov 21 05:55:24 2017 +0000 @@ -665,13 +665,13 @@ switch (gScale) { case G_SCALE_245DPS: - gRes = 245.0 / 32768.0; + gRes = 245.0f / 32768.0f; break; case G_SCALE_500DPS: - gRes = 500.0 / 32768.0; + gRes = 500.0f / 32768.0f; break; case G_SCALE_2000DPS: - gRes = 2000.0 / 32768.0; + gRes = 2000.0f / 32768.0f; break; } } @@ -681,7 +681,7 @@ // Possible accelerometer scales (and their register bit settings) are: // 2 g (000), 4g (001), 6g (010) 8g (011), 16g (100). Here's a bit of an // algorithm to calculate g/(ADC tick) based on that 3-bit value: - aRes = aScale == A_SCALE_16G ? 16.0 / 32768.0 : + aRes = aScale == A_SCALE_16G ? 16.0f / 32768.0f : (((float) aScale + 1.0f) * 2.0f) / 32768.0f; } @@ -690,7 +690,7 @@ // Possible magnetometer scales (and their register bit settings) are: // 2 Gs (00), 4 Gs (01), 8 Gs (10) 12 Gs (11). Here's a bit of an algorithm // to calculate Gs/(ADC tick) based on that 2-bit value: - mRes = mScale == M_SCALE_2GS ? 2.0 / 32768.0 : + mRes = mScale == M_SCALE_2GS ? 2.0f / 32768.0f : (float) (mScale << 2) / 32768.0f; } @@ -875,6 +875,6 @@ rollAcc = (float)atan2f(data[2], -data[1])*180.0f/PI; /* Apply Complementary Filter */ - pitch = pitch * 0.999 + pitchAcc * 0.001; - roll = roll * 0.999 + rollAcc * 0.001; + pitch = pitch * 0.999f + pitchAcc * 0.001f; + roll = roll * 0.999f + rollAcc * 0.001f; } \ No newline at end of file