summaryrefslogtreecommitdiff
path: root/src/kernel/ao_config.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2019-04-18 14:42:15 -0700
committerKeith Packard <keithp@keithp.com>2019-04-18 14:42:15 -0700
commitdf08028ff5dd892dafa667fde1fbf9de43f82fea (patch)
tree23d337a6dc8427255b92d772716c6b850ae69de7 /src/kernel/ao_config.c
parent774001a9426493fd5c0d5a237da6cb903b1259a8 (diff)
altos: Use ao_data_accel_invert when changing orientation value
Instead of using AO_ACCEL_INVERT, use the macro which flips the values around. This fixes a bug with ADXL375 flight computers (EasyMega v2.0) where the accel cal values would be scrambled when changing orientation. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_config.c')
-rw-r--r--src/kernel/ao_config.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c
index fb7d333b..4de72c5c 100644
--- a/src/kernel/ao_config.c
+++ b/src/kernel/ao_config.c
@@ -665,10 +665,6 @@ ao_config_pad_orientation_show(void)
printf("Pad orientation: %d\n", ao_config.pad_orientation);
}
-#ifndef AO_ACCEL_INVERT
-#define AO_ACCEL_INVERT 0x7fff
-#endif
-
static void
ao_config_pad_orientation_set(void)
{
@@ -677,10 +673,10 @@ ao_config_pad_orientation_set(void)
return;
_ao_config_edit_start();
if (ao_config.pad_orientation != r) {
- int16_t t;
+ accel_t t;
t = ao_config.accel_plus_g;
- ao_config.accel_plus_g = AO_ACCEL_INVERT - ao_config.accel_minus_g;
- ao_config.accel_minus_g = AO_ACCEL_INVERT - t;
+ ao_config.accel_plus_g = ao_data_accel_invert(ao_config.accel_minus_g);
+ ao_config.accel_minus_g = ao_data_accel_invert(t);
}
ao_config.pad_orientation = r;
_ao_config_edit_finish();