Skip to content

Commit e03c1dc

Browse files
committed
fixed esp32 build
updated depricated functions for esp32
1 parent 5c9439e commit e03c1dc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ESPAsyncHTTPUpdateServer.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
7878
if(_username != emptyString && _password != emptyString)
7979
if( !request->authenticate(_username.c_str(), _password.c_str()))
8080
return request->requestAuthentication();
81+
#ifdef ESP32
82+
AsyncWebServerResponse* response = request->beginResponse(200, "text/html", serverIndex, sizeof(serverIndex));
83+
#else
8184
AsyncWebServerResponse* response = request->beginResponse_P(200, "text/html", serverIndex, sizeof(serverIndex));
85+
#endif
8286
response->addHeader("Content-Encoding", "gzip");
8387
request->send(response); });
8488

@@ -115,9 +119,13 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
115119
}
116120
else
117121
{
122+
#ifdef ESP32
123+
request->send(200, PSTR("text/html"), successResponse);
124+
#else
118125
request->send_P(200, PSTR("text/html"), successResponse);
126+
#endif
119127
Log("Rebooting...\n");
120-
restartTimer.once_ms(1000, ESP.restart);
128+
restartTimer.once_ms(1000,[]{ ESP.restart(); });
121129
} },
122130
[&](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final)
123131
{

0 commit comments

Comments
 (0)