From 2ed8bec6d6b8d508945236e037cf8ec59174b6a1 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Tue, 13 Dec 2022 03:10:24 +0100 Subject: [PATCH] send cmd to robi via uart not rs485, mode tested, without speed, no battery for robi left :/ --- ADIS_ESP32_Eclipse/main/robo_wrapper.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ADIS_ESP32_Eclipse/main/robo_wrapper.c b/ADIS_ESP32_Eclipse/main/robo_wrapper.c index b243da8..51336cf 100644 --- a/ADIS_ESP32_Eclipse/main/robo_wrapper.c +++ b/ADIS_ESP32_Eclipse/main/robo_wrapper.c @@ -9,8 +9,8 @@ #include "McuShell.h" #include "Shell.h" -#define RS_CMD_DRIVE_PREFIX "rs sendcmd 0x01 drive " -#define RS_CMD_TURN_PREFIX "rs sendcmd 0x01 turn " +#define RS_CMD_DRIVE_PREFIX "drive " +#define RS_CMD_TURN_PREFIX "turn " #define BUF_SIZE 50 /* Sets the robot to automatic / manual mode */ @@ -19,12 +19,12 @@ bool Robo_Wrapper_SetMode(bool automatic){ /* tbd */ }else{ /* set speed to zero */ - Robo_Wrapper_Nav_Move(0); + unsigned char response[128]; + SHELL_SendToRobotAndGetResponse((const unsigned char*)"drive speed 0 0", response, sizeof(response)); /* set mode to speed */ unsigned char cmd[BUF_SIZE] = RS_CMD_DRIVE_PREFIX; - unsigned char response[128]; McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)"mode speed"); - SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); + SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); McuShell_SendStr(response, McuShell_GetStdio()->stdOut); } return true; @@ -37,7 +37,7 @@ bool Robo_Wrapper_Nav_Turn(int16_t angle){ unsigned char angleA[5] = ""; McuUtility_Num16sToStr(angleA, sizeof(angleA), angle); McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)angleA); - SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); + SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); McuShell_SendStr(response, McuShell_GetStdio()->stdOut); return true; } @@ -52,7 +52,7 @@ bool Robo_Wrapper_Nav_Move(int16_t speed){ McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)speedA); McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)" "); McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)speedA); - SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); + SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); McuShell_SendStr(response, McuShell_GetStdio()->stdOut); return true; } @@ -62,7 +62,7 @@ bool Robo_Wrapper_Nav_Stop(void){ unsigned char cmd[BUF_SIZE] = RS_CMD_DRIVE_PREFIX; unsigned char response[128]; McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)"mode stop"); - SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); + SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); McuShell_SendStr(response, McuShell_GetStdio()->stdOut); return true; }