From e9bfb033c6b0d94b50baeb913a50297ea7cd4508 Mon Sep 17 00:00:00 2001 From: Jonas Arnold Date: Mon, 5 Dec 2022 19:06:38 +0100 Subject: [PATCH] add function to retrieve robot mode --- ADIS_ESP32_Eclipse/main/challenge_app.c | 10 +++++++--- ADIS_ESP32_Eclipse/main/challenge_app.h | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ADIS_ESP32_Eclipse/main/challenge_app.c b/ADIS_ESP32_Eclipse/main/challenge_app.c index e43126f..c66dec9 100644 --- a/ADIS_ESP32_Eclipse/main/challenge_app.c +++ b/ADIS_ESP32_Eclipse/main/challenge_app.c @@ -65,7 +65,11 @@ void Challenge_App_Init(void){ } } -static void Challenge_App_SetMode(bool modeStationary){ +bool Challenge_App_GetRobotMode(void){ + return robotModeStationary; +} + +static void Challenge_App_SetRobotMode(bool modeStationary){ robotModeStationary = modeStationary; ESP_LOGI(TAG, "Changed robot mode to %s", robotModeStationary?(unsigned char*)"stationary":(unsigned char*)"mobile"); } @@ -97,11 +101,11 @@ uint8_t Challenge_ParseCommand(const unsigned char* cmd, bool *handled, const Mc else if (McuUtility_strcmp((char*)cmd, (char*)"challenge setMode stationary")==0 || McuUtility_strcmp((char*)cmd, (char*)"challenge setMode s")==0) { *handled = TRUE; - Challenge_App_SetMode(true); // set stationary + Challenge_App_SetRobotMode(true); // set stationary } else if (McuUtility_strcmp((char*)cmd, (char*)"challenge setMode mobile")==0 || McuUtility_strcmp((char*)cmd, (char*)"challenge setMode m")==0 ) { *handled = TRUE; - Challenge_App_SetMode(false); // set mobile + Challenge_App_SetRobotMode(false); // set mobile } return ERR_OK; } diff --git a/ADIS_ESP32_Eclipse/main/challenge_app.h b/ADIS_ESP32_Eclipse/main/challenge_app.h index 92eb31b..b2d107b 100644 --- a/ADIS_ESP32_Eclipse/main/challenge_app.h +++ b/ADIS_ESP32_Eclipse/main/challenge_app.h @@ -8,9 +8,16 @@ #ifndef MAIN_CHALLENGE_APP_H_ #define MAIN_CHALLENGE_APP_H_ +#include "stdbool.h" + /*! \brief Module initialization, start app task */ void Challenge_App_Init(void); +/*! \brief get mode of robot + * \return true if stationary, false if mobile */ +bool Challenge_App_GetRobotMode(void){ + + #if PL_CONFIG_USE_SHELL #include "McuShell.h"