学前班
最后登录1970-1-1
在线时间 小时
注册时间2020-1-10
|
以上是正确的返回
以上是正确的返回,以下是我的调试,不知错在哪里?
,万能的论坛,请问哪位高手能帮小弟解答一下,谢谢!
ESP8266_Cmd ( "AT+RST", "OK", "ready", 2500 );
ESP8266_Cmd ( "AT+CWLAP", "OK", 0, 5000 );
do
{
PC_Usart ( "\r\n请输入要连接的WiFi名称和密钥,输入格式为:名称字符+英文逗号+密钥字符+空格,点击发送\r\n" );
scanf ( "%s", cStrInput );
PC_Usart ( "\r\n稍等片刻 ……\r\n" );
pBuf = cStrInput;
uc = 0;
while ( ( pStr = strtok ( pBuf, "," ) ) != NULL )
{
pStrDelimiter [ uc ++ ] = pStr;
pBuf = NULL;
}
} while ( ! ESP8266_JoinAP ( pStrDelimiter [0], pStrDelimiter [1] ) );
我独自看了看代码,发现跳不出这个函数里的while循环??
以下是ESP8266_Cmd()函数:
bool ESP8266_Cmd ( char * cmd, char * reply1, char * reply2, u32 waittime )
{
strEsp8266_Fram_Record .InfBit .FramLength = 0; //从新开始接收新的数据包
ESP8266_Usart ( "%s\r\n", cmd );
if ( ( reply1 == 0 ) && ( reply2 == 0 ) ) //不需要接收数据
return true;
Delay_ms ( waittime ); //延时
strEsp8266_Fram_Record .Data_RX_BUF [ strEsp8266_Fram_Record .InfBit .FramLength ] = '\0';
PC_Usart ( "%s", strEsp8266_Fram_Record .Data_RX_BUF );
if ( ( reply1 != 0 ) && ( reply2 != 0 ) )
return ( ( bool ) strstr ( strEsp8266_Fram_Record .Data_RX_BUF, reply1 ) ||
( bool ) strstr ( strEsp8266_Fram_Record .Data_RX_BUF, reply2 ) );
else if ( reply1 != 0 )
return ( ( bool ) strstr ( strEsp8266_Fram_Record .Data_RX_BUF, reply1 ) );
else
return ( ( bool ) strstr ( strEsp8266_Fram_Record .Data_RX_BUF, reply2 ) );
}
求大神支招!!!
|
|