altoslib: Correct ADXL counts_per_g
authorKeith Packard <keithp@keithp.com>
Sat, 17 Oct 2020 03:52:48 +0000 (20:52 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 22 Oct 2020 04:33:59 +0000 (21:33 -0700)
When ADXL 375 is used as a 3d accel (as on EasyMotor), need the right
counts_per_g to do conversions.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosIMU.java

index e66005f2b92f474cd68f2b2ce9442fc09a958074..2944a2a5e1131035b74eb21f2bca7a4cf0420406 100644 (file)
@@ -49,7 +49,7 @@ public class AltosIMU implements Cloneable {
                case imu_type_easytimer_v1:
                        return counts_per_g_bmx;
                case imu_type_easymotor_v2:
-                       return counts_per_g_bmx;
+                       return counts_per_g_adxl;
                default:
                        return AltosLib.MISSING;
                }
@@ -195,7 +195,7 @@ public class AltosIMU implements Cloneable {
                case imu_type_easytimer_v1:
                        return accel_x;
                case imu_type_easymotor_v2:
-                       return accel_x;
+                       return -accel_x;
                default:
                        return AltosLib.MISSING;
                }