From: Keith Packard Date: Mon, 7 Mar 2011 05:57:52 +0000 (-0800) Subject: altos/test: Use ao_convert.c instead of hand-coded pres → alt func X-Git-Tag: 0.9.3~148 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=e339ffd8bd8b9e3f4758017ba355028000cb612e altos/test: Use ao_convert.c instead of hand-coded pres → alt func Fix up ao_convert.c so that it can be used within the flight test code instead of having a (broken) copy of the code there. Signed-off-by: Keith Packard --- diff --git a/src/ao_convert.c b/src/ao_convert.c index cec4c29f..0969f107 100644 --- a/src/ao_convert.c +++ b/src/ao_convert.c @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef AO_CONVERT_TEST +#if !defined(AO_CONVERT_TEST) && !defined(AO_FLIGHT_TEST) #include "ao.h" #endif diff --git a/src/ao_flight_test.c b/src/ao_flight_test.c index e75bc8df..70888d34 100644 --- a/src/ao_flight_test.c +++ b/src/ao_flight_test.c @@ -118,30 +118,7 @@ struct ao_cmds { const char *help; }; - -static int16_t altitude_table[2048] = { -#include "altitude.h" -}; - -int16_t -ao_pres_to_altitude(int16_t pres) __reentrant -{ - pres = pres >> 4; - if (pres < 0) pres = 0; - if (pres > 2047) pres = 2047; - return altitude_table[pres]; -} - -int16_t -ao_altitude_to_pres(int16_t alt) __reentrant -{ - int16_t pres; - - for (pres = 0; pres < 2047; pres++) - if (altitude_table[pres] <= alt) - break; - return pres << 4; -} +#include "ao_convert.c" struct ao_config { uint16_t main_deploy;