summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-13 18:31:08 -0700
committerKeith Packard <keithp@keithp.com>2011-08-13 18:46:12 -0700
commitb0ec30de37aa822ba66d25ceaa8cf8dc967b4371 (patch)
tree5ed46bd19c238e935571c63e70f13892ba06e360 /src
parent41e5be32819d305c8268e6f992be91411ea13435 (diff)
altos: wait 10s for companion to boot
In case the companion is delayed while booting, retry the setup 10 times with a 1s delay between tries. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/ao_companion.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ao_companion.c b/src/ao_companion.c
index 8f23ba25..4c8f4269 100644
--- a/src/ao_companion.c
+++ b/src/ao_companion.c
@@ -81,7 +81,14 @@ ao_companion_notify(void)
void
ao_companion(void)
{
- ao_companion_running = ao_companion_get_setup();
+ uint8_t i;
+ while (!ao_flight_number)
+ ao_sleep(&ao_flight_number);
+ for (i = 0; i < 10; i++) {
+ ao_delay(AO_SEC_TO_TICKS(1));
+ if ((ao_companion_running = ao_companion_get_setup()))
+ break;
+ }
while (ao_companion_running) {
ao_alarm(ao_companion_setup.update_period);
if (ao_sleep(DATA_TO_XDATA(&ao_flight_state)))