altos: Keep relay closed while firing launcher
authorKeith Packard <keithp@keithp.com>
Tue, 2 Aug 2011 00:06:49 +0000 (17:06 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 27 Aug 2011 19:45:36 +0000 (12:45 -0700)
Instead of opening the relay while checking the desired state, keep it
closed until the state goes off.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_launch.c

index 35afbda860111e3fce60792f396b1d1609097abf..a593d0b2b624f94a16a98cab68a0a52e0f76d308 100644 (file)
@@ -31,17 +31,17 @@ ao_launch_run(void)
        for (;;) {
                while (!ao_launch_ignite)
                        ao_sleep(&ao_launch_ignite);
+               ao_ignition[ao_igniter_drogue].firing = 1;
+               ao_ignition[ao_igniter_main].firing = 1;
+               AO_IGNITER_DIR |= AO_IGNITER_DROGUE_BIT | AO_IGNITER_MAIN_BIT;
+               AO_IGNITER_DROGUE = 1;
                while (ao_launch_ignite) {
                        ao_launch_ignite = 0;
-
-                       ao_ignition[ao_igniter_drogue].firing = 1;
-                       ao_ignition[ao_igniter_main].firing = 1;
-                       AO_IGNITER_DROGUE = 1;
                        ao_delay(AO_MS_TO_TICKS(500));
-                       AO_IGNITER_DROGUE = 0;
-                       ao_ignition[ao_igniter_drogue].firing = 0;
-                       ao_ignition[ao_igniter_main].firing = 0;
                }
+               AO_IGNITER_DROGUE = 0;
+               ao_ignition[ao_igniter_drogue].firing = 0;
+               ao_ignition[ao_igniter_main].firing = 0;
        }
 }