diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-06-01 10:02:07 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-06-01 10:02:07 +0200 |
commit | 35cdecc0134b82d69b120533b091b8e5b58415e1 (patch) | |
tree | 6a66f2995f787a109224e3daf8b19ecbbfb3c03b /client/ui_dirc.c | |
parent | 139651d45a72d57c5147e2854647d95cb87c9e4e (diff) |
direct control toy working
Diffstat (limited to 'client/ui_dirc.c')
-rw-r--r-- | client/ui_dirc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/client/ui_dirc.c b/client/ui_dirc.c index 118a3ea..13b2d10 100644 --- a/client/ui_dirc.c +++ b/client/ui_dirc.c @@ -1,4 +1,6 @@ #include "../shared/util.h" +#include "../shared/protocol.h" +#include "commands.h" #include "ui.h" void w2_ui_bar_graph(unsigned int percent) { @@ -45,7 +47,12 @@ int w2_avg(int *samples, unsigned int sample_count) { W2_DIRC_MOTOR_DRIVER(l); W2_DIRC_MOTOR_DRIVER(r); -void w2_ui_dirc() { +void w2_ui_dirc_init() { + w2_send_mode(W2_M_DIRC); +} + +void w2_ui_dirc(bool first) { + if (first) w2_ui_dirc_init(); int ch = 0; unsigned int lb = 0; unsigned int lf = 0; @@ -64,4 +71,6 @@ void w2_ui_dirc() { char temp[32] = {0}; sprintf(temp, "l: %04i, r: %04i", drive_l, drive_r); mvaddstr(4, 0, temp); + + w2_send_dirc(drive_l, drive_r); } |