implemented function and shell command to set the mode

main
Jonas Arnold 4 years ago
parent c88388b415
commit c0a6cb5a52
  1. 25
      ADIS_ESP32_Eclipse/main/challenge_app.c

@ -14,11 +14,11 @@
#include "wifi.h" #include "wifi.h"
/* LOCAL Var */ /* LOCAL Var */
// identifies robot Mode for the challenge: true = robot is stationary, false = robot is moveable /* identifies robot Mode for the challenge: true = robot is stationary, false = robot is moveable */
static bool robotModeStationary = false; static bool robotModeStationary = false;
// task handle
static TaskHandle_t appTaskHandle;
static TaskHandle_t appTaskHandle; /* task handle */
#define TAG "CHALLENGE_APP" /* tag for logging with ESP_LOG */
static void appTask(void *pv){ static void appTask(void *pv){
@ -61,10 +61,15 @@ BaseType_t res;
void Challenge_App_Init(void){ void Challenge_App_Init(void){
res = xTaskCreate(appTask, "ChallengeAppTask", 4096/sizeof(StackType_t), (void*)"ARG_0", tskIDLE_PRIORITY, &appTaskHandle); res = xTaskCreate(appTask, "ChallengeAppTask", 4096/sizeof(StackType_t), (void*)"ARG_0", tskIDLE_PRIORITY, &appTaskHandle);
if(res != pdPASS){ if(res != pdPASS){
printf("creating appTask failed!\r\n"); ESP_LOGE(TAG, "Creating appTask failed");
} }
} }
static void Challenge_App_SetMode(bool modeStationary){
robotModeStationary = modeStationary;
ESP_LOGI(TAG, "Changed robot mode to %s", robotModeStationary?(unsigned char*)"stationary":(unsigned char*)"mobile");
}
/*********/ /*********/
/* SHELL */ /* SHELL */
/*********/ /*********/
@ -89,13 +94,15 @@ uint8_t Challenge_ParseCommand(const unsigned char* cmd, bool *handled, const Mc
*handled = TRUE; *handled = TRUE;
return PrintStatus(io); return PrintStatus(io);
} }
/*else if (McuUtility_strcmp((char*)cmd, (char*)"led suspend")==0) { else if (McuUtility_strcmp((char*)cmd, (char*)"challenge setMode stationary")==0 ||
McuUtility_strcmp((char*)cmd, (char*)"challenge setMode s")==0) {
*handled = TRUE; *handled = TRUE;
LED_Suspend(); Challenge_App_SetMode(true); // set stationary
} else if (McuUtility_strcmp((char*)cmd, (char*)"led resume")==0) { } else if (McuUtility_strcmp((char*)cmd, (char*)"challenge setMode mobile")==0 ||
McuUtility_strcmp((char*)cmd, (char*)"challenge setMode m")==0 ) {
*handled = TRUE; *handled = TRUE;
LED_Resume(); Challenge_App_SetMode(false); // set mobile
}*/ }
return ERR_OK; return ERR_OK;
} }
#endif /* PL_CONFIG_USE_SHELL */ #endif /* PL_CONFIG_USE_SHELL */

Loading…
Cancel
Save