putchar(c);
}
+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;
if (c == '\010' || c == '\177') {
if (cmd_len != 0) {
if (ao_echo())
- put_string("\010 \010");
+ backspace();
--cmd_len;
}
continue;
if (c == '\025') {
while (cmd_len != 0) {
if (ao_echo())
- put_string("\010 \010");
+ backspace();
--cmd_len;
}
continue;
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);
__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));
}
}
static void
_ao_config_get(void)
{
+ uint8_t minor;
+
if (ao_config_loaded)
return;
#if HAS_EEPROM
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;