Let pyro channels block waiting for flight state changes. This
allows for pyro channels to be synchronized with the main iginiter
channels.
Signed-off-by: Keith Packard <keithp@keithp.com>
/* handled separately */
continue;
+ case ao_pyro_state_less:
+ if (ao_flight_state < pyro->state_less)
+ continue;
+ break;
+ case ao_pyro_state_greater_or_equal:
+ if (ao_flight_state >= pyro->state_greater_or_equal)
+ continue;
+ break;
+
default:
continue;
}
static void
ao_pyro(void)
{
- uint8_t p;
+ uint8_t p, any_waiting;
struct ao_pyro *pyro;
ao_config_get();
ao_alarm(AO_MS_TO_TICKS(100));
ao_sleep(&ao_pyro_wakeup);
ao_clear_alarm();
+ any_waiting = 0;
for (p = 0; p < AO_PYRO_NUM; p++) {
pyro = &ao_config.pyro[p];
if (!pyro->flags)
continue;
+ any_waiting = 1;
/* Check pyro state to see if it shoule fire
*/
if (!pyro->delay_done) {
ao_pyro_fire(p);
}
+ if (!any_waiting)
+ break;
}
+ ao_exit();
}
__xdata struct ao_task ao_pyro_task;
ao_pyro_after_motor = 0x00001000,
ao_pyro_delay = 0x00002000,
+
+ ao_pyro_state_less = 0x00004000,
+ ao_pyro_state_greater_or_equal = 0x00008000,
};
struct ao_pyro {
int16_t orient_less, orient_greater;
int16_t time_less, time_greater;
int16_t delay;
+ uint8_t state_less, state_greater_or_equal;
int16_t motor;
uint16_t delay_done;
uint8_t fired;