summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-05-10 23:01:16 -0700
committerKeith Packard <keithp@keithp.com>2009-05-10 23:01:16 -0700
commitba3c53636e485450f48093d0a88a6629775f7c3a (patch)
treeefee83f35f4f5faebb4f5bb5206439f2fa1fa3bb
parentb623b1098bc7a10d471730259438fb82804221d0 (diff)
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 <keithp@keithp.com>
-rw-r--r--ao_flight.c36
1 files changed, 19 insertions, 17 deletions
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: