summaryrefslogtreecommitdiff
path: root/src/kernel/ao_pyro.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-10-08 18:50:59 -0700
committerKeith Packard <keithp@keithp.com>2017-10-08 18:53:52 -0700
commitc8dbfff65dd61e42d0a02158dcb520e7710ef87e (patch)
tree8340c72f26693a0e516d190a2d56ef5ed636d3cf /src/kernel/ao_pyro.c
parent5d82209122e3b797a7345f6ad5b6710832fcdd4a (diff)
altos: Stop storing pyro fired status in config block
We already have the fired status saved in the ao_pyro_fired variable, so just use that to detect whether a channel has already been fired. Fixes possible cases where the pyro config data gets written back to eeprom with the fired bit set, which then inhibits the channel during flight. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_pyro.c')
-rw-r--r--src/kernel/ao_pyro.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c
index 0aed50d5..e5c30eec 100644
--- a/src/kernel/ao_pyro.c
+++ b/src/kernel/ao_pyro.c
@@ -76,7 +76,7 @@ uint16_t ao_pyro_fired;
#if PYRO_DBG
int pyro_dbg;
-#define DBG(...) do { if (pyro_dbg) printf("\t%d: ", (int) (pyro - ao_config.pyro)); printf(__VA_ARGS__); } while (0)
+#define DBG(...) do { if (pyro_dbg) { printf("\t%d: ", (int) (pyro - ao_config.pyro)); printf(__VA_ARGS__); } } while (0)
#else
#define DBG(...)
#endif
@@ -239,11 +239,8 @@ ao_pyro_pins_fire(uint16_t fire)
}
ao_delay(ao_config.pyro_time);
for (p = 0; p < AO_PYRO_NUM; p++) {
- if (fire & (1 << p)) {
+ if (fire & (1 << p))
ao_pyro_pin_set(p, 0);
- ao_config.pyro[p].fired = 1;
- ao_pyro_fired |= (1 << p);
- }
}
ao_delay(AO_MS_TO_TICKS(50));
}
@@ -261,7 +258,7 @@ ao_pyro_check(void)
/* Ignore igniters which have already fired
*/
- if (pyro->fired)
+ if (ao_pyro_fired & (1 << p))
continue;
/* Ignore disabled igniters
@@ -296,7 +293,7 @@ ao_pyro_check(void)
* by setting the fired bit
*/
if (!ao_pyro_ready(pyro)) {
- pyro->fired = 1;
+ ao_pyro_fired |= (1 << p);
continue;
}
@@ -307,8 +304,10 @@ ao_pyro_check(void)
fire |= (1 << p);
}
- if (fire)
+ if (fire) {
+ ao_pyro_fired |= fire;
ao_pyro_pins_fire(fire);
+ }
return any_waiting;
}