From: Keith Packard Date: Sat, 8 Dec 2012 01:18:32 +0000 (-0800) Subject: altos: Make APRS interval configurable X-Git-Tag: 1.1.9.3~10^2~17 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=b28323ce91d23db5e1c3cbd1309c72aafcfbe235 altos: Make APRS interval configurable This provides a separate configuration value for APRS, allowing the interval between APRS reports to vary. Signed-off-by: Keith Packard --- diff --git a/src/core/ao.h b/src/core/ao.h index fa873efe..df5bbf48 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -684,7 +684,7 @@ extern __xdata uint8_t ao_force_freq; #endif #define AO_CONFIG_MAJOR 1 -#define AO_CONFIG_MINOR 12 +#define AO_CONFIG_MINOR 13 #define AO_AES_LEN 16 @@ -711,6 +711,7 @@ struct ao_config { #if AO_PYRO_NUM struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */ #endif + uint16_t aprs_interval; /* minor version 13 */ }; #define AO_IGNITE_MODE_DUAL 0 @@ -718,9 +719,8 @@ struct ao_config { #define AO_IGNITE_MODE_MAIN 2 #define AO_RADIO_ENABLE_CORE 1 -#define AO_RADIO_ENABLE_APRS 2 -#define AO_RADIO_DISABLE_TELEMETRY 4 -#define AO_RADIO_DISABLE_RDF 8 +#define AO_RADIO_DISABLE_TELEMETRY 2 +#define AO_RADIO_DISABLE_RDF 4 #define AO_PAD_ORIENTATION_ANTENNA_UP 0 #define AO_PAD_ORIENTATION_ANTENNA_DOWN 1 diff --git a/src/core/ao_config.c b/src/core/ao_config.c index 63158158..0aac16a6 100644 --- a/src/core/ao_config.c +++ b/src/core/ao_config.c @@ -139,6 +139,8 @@ _ao_config_get(void) if (minor < 12) memset(&ao_config.pyro, '\0', sizeof (ao_config.pyro)); #endif + if (minor < 13) + ao_config.aprs_interval = 0; ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; } @@ -498,6 +500,27 @@ ao_config_key_set(void) __reentrant } #endif +#if HAS_APRS + +void +ao_config_aprs_show(void) +{ + printf ("APRS interval: %d\n", ao_config.aprs_interval); +} + +void +ao_config_aprs_set(void) +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + _ao_config_edit_start(); + ao_config.aprs_interval = ao_cmd_lex_i; + _ao_config_edit_finish(); +} + +#endif /* HAS_APRS */ + struct ao_config_var { __code char *str; void (*set)(void) __reentrant; @@ -553,6 +576,10 @@ __code struct ao_config_var ao_config_vars[] = { #if AO_PYRO_NUM { "P \0Configure pyro channels", ao_pyro_set, ao_pyro_show }, +#endif +#if HAS_APRS + { "A \0APRS packet interval (0 disable)", + ao_config_aprs_set, ao_config_aprs_show }, #endif { "s\0Show", ao_config_show, 0 }, diff --git a/src/core/ao_telemetry.c b/src/core/ao_telemetry.c index cfc72e04..8d440e15 100644 --- a/src/core/ao_telemetry.c +++ b/src/core/ao_telemetry.c @@ -299,7 +299,6 @@ ao_telemetry(void) #endif while (ao_telemetry_interval) { - #if HAS_APRS if (!(ao_config.radio_enable & AO_RADIO_DISABLE_TELEMETRY)) #endif @@ -343,10 +342,10 @@ ao_telemetry(void) ao_radio_rdf(); } #if HAS_APRS - if ((ao_config.radio_enable & AO_RADIO_ENABLE_APRS) && + if (ao_config.aprs_interval != 0 && (int16_t) (ao_time() - ao_aprs_time) >= 0) { - ao_aprs_time = ao_time() + AO_APRS_INTERVAL_TICKS; + ao_aprs_time = ao_time() + AO_SEC_TO_TICKS(ao_config.aprs_interval); ao_aprs_send(); } #endif diff --git a/src/drivers/ao_aprs.h b/src/drivers/ao_aprs.h index e00dd75b..a033fa0b 100644 --- a/src/drivers/ao_aprs.h +++ b/src/drivers/ao_aprs.h @@ -18,8 +18,6 @@ #ifndef _AO_APRS_H_ #define _AO_APRS_H_ -#define AO_APRS_INTERVAL_TICKS AO_SEC_TO_TICKS(2) - void ao_aprs_send(void);