From: Keith Packard Date: Thu, 18 Apr 2019 21:42:15 +0000 (-0700) Subject: altos: Use ao_data_accel_invert when changing orientation value X-Git-Tag: 1.9.1~1^2~98 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=df08028ff5dd892dafa667fde1fbf9de43f82fea;ds=sidebyside 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 --- 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)