[mw_shl_code=applescript,true]//ATK-ESP8266 WIFI AP测试
//用于测试TCP/UDP连接
//返回:0,正常
// 其他,错误代码
u8 atk_8266_wifiap_test(void)
{
u8 netpro=0;
u8 key;
u8 timex=0;
u8 ipbuf[16];
u8 *p;
u16 t=999; //加速第一次获取链接状态
u8 res=0;
u16 rlen=0;
u8 constate=0;
p=mymalloc(SRAMIN,32); ............
while(1)
{
key=KEY_Scan(0);
if(key==WKUP_PRES) //WK_UP
{
res=0;
atk_8266_quit_trans();
atk_8266_send_cmd("AT+CIPMODE=0","OK",20);
break;
}
else if(key==KEY0_PRES) //KEY0
{
if((netpro==3)||(netpro==2)) //UDP
{
sprintf((char*)p,"ATK-8266%s²âÊÔ%02d\r\n",ATK_ESP8266_WORKMODE_TBL[netpr ,t/10 );
Show_Str(30+54,100,200,12,p,12,0);
atk_8266_send_cmd("AT+CIPSEND=25","OK",200);
delay_ms(200);
atk_8266_send_data(p,"OK",100);
timex=100;
}
else if((netpro==1)) //TCP Client
{
atk_8266_quit_trans();
atk_8266_send_cmd("AT+CIPSEND","OK",20);
sprintf((char*)p,"ATK-8266%s²âÊÔ%02d\r\n",ATK_ESP8266_WORKMODE_TBL[netpro] ,t/10 );
Show_Str(30+54,100,200,12,p,12,0);
u3_printf("%s",p);
timex=100;
}
else //TCP Server
{
sprintf((char*)p,"ATK-8266%s²âÊÔ%02d\r\n",ATK_ESP8266_WORKMODE_TBL[netpro], t/10 );
Show_Str(30+54,100,200,12,p,12,0);
atk_8266_send_cmd("AT+CIPSEND=0,25","OK",200);
delay_ms(200);
atk_8266_send_data(p,"OK",100);
timex=100;
}
}
按KEY0给手机发数据,数据为:ATK-8266TCP服务器测字试XX(XX为数字)为什么XX是个在变的数字t不是999吗?t/10为什么在变?
t为什么等于999?加速获取第一次链接状态什么意思?
|