diff --git a/README.md b/README.md index 5915fc5..3f5a422 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,15 @@ cd functions make ``` -Et ensuite `make` dans le répertoire de base... +Et ensuite `make` dans le répertoire de base, je pense que c'est +assez simple, et parfois ça marche... # Les programmes ## osc-joy -Lecture d'une manette de jeu USB et envoi des coordonnées x/y et des boutons -vers un écouteur OSC. +Lecture d'une manette de jeu USB et envoi des coordonnées x/y/z/w +et des boutons vers un écouteur OSC. L'option `-o NN` rajoute NN au numéro de bouton. Voir les [générateurs](generators/) pour les détails. @@ -48,17 +49,8 @@ Pour faire __beep__ vers Chuck... ## showbuttons -Presque fini depuis quelques mois. - -# Le reste - -## Loth Project - -Voir README.md - -## Teamlaser - -Voir asyncburp.c +Presque fini depuis quelques mois/années. + diff --git a/functions/senders.c b/functions/senders.c index e4294f9..3bc6710 100644 --- a/functions/senders.c +++ b/functions/senders.c @@ -22,6 +22,19 @@ if (verbosity > 2) { return foo; } /* ----------------------------------------------------------------- */ +/* function added Sun Mar 31 18:51:46 UTC 2024 */ +int send_data_zw(lo_address dst, int w, int z) +{ +int foo; + +if (verbosity) fprintf(stderr, "sending w z %7d %7d\n", w, z); +foo = lo_send(dst, "/joystick/wz", "ii", w, z); +if (verbosity > 2) { + fprintf(stderr, "lo_send -> %d\n", foo); + } +return foo; +} +/* ----------------------------------------------------------------- */ int send_data_button(lo_address dst, int n, int v) { int foo; diff --git a/functions/senders.h b/functions/senders.h index 8db19fe..db66cad 100644 --- a/functions/senders.h +++ b/functions/senders.h @@ -5,6 +5,7 @@ /* ------------------------------------------------------- */ int send_data_xy(lo_address dst, int x, int y); +int send_data_zw(lo_address dst, int w, int z); int send_data_button(lo_address dst, int n, int v); int send_data_id(lo_address dst, char *s); diff --git a/osc-joy.c b/osc-joy.c index a227431..779c4c1 100644 --- a/osc-joy.c +++ b/osc-joy.c @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { int foo, joy_fd; struct js_event js; -int x_pos, y_pos, flag; +int x_pos, y_pos, z_pos, w_pos, what; char joy_name[128]; int opt; char *remote_host = REMOTE_HOST; @@ -107,7 +107,7 @@ if (verbosity) { send_data_id(t, my_id); -x_pos = y_pos = 0; +x_pos = y_pos = z_pos = w_pos = 0; for (;;) { foo = read(joy_fd, &js, sizeof(struct js_event)); if (8 != foo) { @@ -122,22 +122,38 @@ for (;;) { js.time, js.type, js.number, js.value); } if (2==js.type) { /* oscillating stick */ - flag = 0; + what = 0; switch (js.number) { case 0: x_pos = js.value; - flag = 1; + what = 1; break; case 1: y_pos = js.value; - flag = 1; + what = 1; + break; + case 2: + z_pos = js.value; + what = 2; + break; + case 3: + w_pos = js.value; + what = 2; break; } - if (flag) { - foo = send_data_xy(t, x_pos, y_pos); - flag = 0; - } - } + /* now, send the datas */ + // fprintf(stderr, "\t\twhat = %d\n", what); + switch (what) { + case 1: + foo = send_data_xy(t, x_pos, y_pos); + what = 0; + break; + case 2: + foo = send_data_zw(t, z_pos, w_pos); + what = 0; + break; + } + } if (1==js.type) { /* it's a button */ foo = send_data_button(t, js.number+button_offset,