/* Main flight thread. */
__pdata enum ao_flight_state ao_flight_state; /* current flight state */
-__pdata uint16_t ao_launch_tick; /* time of launch detect */
+__pdata uint16_t ao_boost_tick; /* time of launch detect */
/*
* track min/max data over a long interval to detect
*/
ao_flight_state = ao_flight_invalid;
+ /* Turn on packet system in invalid mode on TeleMetrum */
+ ao_packet_slave_start();
} else
#endif
if (!ao_flight_force_idle
ao_usb_disable();
#endif
- /* Disable packet mode in pad state */
+#if !HAS_ACCEL
+ /* Disable packet mode in pad state on TeleMini */
ao_packet_slave_stop();
+#endif
/* Turn on telemetry system */
ao_rdf_set(1);
/* Set idle mode */
ao_flight_state = ao_flight_idle;
+#if HAS_ACCEL
+ /* Turn on packet system in idle mode on TeleMetrum */
+ ao_packet_slave_start();
+#endif
+
/* signal successful initialization by turning off the LED */
ao_led_off(AO_LED_RED);
}
)
{
ao_flight_state = ao_flight_boost;
- ao_launch_tick = ao_sample_tick;
+ ao_boost_tick = ao_sample_tick;
/* start logging data */
ao_log_start();
* (15 seconds) has past.
*/
if ((ao_accel < AO_MSS_TO_ACCEL(-2.5) && ao_height > AO_M_TO_HEIGHT(100)) ||
- (int16_t) (ao_sample_tick - ao_launch_tick) > BOOST_TICKS_MAX)
+ (int16_t) (ao_sample_tick - ao_boost_tick) > BOOST_TICKS_MAX)
{
#if HAS_ACCEL
ao_flight_state = ao_flight_fast;
{
ao_flight_state = ao_flight_coast;
ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
- }
+ } else
+ goto check_re_boost;
break;
#endif
case ao_flight_coast:
ao_flight_state = ao_flight_drogue;
ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
}
+#if HAS_ACCEL
+ else {
+ check_re_boost:
+ if (ao_accel > AO_MSS_TO_ACCEL(20)) {
+ ao_boost_tick = ao_sample_tick;
+ ao_flight_state = ao_flight_boost;
+ ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+ }
+ }
+#endif
break;
case ao_flight_drogue: