altos/test: Use ao_convert.c instead of hand-coded pres → alt func
authorKeith Packard <keithp@keithp.com>
Mon, 7 Mar 2011 05:57:52 +0000 (21:57 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 16 Mar 2011 22:57:37 +0000 (15:57 -0700)
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 <keithp@keithp.com>
src/ao_convert.c
src/ao_flight_test.c

index cec4c29f33feff9d87d95cd6e26f2e211cc47043..0969f107928272e18f04990a428cebc3ba2dcc63 100644 (file)
@@ -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
 
index e75bc8df348f5ca8dc240aaaaed6a8900f880d73..70888d34448cd090029f951db7e33d1f38e1c9c7 100644 (file)
@@ -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;