diff --git a/example/freertos/esp8266_wifi/esp8266.c b/example/freertos/esp8266_wifi/esp8266.c index 35fa47ba2..799fc0ef9 100644 --- a/example/freertos/esp8266_wifi/esp8266.c +++ b/example/freertos/esp8266_wifi/esp8266.c @@ -103,9 +103,11 @@ int32_t esp8266_wifi_mode_set(ESP8266_DEF_PTR obj, ESP8266_WIFI_MODE mode, bool } /* rcv_buf should be large enough for scan result */ -int32_t esp8266_wifi_scan(ESP8266_DEF_PTR obj, char *rcv_buf) +int32_t esp8266_wifi_scan(ESP8266_DEF_PTR obj, char *rcv_buf, char *ssid) { - at_send_cmd(obj->p_at, AT_EXECUTE, "CWLAP"); + char cmd_str[64]= {0}; + sprintf(cmd_str, "CWLAP=%s", ssid); + at_send_cmd(obj->p_at, AT_EXECUTE, cmd_str); return at_get_reply(obj->p_at, rcv_buf, AT_LONG_TIMEOUT); } @@ -167,7 +169,7 @@ int32_t esp8266_wifi_disconnect(ESP8266_DEF_PTR obj) int32_t esp8266_address_get(ESP8266_DEF_PTR obj) { - char rcv_buf[64]; + char rcv_buf[128]; AT_PARSER_DEF_PTR p_at = obj->p_at; at_send_cmd(p_at, AT_EXECUTE, "CIFSR"); return at_get_reply(p_at, rcv_buf, AT_NORMAL_TIMEOUT); diff --git a/example/freertos/esp8266_wifi/esp8266.h b/example/freertos/esp8266_wifi/esp8266.h index cf919ccea..350a01193 100644 --- a/example/freertos/esp8266_wifi/esp8266.h +++ b/example/freertos/esp8266_wifi/esp8266.h @@ -72,13 +72,13 @@ int32_t esp8266_test(ESP8266_DEF_PTR obj); int32_t esp8266_wifi_mode_get(ESP8266_DEF_PTR obj, bool flash); int32_t esp8266_wifi_mode_set(ESP8266_DEF_PTR obj, ESP8266_WIFI_MODE, bool flash); -int32_t esp8266_wifi_scan(ESP8266_DEF_PTR obj, char * rcv_buf); +int32_t esp8266_wifi_scan(ESP8266_DEF_PTR obj, char *rcv_buf, char *ssid); int32_t esp8266_wifi_connect(ESP8266_DEF_PTR obj, AT_STRING ssid, AT_STRING pwd, bool flash); int32_t esp8266_wifi_disconnect(ESP8266_DEF_PTR obj); int32_t esp8266_address_get(ESP8266_DEF_PTR obj); int32_t esp8266_conn_status(ESP8266_DEF_PTR obj); -int32_t esp8266_dns_lookup(ESP8266_DEF_PTR obj, char * domain_ip, AT_STRING domain_name); +int32_t esp8266_dns_lookup(ESP8266_DEF_PTR obj, char *domain_ip, AT_STRING domain_name); int32_t esp8266_tcp_connect(ESP8266_DEF_PTR obj, AT_STRING server_IP, uint32_t port); int32_t esp8266_tcp_server_open(ESP8266_DEF_PTR obj, uint32_t port); int32_t esp8266_tcp_server_close(ESP8266_DEF_PTR obj, uint32_t port); @@ -88,10 +88,10 @@ int32_t esp8266_passthr_start(ESP8266_DEF_PTR obj); int32_t esp8266_passthr_end(ESP8266_DEF_PTR obj); int32_t esp8266_passthr_write(ESP8266_DEF_PTR obj, char *buf, uint32_t cnt); uint32_t esp8266_normal_write(ESP8266_DEF_PTR obj, char *buf, uint32_t cnt); -uint32_t esp8266_connect_write(ESP8266_DEF_PTR obj, char *buf, char* connect, uint32_t cnt); +uint32_t esp8266_connect_write(ESP8266_DEF_PTR obj, char *buf, char *connect, uint32_t cnt); int32_t esp8266_read(ESP8266_DEF_PTR obj, char *buf, uint32_t timeout); uint32_t esp8266_nread(ESP8266_DEF_PTR obj, char *buf, uint32_t n); -int32_t esp8266_CIPCLOSE(ESP8266_DEF_PTR obj, char * conn_buf); +int32_t esp8266_CIPCLOSE(ESP8266_DEF_PTR obj, char *conn_buf); #endif \ No newline at end of file diff --git a/example/freertos/esp8266_wifi/main.c b/example/freertos/esp8266_wifi/main.c index cbc99984e..d70d1931f 100644 --- a/example/freertos/esp8266_wifi/main.c +++ b/example/freertos/esp8266_wifi/main.c @@ -48,7 +48,7 @@ static char http_html_body_2[] = "
This Website is used to test the AT command about HttpServer of ESP8266.