X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Ftest%2Fao_flight_test.c;h=0647fc6c3e97206381af8c6814484216706bd052;hp=0abb4090d397e0a615ea1ca31a00288f7057d5a5;hb=535271f7312f1a88af11d4f1dbf3d405b660f26c;hpb=cdb32b1717db4e8cb8cf94d810e74ce2b569566b diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 0abb4090..0647fc6c 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -49,13 +49,12 @@ int ao_gps_new; #define HAS_MPU6000 1 #define HAS_MMA655X 1 #define HAS_HMC5883 1 +#define HAS_BEEP 1 struct ao_adc { int16_t sense[AO_ADC_NUM_SENSE]; int16_t v_batt; int16_t v_pbatt; - int16_t accel_ref; - int16_t accel; int16_t temp; }; #else @@ -309,7 +308,7 @@ struct ao_cmds { #if TELEMEGA #include "ao_convert_pa.c" #include -struct ao_ms5607_prom ms5607_prom; +struct ao_ms5607_prom ao_ms5607_prom; #include "ao_ms5607_convert.c" #define AO_PYRO_NUM 4 #include @@ -317,22 +316,8 @@ struct ao_ms5607_prom ms5607_prom; #include "ao_convert.c" #endif -struct ao_config { - uint16_t main_deploy; - int16_t accel_plus_g; - int16_t accel_minus_g; - uint8_t pad_orientation; - uint16_t apogee_lockout; -#if TELEMEGA - struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */ - int16_t accel_zero_along; - int16_t accel_zero_across; - int16_t accel_zero_through; -#endif -}; - -#define AO_PAD_ORIENTATION_ANTENNA_UP 0 -#define AO_PAD_ORIENTATION_ANTENNA_DOWN 1 +#include +#include #define ao_config_get() @@ -732,6 +717,18 @@ ao_sleep(void *wchan) ao_flight_started = 1; ao_ground_pres = int32(bytes, 4); ao_ground_height = ao_pa_to_altitude(ao_ground_pres); + ao_ground_accel_along = int16(bytes, 8); + ao_ground_accel_across = int16(bytes, 10); + ao_ground_accel_through = int16(bytes, 12); + ao_ground_roll = int16(bytes, 14); + ao_ground_pitch = int16(bytes, 16); + ao_ground_yaw = int16(bytes, 18); + ao_ground_mpu6000.accel_x = ao_ground_accel_across; + ao_ground_mpu6000.accel_y = ao_ground_accel_along; + ao_ground_mpu6000.accel_z = ao_ground_accel_through; + ao_ground_mpu6000.gyro_x = ao_ground_pitch >> 9; + ao_ground_mpu6000.gyro_y = ao_ground_roll >> 9; + ao_ground_mpu6000.gyro_z = ao_ground_yaw >> 9; break; case 'A': ao_data_static.tick = tick; @@ -768,21 +765,21 @@ ao_sleep(void *wchan) continue; } else if (nword == 3 && strcmp(words[0], "ms5607") == 0) { if (strcmp(words[1], "reserved:") == 0) - ms5607_prom.reserved = strtoul(words[2], NULL, 10); + ao_ms5607_prom.reserved = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "sens:") == 0) - ms5607_prom.sens = strtoul(words[2], NULL, 10); + ao_ms5607_prom.sens = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "off:") == 0) - ms5607_prom.off = strtoul(words[2], NULL, 10); + ao_ms5607_prom.off = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "tcs:") == 0) - ms5607_prom.tcs = strtoul(words[2], NULL, 10); + ao_ms5607_prom.tcs = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "tco:") == 0) - ms5607_prom.tco = strtoul(words[2], NULL, 10); + ao_ms5607_prom.tco = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "tref:") == 0) - ms5607_prom.tref = strtoul(words[2], NULL, 10); + ao_ms5607_prom.tref = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "tempsens:") == 0) - ms5607_prom.tempsens = strtoul(words[2], NULL, 10); + ao_ms5607_prom.tempsens = strtoul(words[2], NULL, 10); else if (strcmp(words[1], "crc:") == 0) - ms5607_prom.crc = strtoul(words[2], NULL, 10); + ao_ms5607_prom.crc = strtoul(words[2], NULL, 10); continue; } else if (nword >= 3 && strcmp(words[0], "Pyro") == 0) { int p = strtoul(words[1], NULL, 10); @@ -791,7 +788,7 @@ ao_sleep(void *wchan) for (i = 2; i < nword; i++) { for (j = 0; j < NUM_PYRO_VALUES; j++) - if (!strcmp (words[2], ao_pyro_values[j].name)) + if (!strcmp (words[i], ao_pyro_values[j].name)) break; if (j == NUM_PYRO_VALUES) continue; @@ -991,6 +988,7 @@ void run_flight_fixed(char *name, FILE *f, int summary, char *info) emulator_in = f; emulator_info = info; ao_summary = summary; + ao_flight_init(); ao_flight(); }