diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/ao_cmd.c | 24 | ||||
| -rw-r--r-- | src/core/ao_config.c | 26 | ||||
| -rw-r--r-- | src/core/ao_convert.c | 4 | ||||
| -rw-r--r-- | src/core/ao_convert_test.c | 5 | 
4 files changed, 34 insertions, 25 deletions
diff --git a/src/core/ao_cmd.c b/src/core/ao_cmd.c index fbf0c347..05dbfb51 100644 --- a/src/core/ao_cmd.c +++ b/src/core/ao_cmd.c @@ -37,9 +37,15 @@ put_string(__code char *s)  }  static void +backspace(void) +{ +	put_string ("\010 \010"); +} + +static void  readline(void)  { -	__pdata char c; +	char c;  	if (ao_echo())  		put_string("> ");  	cmd_len = 0; @@ -50,7 +56,7 @@ readline(void)  		if (c == '\010' || c == '\177') {  			if (cmd_len != 0) {  				if (ao_echo()) -					put_string("\010 \010"); +					backspace();  				--cmd_len;  			}  			continue; @@ -60,7 +66,7 @@ readline(void)  		if (c == '\025') {  			while (cmd_len != 0) {  				if (ao_echo()) -					put_string("\010 \010"); +					backspace();  				--cmd_len;  			}  			continue; @@ -76,11 +82,8 @@ readline(void)  			break;  		} -		if (cmd_len >= CMD_LEN - 2) { -			if (ao_echo()) -				putchar('\007'); +		if (cmd_len >= CMD_LEN - 2)  			continue; -		}  		cmd_line[cmd_len++] = c;  		if (ao_echo())  			putchar(c); @@ -271,13 +274,12 @@ help(void)  	__pdata uint8_t cmds;  	__pdata uint8_t cmd;  	__code struct ao_cmds * __pdata cs; +	const char *h;  	for (cmds = 0; cmds < ao_ncmds; cmds++) {  		cs = ao_cmds[cmds]; -		for (cmd = 0; cs[cmd].func; cmd++) -			printf("%-45s %s\n", -			       cs[cmd].help, -			       cs[cmd].help+1+strlen(cs[cmd].help)); +		for (cmd = 0; (h = cs[cmd].help); cmd++) +			printf("%-45s %s\n", h, h + 1 + strlen(h));  	}  } diff --git a/src/core/ao_config.c b/src/core/ao_config.c index cc580d66..e0dabcd9 100644 --- a/src/core/ao_config.c +++ b/src/core/ao_config.c @@ -78,6 +78,8 @@ ao_config_set_radio(void)  static void  _ao_config_get(void)  { +	uint8_t	minor; +  	if (ao_config_loaded)  		return;  #if HAS_EEPROM @@ -97,37 +99,37 @@ _ao_config_get(void)  		ao_xmemset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));  		ao_xmemcpy(&ao_config.callsign, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN),  		       sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1); -		ao_config_dirty = 1;  	} -	if (ao_config.minor != AO_CONFIG_MINOR) { +	minor = ao_config.minor; +	if (minor != AO_CONFIG_MINOR) {  		/* Fixups for minor version 1 */ -		if (ao_config.minor < 1) +		if (minor < 1)  			ao_config.apogee_delay = AO_CONFIG_DEFAULT_APOGEE_DELAY;  		/* Fixups for minor version 2 */ -		if (ao_config.minor < 2) { +		if (minor < 2) {  			ao_config.accel_plus_g = 0;  			ao_config.accel_minus_g = 0;  		}  		/* Fixups for minor version 3 */  #if HAS_RADIO -		if (ao_config.minor < 3) +		if (minor < 3)  			ao_config.radio_cal = ao_radio_cal;  #endif  		/* Fixups for minor version 4 */ -		if (ao_config.minor < 4) +		if (minor < 4)  			ao_config.flight_log_max = AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX;  		/* Fixupes for minor version 5 */ -		if (ao_config.minor < 5) +		if (minor < 5)  			ao_config.ignite_mode = AO_CONFIG_DEFAULT_IGNITE_MODE; -		if (ao_config.minor < 6) +		if (minor < 6)  			ao_config.pad_orientation = AO_CONFIG_DEFAULT_PAD_ORIENTATION; -		if (ao_config.minor < 8) +		if (minor < 8)  			ao_config.radio_enable = TRUE; -		if (ao_config.minor < 9) +		if (minor < 9)  			ao_xmemset(&ao_config.aes_key, '\0', AO_AES_LEN); -		if (ao_config.minor < 10) +		if (minor < 10)  			ao_config.frequency = 434550; -		if (ao_config.minor < 11) +		if (minor < 11)  			ao_config.apogee_lockout = 0;  		ao_config.minor = AO_CONFIG_MINOR;  		ao_config_dirty = 1; diff --git a/src/core/ao_convert.c b/src/core/ao_convert.c index 0969f107..aa9b5f48 100644 --- a/src/core/ao_convert.c +++ b/src/core/ao_convert.c @@ -41,6 +41,7 @@ ao_pres_to_altitude(int16_t pres) __reentrant  		(int32_t) altitude_table[o+1] * part + (ALT_FRAC_SCALE >> 1)) >> ALT_FRAC_BITS;  } +#if AO_NEED_ALTITUDE_TO_PRES  int16_t  ao_altitude_to_pres(int16_t alt) __reentrant  { @@ -66,7 +67,9 @@ ao_altitude_to_pres(int16_t alt) __reentrant  		pres = 0;  	return (int16_t) pres;  } +#endif +#if 0  int16_t  ao_temp_to_dC(int16_t temp) __reentrant  { @@ -83,3 +86,4 @@ ao_temp_to_dC(int16_t temp) __reentrant  	ret = ((temp - 19791) * 1012L) >> 16;  	return ret;  } +#endif diff --git a/src/core/ao_convert_test.c b/src/core/ao_convert_test.c index e2c28b73..87e76841 100644 --- a/src/core/ao_convert_test.c +++ b/src/core/ao_convert_test.c @@ -17,14 +17,15 @@  #include <stdint.h>  #define AO_CONVERT_TEST +#define AO_NEED_ALTITUDE_TO_PRES 1  #include "ao_host.h"  #include "ao_convert.c"  #define STEP	1 -static inline i_abs(int i) { return i < 0 ? -i : i; } +static inline int i_abs(int i) { return i < 0 ? -i : i; } -main () +int main (int argc, char **argv)  {  	int	i;  	int16_t p_to_a, p_to_a_to_p;  | 
