diff options
| author | Keith Packard <keithp@keithp.com> | 2017-10-08 18:50:59 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-10-08 18:53:52 -0700 | 
| commit | c8dbfff65dd61e42d0a02158dcb520e7710ef87e (patch) | |
| tree | 8340c72f26693a0e516d190a2d56ef5ed636d3cf | |
| parent | 5d82209122e3b797a7345f6ad5b6710832fcdd4a (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>
| -rw-r--r-- | src/kernel/ao_pyro.c | 15 | ||||
| -rw-r--r-- | src/kernel/ao_pyro.h | 2 | 
2 files changed, 8 insertions, 9 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;  } diff --git a/src/kernel/ao_pyro.h b/src/kernel/ao_pyro.h index a730ef19..3ab5af3b 100644 --- a/src/kernel/ao_pyro.h +++ b/src/kernel/ao_pyro.h @@ -63,7 +63,7 @@ struct ao_pyro {  	uint8_t			state_less, state_greater_or_equal;  	int16_t			motor;  	uint16_t		delay_done; -	uint8_t			fired; +	uint8_t			_unused;	/* was 'fired' */  };  #define AO_PYRO_8_BIT_VALUE	(ao_pyro_state_less|ao_pyro_state_greater_or_equal) | 
