*
* 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
if (pyro > VOLTS_TO_PYRO(10)) {
query.arm_status = AO_PAD_ARM_STATUS_ARMED;
cur |= AO_LED_ARMED;
- } else if (pyro < VOLTS_TO_PYRO(5)) {
- query.arm_status = AO_PAD_ARM_STATUS_DISARMED;
- arm_beep_time = 0;
- } else {
+#if AO_FIRE_R_POWER_FET
+ } else if (pyro > VOLTS_TO_PYRO(5)) {
if ((ao_time() % 100) < 50)
cur |= AO_LED_ARMED;
query.arm_status = AO_PAD_ARM_STATUS_UNKNOWN;
arm_beep_time = 0;
+#endif
+ } else {
+ query.arm_status = AO_PAD_ARM_STATUS_DISARMED;
+ arm_beep_time = 0;
}
if ((ao_time() - ao_pad_packet_time) > AO_SEC_TO_TICKS(2))
cur |= AO_LED_RED;
l = byte & 0xf;
return h * 10 + l;
}
-#else
-#define ao_pad_read_box() 0
+#endif
+
+#if HAS_FIXED_PAD_BOX
+#define ao_pad_read_box() ao_config.pad_box
#endif
#ifdef PAD_BOX
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;
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;
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;
+ }
+ 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_STATIC:
if (!ao_pad_armed) {
PRINTD ("not armed\n");
break;
}
+#if 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());
ao_pad_arm_time = ao_time();
ao_wakeup(&ao_pad_ignite);
break;
+ case AO_PAD_ENDSTATIC:
+#if HAS_LOG
+ ao_log_stop();
+#endif
+ break;
}
}
}