-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Wifi mode AP pings only few seconds #2971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Considering this code : #include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <WebServer.h>
WebServer server(80);
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println("Configuring access point...");
WiFi.softAP("MyAP", "");
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", []() {
server.send(200, "text/plain", "OK");
});
server.begin();
}
void loop() {
// ping 192.168.4.1 from my laptop works until I uncomment this
// line then I try to reach http://192.168.4.1/
// Then the ping command stops.
// server.handleClient();
} With a fresh install, and a "erase_flash" command on the ESP32.
Is there something I doing wrong ? |
Put a delay in your loop. 50ms should give the system some time to do other tasks. |
Nothing change! |
See if the sdkconfig.h changes in b0d8d4d help. You can copy the sdkconfig.h into your sketch folder and edit it there. |
Are you sure that if I put the sdkconfig.h file into my arduino sketch folder, the arduino toolchain will use it to rebuild the binary ? Edit 1 : Ok, I replaced the file directly in :
Seems better : Now it works on my previous minimal test case but not on my real case. Edit 2 : Using the @me-no-dev Async-Web-Server, it stills freeze with the two sdkconfig.h #include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
AsyncWebServer server(80);
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.softAP("MyAP", "");
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", "Hello, world");
});
server.begin();
}
void loop() {
} Edit 3 : Using the mongoose webserver library, it works well with the new sdkconfig.h but not with the original one #include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include "mongoose.h"
static void ev_handler(struct mg_connection *nc, int ev, void *p) {
if (ev == MG_EV_HTTP_REQUEST) {
// Send Build date
mg_send_head(nc, 200, -1, "Content-Type: application/json");
mg_printf_http_chunk(nc, "{\"hwver\":%d,\"date\":\"%s\",\"time\":\"%s\"}", 1, __DATE__, __TIME__);
mg_send_http_chunk(nc, "", 0); // Send empty chunk, the end of response
nc->flags |= MG_F_SEND_AND_CLOSE;
}
}
static const char *s_http_port = "80";
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.softAP("MyAP", "");
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
struct mg_mgr mgr;
struct mg_connection *nc;
mg_mgr_init(&mgr, NULL);
printf("Starting web server on port %s\n", s_http_port);
nc = mg_bind(&mgr, s_http_port, ev_handler);
if (nc == NULL) {
printf("Failed to create listener\n");
return ;
}
// Set up HTTP server parameters
mg_set_protocol_http_websocket(nc);
for (;;) {
mg_mgr_poll(&mgr, 1000);
}
mg_mgr_free(&mgr);
}
void loop() {
} Edit 4 : Ok, after updating AsyncTCP and AsyncWebServer from github, it works using the latest sdkconfig.h |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
Hi all,
I simply use the AP WiFi exemple.
I start a ping on 192.168.4.1 then I connect to the ESP32. The WiFi connection is OK and I receive my pings... But only the first 3 or 4. Then after the ping stops until y disconnect then I reconnect.
The ping test is only for test. I have no connectivity at all (the embedded webserver does not respond).
I tried with my smartphone too. Same.
I Use the latest Arduino version (1.0.2).
No problem in STA mode.
The text was updated successfully, but these errors were encountered: