From: Keith Packard Date: Mon, 11 May 2009 06:01:16 +0000 (-0700) Subject: Don't re-initialize the landing range data at each apogee detect sample X-Git-Tag: 0.2~12 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=ba3c53636e485450f48093d0a88a6629775f7c3a Don't re-initialize the landing range data at each apogee detect sample The landing range values are used only after apogee detect, so we need only initialize them on the transition from apogee to drogue. Signed-off-by: Keith Packard --- diff --git a/ao_flight.c b/ao_flight.c index 91953975..3bc6b974 100644 --- a/ao_flight.c +++ b/ao_flight.c @@ -347,26 +347,28 @@ ao_flight(void) /* Enable RDF beacon */ ao_rdf_set(1); + /* + * Start recording min/max accel and pres for a while + * to figure out when the rocket has landed + */ + /* Set the 'last' limits to max range to prevent + * early resting detection + */ + ao_interval_min_accel = 0; + ao_interval_max_accel = 0x7fff; + ao_interval_min_pres = 0; + ao_interval_max_pres = 0x7fff; + + /* initialize interval values */ + ao_interval_end = ao_flight_tick + AO_INTERVAL_TICKS; + + ao_interval_cur_min_pres = ao_interval_cur_max_pres = ao_flight_pres; + ao_interval_cur_min_accel = ao_interval_cur_max_accel = ao_flight_accel; + + /* and enter drogue state */ ao_flight_state = ao_flight_drogue; ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); } - /* - * Start recording min/max accel and pres for a while - * to figure out when the rocket has landed - */ - /* Set the 'last' limits to max range to prevent - * early resting detection - */ - ao_interval_min_accel = 0; - ao_interval_max_accel = 0x7fff; - ao_interval_min_pres = 0; - ao_interval_max_pres = 0x7fff; - - /* initialize interval values */ - ao_interval_end = ao_flight_tick + AO_INTERVAL_TICKS; - - ao_interval_cur_min_pres = ao_interval_cur_max_pres = ao_flight_pres; - ao_interval_cur_min_accel = ao_interval_cur_max_accel = ao_flight_accel; break; case ao_flight_drogue: