integration du terminal dans le machin

This commit is contained in:
phyto
2019-05-20 18:20:18 +02:00
parent 7e17ba80e5
commit e0dcbebd30
6 changed files with 52 additions and 39 deletions

12
essai.c
View File

@@ -15,8 +15,10 @@
#include "serial/serial.h"
#include "viz/curses/ecran.h"
int verbosity;
int run_the_terminal(int fd_serial, char *title, WINDOW *win); /* XXX */
int verbosity;
/* --------------------------------------------------------------- */
int traite_les_messages(int sfd, int nbloops)
@@ -38,7 +40,7 @@ if (NULL==fp) {
for (idx=0; idx<nbloops; idx++) {
if (kbhit()) {
static char valid_k[] = "+-";
static char valid_k[] = "+-01";
key = getch();
/* if it is a valid key, send it to the Arduino */
@@ -47,6 +49,12 @@ for (idx=0; idx<nbloops; idx++) {
fprintf(stderr, "put byte %02X -> %d\n",
key, foo);
}
else if (0x14==key) { /* request for terminal */
foo = run_the_terminal(sfd, " terminal ", 0);
sprintf(ligne, "retour terminal = %d", foo);
aff_message(ligne); sleep(1);
}
else {
sprintf(ligne, "Key 0x%02X invalid ", key);
fprintf(stderr, "%s\n", ligne);