From da9575fce5ff4dfe83522e290973a01c43e4661f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 10 Jun 2014 09:42:43 -0700 Subject: [PATCH] altos: Make extra pyro channel firing time configurable This adds a 'I' parameter to set the extra pyro channel firing time (in ticks). This has no effect on the main/drogue channels. Signed-off-by: Keith Packard --- src/kernel/ao_config.c | 26 ++++++++++++++++++++++++++ src/kernel/ao_config.h | 5 ++++- src/kernel/ao_pyro.c | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index b4847cdd..72170555 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -44,6 +44,7 @@ __xdata uint8_t ao_config_mutex; #define AO_CONFIG_DEFAULT_APOGEE_DELAY 0 #define AO_CONFIG_DEFAULT_IGNITE_MODE AO_IGNITE_MODE_DUAL #define AO_CONFIG_DEFAULT_PAD_ORIENTATION AO_PAD_ORIENTATION_ANTENNA_UP +#define AO_CONFIG_DEFAULT_PYRO_TIME AO_MS_TO_TICKS(50) #if HAS_EEPROM #ifndef USE_INTERNAL_FLASH #error Please define USE_INTERNAL_FLASH @@ -186,6 +187,10 @@ _ao_config_get(void) ao_config.tracker_start_horiz = AO_CONFIG_DEFAULT_TRACKER_START_HORIZ; ao_config.tracker_start_vert = AO_CONFIG_DEFAULT_TRACKER_START_VERT; } +#endif +#if AO_PYRO_NUM + if (minor < 18) + ao_config.pyro_time = AO_CONFIG_DEFAULT_PYRO_TIME; #endif ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; @@ -713,6 +718,25 @@ ao_config_tracker_set(void) } #endif /* HAS_TRACKER */ +#if AO_PYRO_NUM +void +ao_config_pyro_time_show(void) +{ + printf ("Pyro time: %d\n", ao_config.pyro_time); +} + +void +ao_config_pyro_time_set(void) +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + _ao_config_edit_start(); + ao_config.pyro_time = ao_cmd_lex_i; + _ao_config_edit_finish(); +} +#endif + struct ao_config_var { __code char *str; void (*set)(void) __reentrant; @@ -778,6 +802,8 @@ __code struct ao_config_var ao_config_vars[] = { #if AO_PYRO_NUM { "P \0Pyro channels", ao_pyro_set, ao_pyro_show }, + { "I \0Pyro firing time", + ao_config_pyro_time_set, ao_config_pyro_time_show }, #endif #if HAS_APRS { "A \0APRS packet interval (0 disable)", diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h index 7ad221c6..77f73fbe 100644 --- a/src/kernel/ao_config.h +++ b/src/kernel/ao_config.h @@ -53,7 +53,7 @@ #endif #define AO_CONFIG_MAJOR 1 -#define AO_CONFIG_MINOR 17 +#define AO_CONFIG_MINOR 18 #define AO_AES_LEN 16 @@ -99,6 +99,9 @@ struct ao_config { uint16_t tracker_start_horiz; /* minor version 17 */ uint16_t tracker_start_vert; /* minor version 17 */ #endif +#if AO_PYRO_NUM + uint16_t pyro_time; /* minor version 18 */ +#endif }; #define AO_IGNITE_MODE_DUAL 0 diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index 0ee7fbee..85d88d98 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -213,7 +213,7 @@ ao_pyro_pins_fire(uint16_t fire) if (fire & (1 << p)) ao_pyro_pin_set(p, 1); } - ao_delay(AO_MS_TO_TICKS(50)); + ao_delay(ao_config.pyro_time); for (p = 0; p < AO_PYRO_NUM; p++) { if (fire & (1 << p)) { ao_pyro_pin_set(p, 0); -- 2.30.2