4870869e8d248fb147a256830e93da671a4a4900
[fw/altos] / src / ao_launch.c
1 /*
2  * Copyright © 2011 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #include "ao.h"
19
20 static void
21 ao_launch(void)
22 {
23         enum    ao_igniter_status       arm_status, ignite_status;
24
25         ao_led_off(AO_LED_RED);
26         ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
27         for (;;) {
28                 arm_status = ao_igniter_status(ao_igniter_drogue);
29
30                 switch (arm_status) {
31                 case ao_igniter_unknown:
32                         break;
33                 case ao_igniter_active:
34                 case ao_igniter_open:
35                         break;
36                 case ao_igniter_ready:
37                         ignite_status = ao_igniter_status(ao_igniter_main);
38                         switch (ignite_status) {
39                         case ao_igniter_unknown:
40                                 /* some kind of failure signal here */
41                                 break;
42                         case ao_igniter_active:
43                                 break;
44                         case ao_igniter_open:
45                                 break;
46                         }
47                         break;
48                 }
49                 ao_delay(AO_SEC_TO_TICKS(1));
50         }
51 }
52
53 static __xdata struct ao_task ao_launch_task;
54
55 void
56 ao_launch_init(void)
57 {
58         ao_add_task(&ao_launch_task, ao_launch, "launch status");
59 }