diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-06-29 09:34:54 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-06-29 09:34:54 +0200 |
commit | 4d446fb2c1d14142304971095ee60668ba9c6bc5 (patch) | |
tree | d5e5670f17a2d8a89748645b0739ef95dd6bf4f4 /robot/io.c | |
parent | 0b50dfe730d87ff052ef08f0dd6df6071d50aef9 (diff) |
[WIP] last touches for second assessment
Diffstat (limited to 'robot/io.c')
-rw-r--r-- | robot/io.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -27,11 +27,13 @@ void w2_io_object_detection() { if (front_distance <= W2_IO_DISTANCE_FAR_THRESHOLD) g_w2_io_object_detected = false; if (w2_hypervisor_time_end(W2_TIMER_OBJECT_DETECTION) >= W2_IO_DISTANCE_TOO_CLOSE_TIMEOUT) w2_errcatch_throw(W2_E_CRIT_OBSTACLE_STUCK); - - set_motors(0, 0); } } +void w2_set_motors(int left, int right) { + set_motors(left * (1 - g_w2_io_object_detected), right * (1 - g_w2_io_object_detected)); +} + void w2_io_battery_logic() { if (w2_hypervisor_time_end(W2_TIMER_BATTERY_MEASUREMENT) <= W2_BATTERY_MEAS_FREQ) return; w2_hypervisor_time_start(W2_TIMER_BATTERY_MEASUREMENT); |