diff options
author | Keith Packard <keithp@keithp.com> | 2013-03-29 12:13:59 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-03-29 12:13:59 -0700 |
commit | 9aeed244879f90b5b6dab1c7ca095cc001b03fe5 (patch) | |
tree | 4e8114a4b927d2117cf6a6a24dfdb5e21d38b02e /src/core | |
parent | 86e1039e14304ac13db540f2ee3afd4ff170b8b4 (diff) |
altos: Add temporary RF power settings
These expose the raw cc115l and rfpa0133 register settings so that we
can calibrate them against measured power outputs.
I've tested them to verify that they change how much power the board
consumes, so they're clearly doing something...
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ao.h | 10 | ||||
-rw-r--r-- | src/core/ao_config.c | 60 |
2 files changed, 68 insertions, 2 deletions
diff --git a/src/core/ao.h b/src/core/ao.h index 6d617cfc..7c5c69b8 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -550,7 +550,7 @@ ao_radio_send_lots(ao_radio_fill_func fill); * ao_radio_pa */ -#if AO_RADIO_HAS_PA +#if HAS_RADIO_AMP void ao_radio_pa_on(void); @@ -715,7 +715,7 @@ extern __xdata uint8_t ao_force_freq; #endif #define AO_CONFIG_MAJOR 1 -#define AO_CONFIG_MINOR 13 +#define AO_CONFIG_MINOR 14 #define AO_AES_LEN 16 @@ -743,6 +743,12 @@ struct ao_config { struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */ #endif uint16_t aprs_interval; /* minor version 13 */ +#if HAS_RADIO_POWER + uint8_t radio_power; /* minor version 14 */ +#endif +#if HAS_RADIO_AMP + uint8_t radio_amp; /* minor version 14 */ +#endif }; #define AO_IGNITE_MODE_DUAL 0 diff --git a/src/core/ao_config.c b/src/core/ao_config.c index 9c84fe60..73608a55 100644 --- a/src/core/ao_config.c +++ b/src/core/ao_config.c @@ -47,6 +47,8 @@ __xdata uint8_t ao_config_mutex; #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ((uint32_t) 192 * (uint32_t) 1024) #endif #endif +#define AO_CONFIG_DEFAULT_RADIO_POWER 0x60 +#define AO_CONFIG_DEFAULT_RADIO_AMP 0 #if HAS_EEPROM static void @@ -141,6 +143,14 @@ _ao_config_get(void) #endif if (minor < 13) ao_config.aprs_interval = 0; +#if HAS_RADIO_POWER + if (minor < 14) + ao_config.radio_power = AO_CONFIG_DEFAULT_RADIO_POWER; + #endif +#if HAS_RADIO_AMP + if (minor < 14) + ao_config.radio_amp = AO_CONFIG_DEFAULT_RADIO_AMP; +#endif ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; } @@ -524,6 +534,48 @@ ao_config_aprs_set(void) #endif /* HAS_APRS */ +#if HAS_RADIO_AMP + +void +ao_config_radio_amp_show(void) +{ + printf ("Radio amp setting: %d\n", ao_config.radio_amp); +} + +void +ao_config_radio_amp_set(void) +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + _ao_config_edit_start(); + ao_config.radio_amp = ao_cmd_lex_i; + _ao_config_edit_finish(); +} + +#endif + +#if HAS_RADIO_POWER + +void +ao_config_radio_power_show(void) +{ + printf ("Radio power setting: %d\n", ao_config.radio_power); +} + +void +ao_config_radio_power_set(void) +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + _ao_config_edit_start(); + ao_config.radio_power = ao_cmd_lex_i; + _ao_config_edit_finish(); +} + +#endif + struct ao_config_var { __code char *str; void (*set)(void) __reentrant; @@ -557,6 +609,14 @@ __code struct ao_config_var ao_config_vars[] = { ao_config_radio_enable_set, ao_config_radio_enable_show }, { "f <cal>\0Radio calib (cal = rf/(xtal/2^16))", ao_config_radio_cal_set, ao_config_radio_cal_show }, +#if HAS_RADIO_POWER + { "p <setting>\0Radio power setting (0-255)", + ao_config_radio_power_set, ao_config_radio_power_show }, +#endif +#if HAS_RADIO_AMP + { "d <setting>\0Radio amplifier setting (0-3)", + ao_config_radio_amp_set, ao_config_radio_amp_show }, +#endif #endif /* HAS_RADIO */ #if HAS_ACCEL { "a <+g> <-g>\0Accel calib (0 for auto)", |