Re-order config values. Change frequency to cal
authorKeith Packard <keithp@keithp.com>
Sat, 5 Dec 2009 23:36:12 +0000 (15:36 -0800)
committerKeith Packard <keithp@keithp.com>
Sat, 5 Dec 2009 23:37:33 +0000 (15:37 -0800)
Place more often used values at top, and consistently call the radio
value 'calibration' instead of 'frequency'.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao.h
src/ao_config.c
src/ao_radio.c

index d8e1b92ac70a6fe7cd2d0247164f3fa2937de40d..39f7bea2d8db8734eb71abfbcb3ab31706687c08 100644 (file)
--- a/src/ao.h
+++ b/src/ao.h
@@ -949,7 +949,7 @@ struct ao_config {
        char            callsign[AO_MAX_CALLSIGN + 1];
        uint8_t         apogee_delay;           /* minor version 1 */
        int16_t         accel_minus_g;          /* minor version 2 */
        char            callsign[AO_MAX_CALLSIGN + 1];
        uint8_t         apogee_delay;           /* minor version 1 */
        int16_t         accel_minus_g;          /* minor version 2 */
-       uint32_t        radio_frequency;        /* minor version 3 */
+       uint32_t        radio_cal;              /* minor version 3 */
 };
 
 extern __xdata struct ao_config ao_config;
 };
 
 extern __xdata struct ao_config ao_config;
index 27a60ac1bb8d559cced00fd3f1067069ded39193..3609ec068c7048fc3261b37b851f899dadc22bcc 100644 (file)
@@ -32,7 +32,7 @@ __xdata uint8_t ao_config_mutex;
  *
  * 434.550e6 / (24e6 / 2**16) = 1186611.2
  */
  *
  * 434.550e6 / (24e6 / 2**16) = 1186611.2
  */
-#define AO_CONFIG_DEFAULT_RADIO_FREQUENCY      1186611
+#define AO_CONFIG_DEFAULT_RADIO_CAL    1186611
 
 static void
 _ao_config_put(void)
 
 static void
 _ao_config_put(void)
@@ -57,7 +57,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;
                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_frequency = AO_CONFIG_DEFAULT_RADIO_FREQUENCY;
+               ao_config.radio_cal = AO_CONFIG_DEFAULT_RADIO_CAL;
                ao_config_dirty = 1;
        }
        if (ao_config.minor < AO_CONFIG_MINOR) {
                ao_config_dirty = 1;
        }
        if (ao_config.minor < AO_CONFIG_MINOR) {
@@ -71,7 +71,7 @@ _ao_config_get(void)
                }
                /* Fixups for minor version 3 */
                if (ao_config.minor < 3)
                }
                /* Fixups for minor version 3 */
                if (ao_config.minor < 3)
-                       ao_config.radio_frequency = AO_CONFIG_DEFAULT_RADIO_FREQUENCY;
+                       ao_config.radio_cal = AO_CONFIG_DEFAULT_RADIO_CAL;
                ao_config.minor = AO_CONFIG_MINOR;
                ao_config_dirty = 1;
        }
                ao_config.minor = AO_CONFIG_MINOR;
                ao_config_dirty = 1;
        }
@@ -256,23 +256,23 @@ ao_config_apogee_delay_set(void) __reentrant
 }
 
 void
 }
 
 void
-ao_config_radio_frequency_show(void) __reentrant
+ao_config_radio_cal_show(void) __reentrant
 {
 {
-       printf("Radio frequency: %ld\n", ao_config.radio_frequency);
+       printf("Radio cal: %ld\n", ao_config.radio_cal);
 }
 
 void
 }
 
 void
