altos/test: Adapt flight test to int16_t flight number type
[fw/altos] / src / test / ao_flight_test.c
index 8e69730ee54e1f73322de422ef677a44d9001cd7..2d862f82a944f5663281273bbcf52b1c45b859a7 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <getopt.h>
 #include <math.h>
+#define log ao_log_data
 
 #define GRAVITY 9.80665
 
@@ -344,8 +345,10 @@ struct ao_cmds {
 #include <ao_ms5607.h>
 struct ao_ms5607_prom  ao_ms5607_prom;
 #include "ao_ms5607_convert.c"
+#if TELEMEGA
 #define AO_PYRO_NUM    4
 #include <ao_pyro.h>
+#endif
 #else
 #include "ao_convert.c"
 #endif
@@ -368,7 +371,7 @@ extern int16_t ao_accel_2g;
 typedef int16_t        accel_t;
 
 uint16_t       ao_serial_number;
-uint16_t       ao_flight_number;
+int16_t                ao_flight_number;
 
 extern uint16_t        ao_sample_tick;
 
@@ -427,6 +430,9 @@ static double       ao_test_landed_time;
 static int     landed_set;
 static double  landed_time;
 static double  landed_height;
+#if AO_PYRO_NUM
+static uint16_t        pyros_fired;
+#endif
 
 #if HAS_MPU6000
 static struct ao_mpu6000_sample        ao_ground_mpu6000;
@@ -825,6 +831,10 @@ ao_sleep(void *wchan)
                                                ao_insert();
                                                return;
                                        case AO_LOG_TEMP_VOLT:
+                                               if (pyros_fired != log_mega->u.volt.pyro) {
+                                                       printf("pyro changed %x -> %x\n", pyros_fired, log_mega->u.volt.pyro);
+                                                       pyros_fired = log_mega->u.volt.pyro;
+                                               }
                                                break;
                                        case AO_LOG_GPS_TIME:
                                                ao_gps_prev = ao_gps_static;
@@ -989,7 +999,7 @@ main (int argc, char **argv)
 #else
        emulator_app="baro";
 #endif
-       while ((c = getopt_long(argc, argv, "sdi:", options, NULL)) != -1) {
+       while ((c = getopt_long(argc, argv, "sdpi:", options, NULL)) != -1) {
                switch (c) {
                case 's':
                        summary = 1;
@@ -997,6 +1007,11 @@ main (int argc, char **argv)
                case 'd':
                        ao_flight_debug = 1;
                        break;
+               case 'p':
+#if PYRO_DBG
+                       pyro_dbg = 1;
+#endif
+                       break;
                case 'i':
                        info = optarg;
                        break;