diff options
author | Keith Packard <keithp@keithp.com> | 2009-12-05 19:50:38 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-12-05 19:50:38 -0800 |
commit | 5481082b18226a0de6b377215b3b330bdbc4a6c6 (patch) | |
tree | 5943ca5d792ca05df48366f5039ee0d81d261467 /src | |
parent | 46f03ab3145a61139c8ca6fc99e8f2798728b5a9 (diff) |
Allow radio calibration to be set from ao-load
This moves the initial radio calibration value into const memory where
it will be used if no eeprom configuration value is available, either
on an unprogrammed board with eeprom or a device without an eeprom.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ao_config.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ao_config.c b/src/ao_config.c index 3609ec06..4349bca8 100644 --- a/src/ao_config.c +++ b/src/ao_config.c @@ -31,8 +31,12 @@ __xdata uint8_t ao_config_mutex; * For 434.550MHz, the frequency value is: * * 434.550e6 / (24e6 / 2**16) = 1186611.2 + * + * This value is stored in a const variable so that + * ao-load can change it during programming for + * devices that have no eeprom for config data. */ -#define AO_CONFIG_DEFAULT_RADIO_CAL 1186611 +const uint32_t ao_radio_cal = 1186611; static void _ao_config_put(void) @@ -57,7 +61,7 @@ _ao_config_get(void) memcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN, sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1); ao_config.apogee_delay = AO_CONFIG_DEFAULT_APOGEE_DELAY; - ao_config.radio_cal = AO_CONFIG_DEFAULT_RADIO_CAL; + ao_config.radio_cal = ao_radio_cal; ao_config_dirty = 1; } if (ao_config.minor < AO_CONFIG_MINOR) { @@ -71,7 +75,7 @@ _ao_config_get(void) } /* Fixups for minor version 3 */ if (ao_config.minor < 3) - ao_config.radio_cal = AO_CONFIG_DEFAULT_RADIO_CAL; + ao_config.radio_cal = ao_radio_cal; ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; } |