altos: Respect apogee lockout time in flight algorithm
authorKeith Packard <keithp@keithp.com>
Sat, 14 Apr 2012 19:02:14 +0000 (12:02 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 14 Apr 2012 21:04:29 +0000 (14:04 -0700)
This prevents any apogee detection from occurring until the specified
number of seconds after boost. This also prevents the switch from
accel+baro to baro only mode in the Kalman filter.

The test frame work is also changed to look for Apogee lockout: in the
eeprom input file.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao_flight.c
src/test/ao_flight_test.c

index 5e19463867bb85718dabbd7ec93c9cce256290f8..494e656d5ccd3dabe5139cdd1dab6303ba84c8d0 100644 (file)
@@ -223,6 +223,17 @@ ao_flight(void)
 #endif
                case ao_flight_coast:
 
+                       /*
+                        * By customer request - allow the user
+                        * to lock out apogee detection for a specified
+                        * number of seconds.
+                        */
+                       if (ao_config.apogee_lockout) {
+                               if ((ao_sample_tick - ao_boost_tick) <
+                                   AO_SEC_TO_TICKS(ao_config.apogee_lockout))
+                                       break;
+                       }
+
                        /* apogee detect: coast to drogue deploy:
                         *
                         * speed: < 0
index 921d44e7264566eb1bc22d2d3128c228be23973e..4a8625cfaab0e44b7394fd675e1b45d8f6f515ba 100644 (file)
@@ -184,6 +184,7 @@ struct ao_config {
        int16_t         accel_plus_g;
        int16_t         accel_minus_g;
        uint8_t         pad_orientation;
+       uint16_t        apogee_lockout;
 };
 
 #define AO_PAD_ORIENTATION_ANTENNA_UP  0
@@ -523,6 +524,9 @@ ao_sleep(void *wchan)
                                ao_config.accel_minus_g = atoi(words[5]);
                        } else if (nword >= 4 && strcmp(words[0], "Main") == 0) {
                                ao_config.main_deploy = atoi(words[2]);
+                       } else if (nword >= 3 && strcmp(words[0], "Apogee") == 0 &&
+                                  strcmp(words[1], "lockout:") == 0) {
+                               ao_config.apogee_lockout = atoi(words[2]);
                        } else if (nword >= 36 && strcmp(words[0], "CALL") == 0) {
                                tick = atoi(words[10]);
                                if (!ao_flight_started) {