Hi,
I have 2 esp-01 modules. One of which run the STATIONAP mode and acts as tcp server for the other esp module running on STATION mode. Data transfer is working properly but the callback functions are not being executed properly.
CODE:
void ICACHE_FLASH_ATTR tcp_connect_sap_cb(void *arg){
struct espconn *conn_sap = (struct espconn *)arg; // THIS IS NOT BEING EXECUTED
espconn_regist_recvcb(conn_sap, recv_sap_cb); // THE IS WORKING
send_msg("'connect cb' SAP TCP CONNECTED\n"); // THIS IS NOT BEING EXECUTED
}
LOCAL void ICACHE_FLASH_ATTR tcp_init_sap(){
tcp_proto_sap.local_port = 2233;
tcp_conn_sap.type = ESPCONN_TCP;
tcp_conn_sap.state = ESPCONN_NONE;
tcp_conn_sap.proto.tcp = &tcp_proto_sap;
espconn_regist_connectcb(&tcp_conn_sap, tcp_connect_sap_cb);
sint8 sap_conn_accept = espconn_accept(&tcp_conn_sap);
if(sap_conn_accept != 0){
os_printf("SAP TCP CONN ACCEPT ERROR: %d\n",sap_conn_accept);
}else{
os_printf("SAP TCP DONE");
}
sint8 max_conn = espconn_tcp_set_max_con_allow(&tcp_conn_sap,5);
if(max_conn != 0){
os_printf("Set max conn error: %d\n",max_conn);
}
espconn_regist_time(&tcp_conn_sap,7200,0);
}
void user_init(void){
uart_init(BIT_RATE_19200, BIT_RATE_19200);
wifi_init();
espconn_init();
}
The receive callback is registered but the os_printf statements are not being executed.
callback function not executed.
Who is online
Users browsing this forum: No registered users and 6 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.