-ao_config_radio_frequency_set(void) __reentrant
+ao_config_radio_cal_set(void) __reentrant
 {
        ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        ao_mutex_get(&ao_config_mutex);
        _ao_config_get();
 {
        ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        ao_mutex_get(&ao_config_mutex);
        _ao_config_get();
-       ao_config.radio_frequency = ao_cmd_lex_u32;
+       ao_config.radio_cal = ao_cmd_lex_u32;
        ao_config_dirty = 1;
        ao_mutex_put(&ao_config_mutex);
        ao_config_dirty = 1;
        ao_mutex_put(&ao_config_mutex);
-       ao_config_radio_frequency_show();
+       ao_config_radio_cal_show();
 }
 
 struct ao_config_var {
 }
 
 struct ao_config_var {
@@ -294,16 +294,16 @@ ao_config_write(void) __reentrant;
 __code struct ao_config_var ao_config_vars[] = {
        { 'm',  ao_config_main_deploy_set,      ao_config_main_deploy_show,
                "m <meters>  Set height above launch for main deploy (in meters)" },
 __code struct ao_config_var ao_config_vars[] = {
        { 'm',  ao_config_main_deploy_set,      ao_config_main_deploy_show,
                "m <meters>  Set height above launch for main deploy (in meters)" },
-       { 'a',  ao_config_accel_calibrate_set,  ao_config_accel_calibrate_show,
-               "a <+g> <-g> Set accelerometer calibration (0 for auto)" },
+       { 'd',  ao_config_apogee_delay_set,     ao_config_apogee_delay_show,
+               "d <delay>   Set apogee igniter delay (in seconds)" },
        { 'r',  ao_config_radio_channel_set,    ao_config_radio_channel_show,
                "r <channel> Set radio channel (freq = 434.550 + channel * .1)" },
        { 'r',  ao_config_radio_channel_set,    ao_config_radio_channel_show,
                "r <channel> Set radio channel (freq = 434.550 + channel * .1)" },
-       { 'f',  ao_config_radio_frequency_set,  ao_config_radio_frequency_show,
-               "f <cal>     Set radio calibration value (cal = rf/(xtal/2^16))" },
        { 'c',  ao_config_callsign_set,         ao_config_callsign_show,
                "c <call>    Set callsign broadcast in each packet (8 char max)" },
        { 'c',  ao_config_callsign_set,         ao_config_callsign_show,
                "c <call>    Set callsign broadcast in each packet (8 char max)" },
-       { 'd',  ao_config_apogee_delay_set,     ao_config_apogee_delay_show,
-               "d <delay>   Set apogee igniter delay (in seconds)" },
+       { 'a',  ao_config_accel_calibrate_set,  ao_config_accel_calibrate_show,
+               "a <+g> <-g> Set accelerometer calibration (0 for auto)" },
+       { 'f',  ao_config_radio_cal_set,        ao_config_radio_cal_show,
+               "f <cal>     Set radio calibration value (cal = rf/(xtal/2^16))" },
        { 's',  ao_config_show,                 ao_config_show,
                "s           Show current config values" },
        { 'w',  ao_config_write,                ao_config_write,
        { 's',  ao_config_show,                 ao_config_show,
                "s           Show current config values" },
        { 'w',  ao_config_write,                ao_config_write,
index 6d25df39e0d98bdb149f365a24f5f993c1dba764..4dea6dce242934f7dd8f6e7d19b461133db125c8 100644 (file)
@@ -331,9 +331,9 @@ ao_radio_get(void)
        ao_mutex_get(&ao_radio_mutex);
        ao_radio_idle();
        RF_CHANNR = ao_config.radio_channel;
        ao_mutex_get(&ao_radio_mutex);
        ao_radio_idle();
        RF_CHANNR = ao_config.radio_channel;
-       RF_FREQ2 = (uint8_t) (ao_config.radio_frequency >> 16);
-       RF_FREQ1 = (uint8_t) (ao_config.radio_frequency >> 8);
-       RF_FREQ0 = (uint8_t) (ao_config.radio_frequency);
+       RF_FREQ2 = (uint8_t) (ao_config.radio_cal >> 16);
+       RF_FREQ1 = (uint8_t) (ao_config.radio_cal >> 8);
+       RF_FREQ0 = (uint8_t) (ao_config.radio_cal);
 }
 
 #define ao_radio_put() ao_mutex_put(&ao_radio_mutex)
 }
 
 #define ao_radio_put() ao_mutex_put(&ao_radio_mutex)