Compare commits
2 commits
f351ea59b7
...
d092fd5058
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d092fd5058 | ||
|
|
4b62aa2a07 |
1 changed files with 27 additions and 3 deletions
30
irena.c
30
irena.c
|
|
@ -1250,13 +1250,13 @@ static inline int base85_encode1(unsigned int b, char *s)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
s += 5;
|
s += 5;
|
||||||
*s = 0;
|
*s-- = 0;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
unsigned int bb = b;
|
unsigned int bb = b;
|
||||||
b /= 85;
|
b /= 85;
|
||||||
*s-- = bb - b*85 + 33;
|
*s-- = bb - b*85 + 33;
|
||||||
}
|
}
|
||||||
*s = b;
|
*s = b + 33;
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2134,6 +2134,27 @@ char *poll_response(time_t timeout)
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// ARM message log readout
|
||||||
|
|
||||||
|
int read_messages()
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
while (n++<33) {
|
||||||
|
static const char cmd[] = "mes";
|
||||||
|
silent(2);
|
||||||
|
while (-2==send_irena_command(cmd)) {
|
||||||
|
unsilent();
|
||||||
|
poll_uart(1);
|
||||||
|
}
|
||||||
|
unsilent();
|
||||||
|
char *res = poll_response(2);
|
||||||
|
if (!res || !*res || !strncmp(res+1, "100", 3))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Send the contents of a file to the flash_buffer and exectute CR_BUFFER in each
|
// Send the contents of a file to the flash_buffer and exectute CR_BUFFER in each
|
||||||
|
|
||||||
|
|
@ -2222,7 +2243,6 @@ int send_file_85(const char *fn)
|
||||||
int c = snprintf(cmd, 64, "v f[%d]=:{", i);
|
int c = snprintf(cmd, 64, "v f[%d]=:{", i);
|
||||||
while (c<58 && i<128)
|
while (c<58 && i<128)
|
||||||
c += base85_encode1(buf[i++], cmd+c);
|
c += base85_encode1(buf[i++], cmd+c);
|
||||||
cmd[c++] = 0;
|
|
||||||
while (retry<3) {
|
while (retry<3) {
|
||||||
loud(2);
|
loud(2);
|
||||||
while (-2==send_irena_command(cmd))
|
while (-2==send_irena_command(cmd))
|
||||||
|
|
@ -2687,6 +2707,7 @@ int process_cmd(char *l)
|
||||||
"\texit «code»\n"
|
"\texit «code»\n"
|
||||||
"\tsleep «seconds»\n"
|
"\tsleep «seconds»\n"
|
||||||
"\tscript «filename»\n"
|
"\tscript «filename»\n"
|
||||||
|
"\tmessages\n"
|
||||||
"\tuart «tty» [«baudrate»] [reset|rs232|rs422|gpio[0]]\n"
|
"\tuart «tty» [«baudrate»] [reset|rs232|rs422|gpio[0]]\n"
|
||||||
"\tirena «commandline»\n"
|
"\tirena «commandline»\n"
|
||||||
"\tfct «lines»\n"
|
"\tfct «lines»\n"
|
||||||
|
|
@ -2875,6 +2896,9 @@ int process_cmd(char *l)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(av[0], "messages"))
|
||||||
|
return read_messages();
|
||||||
|
|
||||||
if (!strcmp(av[0], "path")) {
|
if (!strcmp(av[0], "path")) {
|
||||||
struct paths *pp;
|
struct paths *pp;
|
||||||
for (pp=paths; pp->name; pp++)
|
for (pp=paths; pp->name; pp++)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue