altos/telefire: Add firing length to manual pad command
authorKeith Packard <keithp@keithp.com>
Thu, 4 Sep 2014 05:12:15 +0000 (22:12 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 4 Sep 2014 05:12:15 +0000 (22:12 -0700)
This adds an optional length of time (in 1/10s of a second) to the
ao_pad_manual function to enable testing of igniters without needing
to use TeleLCO.

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

index 144cbd70a8834e4053e67c6bebec423e68ae8175..dc2c83fe0cf3c668668dfbf354cbae020d14533f 100644 (file)
@@ -362,14 +362,26 @@ ao_pad_test(void)
 void
 ao_pad_manual(void)
 {
+       uint8_t ignite;
+       int     repeat;
        ao_cmd_white();
        if (!ao_match_word("DoIt"))
                return;
        ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       ao_pad_ignite = 1 << ao_cmd_lex_i;
-       ao_wakeup(&ao_pad_ignite);
+       ignite = 1 << ao_cmd_lex_i;
+       ao_cmd_decimal();
+       if (ao_cmd_status != ao_cmd_success) {
+               repeat = 1;
+               ao_cmd_status = ao_cmd_success;
+       } else
+               repeat = ao_cmd_lex_i;
+       while (repeat-- > 0) {
+               ao_pad_ignite = ignite;
+               ao_wakeup(&ao_pad_ignite);
+               ao_delay(AO_PAD_FIRE_TIME>>1);
+       }
 }
 
 static __xdata struct ao_task ao_pad_task;