projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Go back to recording sensor data in globals
[fw/altos]
/
src
/
core
/
ao_cmd.c
diff --git
a/src/core/ao_cmd.c
b/src/core/ao_cmd.c
index d0a4663352ff703718b0e4d27ab4834d42e2660d..1814cecf5021848e4fe88b8fc3841dd10e6a491f 100644
(file)
--- a/
src/core/ao_cmd.c
+++ b/
src/core/ao_cmd.c
@@
-36,10
+36,16
@@
put_string(__code char *s)
putchar(c);
}
putchar(c);
}
+static void
+backspace(void)
+{
+ put_string ("\010 \010");
+}
+
static void
readline(void)
{
static void
readline(void)
{
-
__pdata
char c;
+ char c;
if (ao_echo())
put_string("> ");
cmd_len = 0;
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())
if (c == '\010' || c == '\177') {
if (cmd_len != 0) {
if (ao_echo())
-
put_string("\010 \010"
);
+
backspace(
);
--cmd_len;
}
continue;
--cmd_len;
}
continue;
@@
-60,7
+66,7
@@
readline(void)
if (c == '\025') {
while (cmd_len != 0) {
if (ao_echo())
if (c == '\025') {
while (cmd_len != 0) {
if (ao_echo())
-
put_string("\010 \010"
);
+
backspace(
);
--cmd_len;
}
continue;
--cmd_len;
}
continue;
@@
-76,11
+82,8
@@
readline(void)
break;
}
break;
}
- if (cmd_len >= CMD_LEN - 2) {
- if (ao_echo())
- putchar('\007');
+ if (cmd_len >= CMD_LEN - 2)
continue;
continue;
- }
cmd_line[cmd_len++] = c;
if (ao_echo())
putchar(c);
cmd_line[cmd_len++] = c;
if (ao_echo())
putchar(c);
@@
-121,10
+124,16
@@
ao_cmd_put8(uint8_t v)
putnibble(v & 0xf);
}
putnibble(v & 0xf);
}
+uint8_t
+ao_cmd_is_white(void)
+{
+ return ao_cmd_lex_c == ' ' || ao_cmd_lex_c == '\t';
+}
+
void
ao_cmd_white(void)
{
void
ao_cmd_white(void)
{
- while (ao_cmd_
lex_c == ' ' || ao_cmd_lex_c == '\t'
)
+ while (ao_cmd_
is_white()
)
ao_cmd_lex();
}
ao_cmd_lex();
}
@@
-227,6
+236,12
@@
ao_reboot(void)
ao_cmd_white();
if (!ao_match_word("eboot"))
return;
ao_cmd_white();
if (!ao_match_word("eboot"))
return;
+ /* Delay waiting for the packet master to be turned off
+ * so that we don't end up back in idle mode because we
+ * received a packet after boot.
+ */
+ flush();
+ ao_delay(AO_SEC_TO_TICKS(1));
ao_arch_reboot();
ao_panic(AO_PANIC_REBOOT);
}
ao_arch_reboot();
ao_panic(AO_PANIC_REBOOT);
}
@@
-239,11
+254,16
@@
version(void)
printf("serial-number %u\n", ao_serial_number);
#if HAS_LOG
printf("log-format %u\n", ao_log_format);
printf("serial-number %u\n", ao_serial_number);
#if HAS_LOG
printf("log-format %u\n", ao_log_format);
+#endif
+#if HAS_MS5607
+ ao_ms5607_info();
#endif
printf("software-version %s\n", ao_version);
}
#endif
printf("software-version %s\n", ao_version);
}
+#ifndef NUM_CMDS
#define NUM_CMDS 11
#define NUM_CMDS 11
+#endif
static __code struct ao_cmds *__xdata (ao_cmds[NUM_CMDS]);
static __pdata uint8_t ao_ncmds;
static __code struct ao_cmds *__xdata (ao_cmds[NUM_CMDS]);
static __pdata uint8_t ao_ncmds;
@@
-251,16
+271,17
@@
static __pdata uint8_t ao_ncmds;
static void
help(void)
{
static void
help(void)
{
- register uint8_t cmds;
- register uint8_t cmd;
- register __code struct ao_cmds * cs;
+ __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 (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; cs[cmd].func; cmd++)
{
+ h = cs[cmd].help;
+ printf("%-45s %s\n", h, h + 1 + strlen(h));
+ }
}
}
}
}
@@
-288,7
+309,7
@@
ao_cmd_register(__code struct ao_cmds *cmds)
void
ao_cmd(void)
{
void
ao_cmd(void)
{
- char c;
+
__pdata
char c;
uint8_t cmd, cmds;
__code struct ao_cmds * __xdata cs;
void (*__xdata func)(void);
uint8_t cmd, cmds;
__code struct ao_cmds * __xdata cs;
void (*__xdata func)(void);
@@
-324,8
+345,8
@@
__xdata struct ao_task ao_cmd_task;
__code struct ao_cmds ao_base_cmds[] = {
{ help, "?\0Help" },
__code struct ao_cmds ao_base_cmds[] = {
{ help, "?\0Help" },
- { ao_task_info, "T\0
Show t
asks" },
- { echo, "E <0 off, 1 on>\0
Set echo mode
" },
+ { ao_task_info, "T\0
T
asks" },
+ { echo, "E <0 off, 1 on>\0
Echo
" },
{ ao_reboot, "r eboot\0Reboot" },
{ version, "v\0Version" },
{ 0, NULL },
{ ao_reboot, "r eboot\0Reboot" },
{ version, "v\0Version" },
{ 0, NULL },