Showing the changes to interface/src/SerialInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -31,7 +31,7 @@ const short NO_READ_MAXIMUM_MSECS = 3000; · 30 unmodified lines | |||
| 31 | const int GRAVITY_SAMPLES = 60; // Use the first few samples to baseline values | 31 | const int GRAVITY_SAMPLES = 60; // Use the first few samples to baseline values |
| 32 | const int NORTH_SAMPLES = 30; | 32 | const int NORTH_SAMPLES = 30; |
| 33 | const int ACCELERATION_SENSOR_FUSION_SAMPLES = 20; | 33 | const int ACCELERATION_SENSOR_FUSION_SAMPLES = 20; |
| 34 | const int COMPASS_SENSOR_FUSION_SAMPLES = 200; | 34 | const int COMPASS_SENSOR_FUSION_SAMPLES = 100; |
| 35 | const int LONG_TERM_RATE_SAMPLES = 1000; | 35 | const int LONG_TERM_RATE_SAMPLES = 1000; |
| 36 | 36 | ||
| 37 | const bool USING_INVENSENSE_MPU9150 = 1; | 37 | const bool USING_INVENSENSE_MPU9150 = 1; |
| @@ -383,7 +383,7 @@ void SerialInterface::resetSerial() { · 345 unmodified lines | |||
| 383 | glm::vec3 SerialInterface::recenterCompass(const glm::vec3& compass) { | 383 | glm::vec3 SerialInterface::recenterCompass(const glm::vec3& compass) { |
| 384 | // compensate for "hard iron" distortion by subtracting the midpoint on each axis; see | 384 | // compensate for "hard iron" distortion by subtracting the midpoint on each axis; see |
| 385 | // http://www.sensorsmag.com/sensors/motion-velocity-displacement/compensating-tilt-hard-iron-and-soft-iron-effects-6475 | 385 | // http://www.sensorsmag.com/sensors/motion-velocity-displacement/compensating-tilt-hard-iron-and-soft-iron-effects-6475 |
| 386 | return compass - (_compassMinima + _compassMaxima) * 0.5f; | 386 | return (compass - (_compassMinima + _compassMaxima) * 0.5f) / (_compassMaxima - _compassMinima); |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | 389 | ||