add function to retrieve robot mode

main
Jonas Arnold 4 years ago
parent c0a6cb5a52
commit e9bfb033c6
  1. 10
      ADIS_ESP32_Eclipse/main/challenge_app.c
  2. 7
      ADIS_ESP32_Eclipse/main/challenge_app.h

@ -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;
}

@ -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"

Loading…
Cancel
Save