From: Keith Packard Date: Wed, 15 Apr 2009 04:23:55 +0000 (-0700) Subject: use red LED to indicate system startup X-Git-Tag: sn1-flight1~9 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=9605045164882b4ca3d1317ac860b02513a51f30 use red LED to indicate system startup --- diff --git a/ao_flight.c b/ao_flight.c index f31b4cd4..5060b53c 100644 --- a/ao_flight.c +++ b/ao_flight.c @@ -20,15 +20,15 @@ /* Main flight thread. */ -__xdata struct ao_adc ao_flight_data; -__data enum flight_state ao_flight_state; -__data uint16_t ao_flight_state_tick; -__data int16_t ao_flight_accel; -__data int16_t ao_flight_pres; -__data int16_t ao_ground_pres; -__data int16_t ao_ground_accel; -__data int16_t ao_min_pres; -__data uint16_t ao_launch_time; +__xdata struct ao_adc ao_flight_data; /* last acquired data */ +__data enum flight_state ao_flight_state; /* current flight state */ +__data uint16_t ao_flight_state_tick; /* time of last data */ +__data int16_t ao_flight_accel; /* filtered acceleration */ +__data int16_t ao_flight_pres; /* filtered pressure */ +__data int16_t ao_ground_pres; /* startup pressure */ +__data int16_t ao_ground_accel; /* startup acceleration */ +__data int16_t ao_min_pres; /* minimum recorded pressure */ +__data uint16_t ao_launch_time; /* time of launch detect */ /* Accelerometer calibration * @@ -111,6 +111,8 @@ ao_flight(void) ao_flight_state_tick = ao_time(); ao_report_notify(); } + /* signal successful initialization by turning off the LED */ + ao_led_off(AO_LED_RED); break; case ao_flight_launchpad: if (ao_flight_accel < ACCEL_BOOST || diff --git a/ao_main.c b/ao_main.c index 85fb04f3..a63cadb7 100644 --- a/ao_main.c +++ b/ao_main.c @@ -24,12 +24,18 @@ main(void) while (!(SLEEP & SLEEP_XOSC_STB)) ; + /* Turn on the red LED until the system is stable */ + ao_led_init(); + ao_led_on(AO_LED_RED); + ao_timer_init(); ao_adc_init(); ao_beep_init(); - ao_led_init(); - ao_usb_init(); - ao_ee_init(); ao_cmd_init(); + ao_ee_init(); + ao_flight_init(); + ao_log_init(); + ao_report_init(); + ao_usb_init(); ao_start_scheduler(); }