first cut at turnon scripts for EasyTimer v2
[fw/altos] / src / kernel / ao_fake_flight.c
index 11329bb9c06743e269df3170eb6044dece95cbce..e14daa0623e6d6f79e58d6b3511e1e486aaaa272 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +27,7 @@ uint8_t                       ao_fake_flight_active;
 static uint8_t         ao_fake_has_cur;
 static volatile uint8_t        ao_fake_has_next;
 static uint8_t         ao_fake_has_offset;
-static uint16_t                ao_fake_tick_offset;
+static AO_TICK_TYPE    ao_fake_tick_offset;
 static struct ao_data  ao_fake_cur, ao_fake_next;
 
 void
@@ -53,7 +54,7 @@ ao_fake_data_read(void)
        uint8_t *d = (void *) &ao_fake_next;
 
        if (getchar() == 0)
-               return FALSE;
+               return false;
        for (i = 0; i < sizeof (struct ao_data); i++)
                *d++ = getchar();
        if (!ao_fake_has_offset) {
@@ -63,7 +64,7 @@ ao_fake_data_read(void)
        } else
                ao_fake_next.tick += ao_fake_tick_offset;
        ao_fake_has_next = 1;
-       return TRUE;
+       return true;
 }
 
 static void
@@ -117,10 +118,10 @@ ao_fake_calib_read(void)
                ) {
                printf ("Calibration data major version mismatch %d.%d <= %d.%d\n",
                        ao_calib.major, ao_calib.minor, AO_FAKE_CALIB_MAJOR, AO_FAKE_CALIB_MINOR);
-               return FALSE;
+               return false;
        }
        ao_fake_calib_set(&ao_calib);
-       return TRUE;
+       return true;
 }
 
 static void
@@ -132,14 +133,12 @@ ao_fake_flight(void)
        enum ao_flight_state    my_state = ao_flight_invalid;
        int                     i;
 
-       ao_cmd_hex();
+       calib_size = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       calib_size = ao_cmd_lex_i;
-       ao_cmd_hex();
+       data_size = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       data_size = ao_cmd_lex_i;
        if ((unsigned) calib_size != sizeof (struct ao_fake_calib)) {
                printf ("calib size %d larger than actual size %d\n",
                        calib_size, sizeof (struct ao_fake_calib));