add static test start and stop commands to radio protocol for telefiretwo
[fw/altos] / src / drivers / ao_pad.c
index 99a90e7739970d3954f460c28e7d3c2924801c79..28c00fe33ed51385a9384c08af5328a5d6b6b3b0 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -315,7 +316,7 @@ ao_pad(void)
                        command.tick, command.box, ao_pad_box, command.cmd, command.channels);
 
                switch (command.cmd) {
-               case AO_LAUNCH_ARM:
+               case AO_PAD_ARM:
                        if (command.box != ao_pad_box) {
                                PRINTD ("box number mismatch\n");
                                break;
@@ -337,7 +338,7 @@ ao_pad(void)
                        ao_pad_arm_time = ao_time();
                        break;
 
-               case AO_LAUNCH_QUERY:
+               case AO_PAD_QUERY:
                        if (command.box != ao_pad_box) {
                                PRINTD ("box number mismatch\n");
                                break;
@@ -356,7 +357,7 @@ ao_pad(void)
                                query.igniter_status[3]);
                        ao_radio_cmac_send(&query, sizeof (query));
                        break;
-               case AO_LAUNCH_FIRE:
+               case AO_PAD_FIRE:
                        if (!ao_pad_armed) {
                                PRINTD ("not armed\n");
                                break;
@@ -372,6 +373,31 @@ ao_pad(void)
                        ao_wakeup(&ao_pad_ignite);
                        break;
                }
+               case AO_PAD_STATIC:
+                       if (!ao_pad_armed) {
+                               PRINTD ("not armed\n");
+                               break;
+                       }
+#ifdef HAS_LOG
+                       if (!ao_log_running) ao_log_start();
+#endif
+                       if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
+                               PRINTD ("late pad arm_time %d time %d\n",
+                                       ao_pad_arm_time, ao_time());
+                               break;
+                       }
+                       PRINTD ("ignite\n");
+                       ao_pad_ignite = ao_pad_armed;
+                       ao_pad_arm_time = ao_time();
+                       ao_wakeup(&ao_pad_ignite);
+                       break;
+               }
+               case AO_PAD_ENDSTATIC:
+#ifdef HAS_LOG
+                       ao_log_stop();
+#endif
+                       break;
+               }
        }
 }