我正在使用ESP32-C3的SoftAP模式创建web服务器,并使用
手机连接到该热点。当手机连接成功并熄屏一段时间后,我发现手机可以连接上热点,但无法访问页面web页面。在此期间,ESP32-C3不输出任何日志,并且无法响应。问题只能通过重新启动ESP32-C3来解决。我使用的ESP-IDF版本是v4.4.3,手机是华为p30,系统hormany os 2.0.0.268。
现象细节:
手机成功连接到ESP32-C3的热点后熄屏。
一段时间后,手机可以连接上热点,但无法访问页面web页面。
ESP32-C3在此期间没有任何日志输出,表现为无响应。
问题只能通过重新启动ESP32-C3解决,重连热点无效。
我已附上了部分相关的代码和日志,并正在寻求任何可能的解决方案或建议。有没有人遇到过类似的问题?非常感谢大家的支持和帮助!
我的web server代码使用例程中的http_server->file_serving框架,相关代码如下:Code:
Select all
/* Send HTTP response with a run-
time generated html consisting of * a list of all files and folders under the requested path. * In case of SPIFFS this returns empty list when path is any * string other than '/', since SPIFFS doesn't support directories */static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath){ char entrypath[FILE_PATH_MAX]; char entrysize[16]; const char *entrytype; struct dirent *entry; struct stat entry_stat; extern const unsigned char upload_script_en_start[] asm("_binary_page_en_html_start"); extern const unsigned char upload_script_en_end[] asm("_binary_page_en_html_end"); extern const unsigned char upload_script_start[] asm("_binary_page_cn_html_start"); extern const unsigned char upload_script_end[] asm("_binary_page_cn_html_end"); const unsigned char *chosen_script_start; const unsigned char *chosen_script_end; if (english_model) { chosen_script_start = upload_script_en_start; chosen_script_end = upload_script_en_end; } else { chosen_script_start = upload_script_start; chosen_script_end = upload_script_end; } const size_t upload_script_size = (chosen_script_end - chosen_script_start); /* Add file upload form and script which on execution sends a POST request to /upload */ httpd_resp_send(req, (const char *)chosen_script_start, upload_script_size); return ESP_OK;}/* Handler to download a file kept on the server */static esp_err_t download_get_handler(httpd_req_t *req){ char filepath[FILE_PATH_MAX]; FILE *fd = NULL; struct stat file_stat; const char *filename = get_path_from_uri(filepath, ((struct file_server_data *)req->user_ctx)->base_path, req->uri, sizeof(filepath)); if (!filename) { ESP_LOGE(TAG, "Filename is too long"); /* Respond with 500 Inter
以下是log:Code:
Select all
I (3538) wifi_init: rx ba win: 6I (3548) wifi_init: tcpip mbox: 32I (3548) wifi_init: udp mbox: 6I (3548) wifi_init: tcp mbox: 6I (3558) wifi_init: tcp tx win: 5744I (3558) wifi_init: tcp rx win: 5744I (3568) wifi_init: tcp mss: 1440I (3568) wifi_init: WiFi IRAM OP enabledI (3578) wifi_init: WiFi RX IRAM OP enabledI (3578) phy_init: phy_version 912,d001756,Jun 2 2022,16:28:07I (3628) wifi:mode : softAP (68:b6:b3:ac:31:2d)I (3628) wifi:Total power save buffer number: 16I (3628) wifi:Init max length of beacon: 752/752I (3628) wifi:Init max length of beacon: 752/752I (3638) wifi softAP: wifi_init_softap finished. SSID:EG1155_Assistant password:12345678 channel:1I (3638) file_server: Starting HTTP Serveruartsend_read_XML_infog_xml_file_read_erroruartsend_read_XML_infoVbatRsmpH==100000I (8125128) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1I (8125128) wifi:station: 42:a3:bf:4c:c2:d3 join, AID=1, bgn, 40U I (8125158) wifi softAP: station 42:a3:bf:4c:c2:d3 join, AID=1I (8126378) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2W (8126778) wifi:idx:2 (ifx:1, 42:a3:bf:4c:c2:d3), tid:0, ssn:14, winSize:64return http_resp_dir_html!return http_resp_dir_html!I (9760938) file_server: Requested URI: /favicon.icoI (9762358) file_server: Requested URI: /favicon.icoreturn icon!return http_resp_dir_html!I (9763948) file_server: Requested URI: /favicon.icoreturn icon!I (10151578) wifi:station: 42:a3:bf:4c:c2:d3 leave, AID = 1, bss_flags is 658531, bss:0x3fcb437cI (10151578) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1W (10151578) wifi:idxI (10151578) wifi softAP: station 42:a3:bf:4c:c2:d3 leave, AID=1I (10230878) wifi:new:<1,1>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1I (10230878) wifi:station: 42:a3:bf:4c:c2:d3 join, AID=1, bgn, 40UI (10230908) wifi softAP: station 42:a3:bf:4c:c2:d3 join, AID=1I (10231118) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2W (10231808) wifi:idx:2 (ifx:1, 42:a3:bf:4c:c2:d3), tid:0, ssn:14, winSize:64I (10366608) wifi:station: 42:a3:bf:4c:c2:d3 leave, AID = 1, bss_flags is 658547, bss:0x3fcb437cI (10366608) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1I (10366618) wifi softAP: station 42:a3:bf:4c:c2:d3 leave, AID=1I (10394878) wifi:new:<1,1>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1 I (10394878) wifi:station: 42:a3:bf:4c:c2:d3 join, AID=1, bgn, 40UI (10394918) wifi softAP: station 42:a3:bf:4c:c2:d3 join, AID=1I (10395098) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2I (10396138) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2W (10396768) wifi:idx:2 (ifx:1, 42:a3:bf:4c:c2:d3), tid:0, ssn:14, winSize:64W (11211828) wifi:idxW (11214648) wifi:idx:2 (ifx:1, 42:a3:bf:4c:c2:d3), tid:0, ssn:1238, winSize:64I (11215818) wifi:station: 42:a3:bf:4c:c2:d3 leave, AID = 1, bss_flags is 658531, bss:0x3fcb437cI (11215818) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1 W (11215818) wifi:idxI (11215818) wifi softAP: station 42:a3:bf:4c:c2:d3 leave, AID=1