aboutsummaryrefslogtreecommitdiff
path: root/robot/mode_dirc.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-02 19:14:08 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-02 19:14:08 +0200
commit595763efb64ee861f3ccf458ff35992b94f2fa3a (patch)
tree428ae0f7b474b8cb644fadcb4491ed7d8e4baffa /robot/mode_dirc.c
parent14779cb187dac9ed4a0b6e7645e76e78587ad024 (diff)
[WIP] stop on connection lost in dirc
Diffstat (limited to 'robot/mode_dirc.c')
-rw-r--r--robot/mode_dirc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/robot/mode_dirc.c b/robot/mode_dirc.c
index 5988816..397d44d 100644
--- a/robot/mode_dirc.c
+++ b/robot/mode_dirc.c
@@ -1,13 +1,18 @@
#include "mode_dirc.h"
#include "io.h"
-
+#include "hypervisor.h"
+#include "modes.h"
+#include "../shared/util.h"
#include "orangutan_shim.h"
int16_t g_w2_mode_dirc_motor_l = 0;
int16_t g_w2_mode_dirc_motor_r = 0;
+double g_w2_mode_dirc_power = 1.0;
void w2_mode_dirc() {
- set_motors(g_w2_mode_dirc_motor_l, g_w2_mode_dirc_motor_r);
- g_w2_io.motor_left.speed = g_w2_mode_dirc_motor_l;
- g_w2_io.motor_right.speed = g_w2_mode_dirc_motor_r;
+ // if (g_w2_connected) g_w2_mode_dirc_power = 1.0;
+ // else g_w2_mode_dirc_power = W2_MAX(0, g_w2_mode_dirc_power - 0.01);
+
+ // if (g_w2_mode_dirc_power == 0.0) w2_modes_call(W2_M_HALT);
+ set_motors(g_w2_mode_dirc_motor_l * g_w2_mode_dirc_power, g_w2_mode_dirc_motor_r * g_w2_mode_dirc_power);
}