altos: Make MS5607 PROM a public variable
[fw/altos] / src / test / ao_flight_test.c
index 0abb4090d397e0a615ea1ca31a00288f7057d5a5..1ee3ad2756fd9d79cf0d8ea28c656be5f3f2ba15 100644 (file)
@@ -309,7 +309,7 @@ struct ao_cmds {
 #if TELEMEGA
 #include "ao_convert_pa.c"
 #include <ao_ms5607.h>
-struct ao_ms5607_prom  ms5607_prom;
+struct ao_ms5607_prom  ao_ms5607_prom;
 #include "ao_ms5607_convert.c"
 #define AO_PYRO_NUM    4
 #include <ao_pyro.h>
@@ -732,6 +732,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 +780,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 +803,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;