summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/kernel/ao_config.c10
-rw-r--r--src/kernel/ao_data.h2
-rw-r--r--src/telefireone-v1.0/Makefile2
3 files changed, 5 insertions, 9 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();
diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h
index dda5de4c..abbace8e 100644
--- a/src/kernel/ao_data.h
+++ b/src/kernel/ao_data.h
@@ -328,8 +328,6 @@ typedef int16_t accel_t;
#define HAS_ACCEL 1
-#define AO_ACCEL_INVERT 0
-
typedef int16_t accel_t;
/* MPU6000 is hooked up so that positive y is positive acceleration */
diff --git a/src/telefireone-v1.0/Makefile b/src/telefireone-v1.0/Makefile
index b2e7eec4..afcdcd67 100644
--- a/src/telefireone-v1.0/Makefile
+++ b/src/telefireone-v1.0/Makefile
@@ -89,3 +89,5 @@ install:
uninstall:
+echo:
+ echo $(PROG) $(VERSION)