这个是源程序,从100个数据中找出 + O K \r \n 这五个元素
static u8 wait_for_wifi_ok(void)
{
u16 i,search;
for(i=0; i<100; i++)
{
for (search=4; search<100; search++)
{
if(Wifi_Data_Recv_Buf[search] =='\n')
{
if(Wifi_Data_Recv_Buf[(search-1)] =='\r')
{
if(Wifi_Data_Recv_Buf[(search-2)] =='K')
{
if(Wifi_Data_Recv_Buf[(search-3)] =='O')
{
if(Wifi_Data_Recv_Buf[(search-4)] =='+')
{
return 1;
}
}
}
}
}
}
}
return 0;
}
这个是我自己理解的程序,和上面的源程序等效吗?请高手指点
static u8 wait_for_wifi_ok(void)
{
u16 i,search;
for(i=0; i<100; i++)
{
for (search=4; search<100; search++)
{
if(Wifi_Data_Recv_Buf[search-4] =='\n')
{
if(Wifi_Data_Recv_Buf[(search-3)] =='\r')
{
if(Wifi_Data_Recv_Buf[(search-2)] =='K')
{
if(Wifi_Data_Recv_Buf[(search-1)] =='O')
{
if(Wifi_Data_Recv_Buf[(search)] =='+')
{
return 1;
}
}
}
}
}
}
}
return 0;
} |
去油香收