projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Complete new telemetry switchover
[fw/altos]
/
src
/
ao_cmd.c
diff --git
a/src/ao_cmd.c
b/src/ao_cmd.c
index 50d5b96fd9afe4a9355377ebd764a753efe244d4..3f020dc3a3b30a38a97402cb9894a7fa3f35f1ff 100644
(file)
--- a/
src/ao_cmd.c
+++ b/
src/ao_cmd.c
@@
-21,7
+21,6
@@
__xdata uint16_t ao_cmd_lex_i;
__xdata uint32_t ao_cmd_lex_u32;
__xdata char ao_cmd_lex_c;
__xdata enum ao_cmd_status ao_cmd_status;
__xdata uint32_t ao_cmd_lex_u32;
__xdata char ao_cmd_lex_c;
__xdata enum ao_cmd_status ao_cmd_status;
-static __xdata uint8_t lex_echo;
#define CMD_LEN 32
#define CMD_LEN 32
@@
-41,7
+40,7
@@
static void
readline(void)
{
__xdata char c;
readline(void)
{
__xdata char c;
- if (
lex_echo
)
+ if (
ao_echo()
)
put_string("> ");
cmd_len = 0;
for (;;) {
put_string("> ");
cmd_len = 0;
for (;;) {
@@
-50,7
+49,7
@@
readline(void)
/* backspace/delete */
if (c == '\010' || c == '\177') {
if (cmd_len != 0) {
/* backspace/delete */
if (c == '\010' || c == '\177') {
if (cmd_len != 0) {
- if (
lex_echo
)
+ if (
ao_echo()
)
put_string("\010 \010");
--cmd_len;
}
put_string("\010 \010");
--cmd_len;
}
@@
-60,7
+59,7
@@
readline(void)
/* ^U */
if (c == '\025') {
while (cmd_len != 0) {
/* ^U */
if (c == '\025') {
while (cmd_len != 0) {
- if (
lex_echo
)
+ if (
ao_echo()
)
put_string("\010 \010");
--cmd_len;
}
put_string("\010 \010");
--cmd_len;
}
@@
-72,18
+71,18
@@
readline(void)
c = '\n';
if (c == '\n') {
c = '\n';
if (c == '\n') {
- if (
lex_echo
)
+ if (
ao_echo()
)
putchar('\n');
break;
}
if (cmd_len >= CMD_LEN - 2) {
putchar('\n');
break;
}
if (cmd_len >= CMD_LEN - 2) {
- if (
lex_echo
)
+ if (
ao_echo()
)
putchar('\007');
continue;
}
cmd_line[cmd_len++] = c;
putchar('\007');
continue;
}
cmd_line[cmd_len++] = c;
- if (
lex_echo
)
+ if (
ao_echo()
)
putchar(c);
}
cmd_line[cmd_len++] = '\n';
putchar(c);
}
cmd_line[cmd_len++] = '\n';
@@
-198,7
+197,8
@@
static void
echo(void)
{
ao_cmd_hex();
echo(void)
{
ao_cmd_hex();
- lex_echo = ao_cmd_lex_i != 0;
+ if (ao_cmd_status == ao_cmd_success)
+ ao_stdios[ao_cur_stdio].echo = ao_cmd_lex_i != 0;
}
static void
}
static void
@@
-221,8
+221,6
@@
version(void)
printf("software-version %s\n", ao_version);
}
printf("software-version %s\n", ao_version);
}
-static const char help_txt[] = "All numbers are in hex";
-
#define NUM_CMDS 11
static __code struct ao_cmds *__xdata (ao_cmds[NUM_CMDS]);
#define NUM_CMDS 11
static __code struct ao_cmds *__xdata (ao_cmds[NUM_CMDS]);
@@
-234,7
+232,7
@@
help(void)
__xdata uint8_t cmds;
__xdata uint8_t cmd;
__code struct ao_cmds * __xdata cs;
__xdata uint8_t cmds;
__xdata uint8_t cmd;
__code struct ao_cmds * __xdata cs;
- puts(help_txt);
+
for (cmds = 0; cmds < ao_ncmds; cmds++) {
cs = ao_cmds[cmds];
for (cmd = 0; cs[cmd].func; cmd++)
for (cmds = 0; cmds < ao_ncmds; cmds++) {
cs = ao_cmds[cmds];
for (cmd = 0; cs[cmd].func; cmd++)
@@
-272,14
+270,8
@@
ao_cmd(void)
__code struct ao_cmds * __xdata cs;
void (*__xdata func)(void);
__code struct ao_cmds * __xdata cs;
void (*__xdata func)(void);
- lex_echo = 1;
for (;;) {
readline();
for (;;) {
readline();
-#if HAS_CMD_FILTER
- if (ao_cmd_filter())
- continue;
- cmd_i = 0;
-#endif
ao_cmd_lex();
ao_cmd_white();
c = ao_cmd_lex_c;
ao_cmd_lex();
ao_cmd_white();
c = ao_cmd_lex_c;
@@
-308,11
+300,11
@@
ao_cmd(void)
__xdata struct ao_task ao_cmd_task;
__code struct ao_cmds ao_base_cmds[] = {
__xdata struct ao_task ao_cmd_task;
__code struct ao_cmds ao_base_cmds[] = {
- { help, "?\0
Print this message
" },
- { ao_task_info, "T\0Show task
state
s" },
- { echo, "E <0 off, 1 on>\0Set
command
echo mode" },
+ { help, "?\0
Help
" },
+ { ao_task_info, "T\0Show tasks" },
+ { echo, "E <0 off, 1 on>\0Set echo mode" },
{ ao_reboot, "r eboot\0Reboot" },
{ ao_reboot, "r eboot\0Reboot" },
- { version, "v\0
Show v
ersion" },
+ { version, "v\0
V
ersion" },
{ 0, NULL },
};
{ 0, NULL },
};