main
Simon Frei 4 years ago
parent a4c634eccc
commit 3e68ffff2d
  1. 2
      ADIS_ESP32_Eclipse/main/udp_server.c

@ -52,10 +52,12 @@ void HandleIncomingUdpMessage(const char *rxMsg, int sock, struct sockaddr *sour
if (rxMsg[strLen-1]=='!') { if (rxMsg[strLen-1]=='!') {
/* send to ESP32 shell */ /* send to ESP32 shell */
rxMsg += sizeof("@esp:")-1; rxMsg += sizeof("@esp:")-1;
ESP_LOGI(TAG,"msg without @esp: %s",rxMsg);
unsigned char *cmd = (unsigned char*)calloc(strLen, sizeof(unsigned char)); unsigned char *cmd = (unsigned char*)calloc(strLen, sizeof(unsigned char));
if(cmd != NULL){ if(cmd != NULL){
size_t cmdLen = strLen-(sizeof("@esp:")-1)-1; size_t cmdLen = strLen-(sizeof("@esp:")-1)-1;
McuUtility_strcpy(cmd, cmdLen, (const unsigned char *)rxMsg); McuUtility_strcpy(cmd, cmdLen, (const unsigned char *)rxMsg);
ESP_LOGI(TAG,"cmd: %s",cmd);
SHELL_SendToESPAndGetResponse((unsigned char*)cmd, response, sizeof(response)); SHELL_SendToESPAndGetResponse((unsigned char*)cmd, response, sizeof(response));
}else{ }else{
McuUtility_strcpy(response, sizeof(response), (unsigned char*)"Failed to parse cmd!"); McuUtility_strcpy(response, sizeof(response), (unsigned char*)"Failed to parse cmd!");

Loading…
Cancel
Save