From 4204b82bd6e4d7ba6951f6bd574f6b6e6b7a3270 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Thu, 11 Aug 2016 21:42:06 +0200 Subject: [PATCH] turn commands improved --- source/application/shell_commands.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/application/shell_commands.c b/source/application/shell_commands.c index 9e671e8..ed5d2d8 100644 --- a/source/application/shell_commands.c +++ b/source/application/shell_commands.c @@ -78,8 +78,10 @@ int shell_commands_init(void) static void *drive_turn_right_cb(const char *param) { int speed = drive_ctrl_get_speed_value(); - drive_ctrl_set_speed_left(speed); - drive_ctrl_set_speed_right(0); + drive_ctrl_set_speed_left(abs(speed)); + if(speed > 0) + speed *= -1; + drive_ctrl_set_speed_right(speed); return NULL; } @@ -87,8 +89,10 @@ static void *drive_turn_right_cb(const char *param) static void *drive_turn_left_cb(const char *param) { int speed = drive_ctrl_get_speed_value(); - drive_ctrl_set_speed_left(0); - drive_ctrl_set_speed_right(speed); + drive_ctrl_set_speed_right(abs(speed)); + if(speed > 0) + speed *= -1; + drive_ctrl_set_speed_left(speed); return NULL; }