summaryrefslogtreecommitdiff
path: root/src/ao_flight.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-05-24 15:10:01 -0600
committerKeith Packard <keithp@keithp.com>2011-05-24 15:10:01 -0600
commit0b54d9380f3a71b772747b1ed529d8fb89289b22 (patch)
tree3a81f49d1b4ad3c5f7fb0023eb60a5e96ec37822 /src/ao_flight.c
parentc5433affea877e73a98505f174c70374c0980987 (diff)
altos: Make telescience reliably log only when told to
Use a pull-up on telescience and tri-state input on telemetrum at boot time. Enable logging by pulling the TM output low and enabling as an output, disable by pulling the TM output high and switching back to input mode. Also, ignore pin state changes for 5 seconds at boot to give things a chance to settle down. Should work when both boards are powered up together. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_flight.c')
-rw-r--r--src/ao_flight.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ao_flight.c b/src/ao_flight.c
index cfecc5af..822a20b8 100644
--- a/src/ao_flight.c
+++ b/src/ao_flight.c
@@ -168,8 +168,9 @@ ao_flight(void)
ao_wakeup(&ao_gps_data);
ao_wakeup(&ao_gps_tracking_data);
#endif
-#ifdef ASCENT_PIN
- ASCENT_PIN = 0;
+#ifdef ASCENT_SIGNAL
+ ASCENT_SIGNAL = 0;
+ ASCENT_SIGNAL_DIR |= (1 << ASCENT_SIGNAL_PIN);
#endif
ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
@@ -240,8 +241,9 @@ ao_flight(void)
/* Turn the RDF beacon back on */
ao_rdf_set(1);
-#ifdef ASCENT_PIN
- ASCENT_PIN = 1;
+#ifdef ASCENT_SIGNAL
+ ASCENT_SIGNAL_DIR &= ~(1 << ASCENT_SIGNAL_PIN);
+ ASCENT_SIGNAL = 0;
#endif
/*
* Start recording min/max height
@@ -320,9 +322,10 @@ void
ao_flight_init(void)
{
#ifdef ASCENT_SIGNAL
- ASCENT_SIGNAL = 1;
- ASCENT_SIGNAL_DIR |= (1 << ASCENT_SIGNAL_PIN);
ASCENT_SIGNAL_SEL &= ~(1 << ASCENT_SIGNAL_PIN);
+ ASCENT_SIGNAL_DIR &= ~(1 << ASCENT_SIGNAL_PIN);
+ P1INP |= (1 << ASCENT_SIGNAL_PIN);
+ ASCENT_SIGNAL = 1;
#endif
ao_flight_state = ao_flight_startup;
ao_add_task(&flight_task, ao_flight, "flight");