Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atc_command() wait until get correct answer #5

Open
elkanamol opened this issue Jun 22, 2022 · 3 comments
Open

atc_command() wait until get correct answer #5

elkanamol opened this issue Jun 22, 2022 · 3 comments

Comments

@elkanamol
Copy link

HI,
I'm trying to set workflow with ESP8266 to send data to TCP server over AT commands.
the atc_command() not wait to correct answer and i need to wait until get "CONNECT" and later get ">" sign to able send my string.
it is not send the data after ">" sign, also not halt until correct answer received.
see some my code below,

uint8_t espSendDataTCP(char *APIkey, int Field_num, uint16_t value)
{
	char localBuffer[100] = {0};
	char localBuffer2[30] = {0};

	sprintf (localBuffer, "GET /update?api_key=%s&field%d=%u\r\n", APIkey, Field_num, value);
	sprintf (localBuffer2, "AT+CIPSEND=%d\r\n", strlen(localBuffer));
	if(atc_command(&atc, localBuffer2, 5000, NULL, 0 ,1, "\r\nCONNECT")!= 1)
	{
		printf("ERROR: ESP01 cannot set TCP connection \r\n");
		toggleGreenLed(6);
		return -1;
	}
	HAL_Delay(5000);
	if(atc_command(&atc, localBuffer, 1000, NULL, 0 ,1, "\r\n>" )!= 1)
	{
		printf("ERROR: ESP01 cannot set TCP connection \r\n");
		toggleGreenLed(6);
		return -1;
	}
	return 1;
}

BR,
ElkanaM

@nimaltd
Copy link
Owner

nimaltd commented Jun 23, 2022

Hi. please enable debug to watch what happen. maybe got some error message from ESP

@nimaltd
Copy link
Owner

nimaltd commented Jun 23, 2022

I used this library in GSM and it works fine.

@elkanamol
Copy link
Author

I used this library in GSM and it works fine.

I will follow this library to see how it works. it will good to be better documentation to explain the prepose and behavior of each function.

Hi. please enable debug to watch what happen. maybe got some error message from ESP

in debug mode, I saw it is all OK but on Logic analyzer seems like have missing answers and the function return 1.
what I dont understand its, if the at_command() set to search lets say two answers, the function will run till find both answers or timeout set?
if so, it is good for me, from I need some hard result to verify that some answer received or not.

Thanks,
ElkanaM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants