tidy up restart

This commit is contained in:
proddy
2024-08-30 11:09:05 +02:00
parent d2f6f8203f
commit 117b55cc16
10 changed files with 72 additions and 186 deletions

View File

@@ -121,20 +121,18 @@ void UploadFileService::uploadComplete(AsyncWebServerRequest * request) {
// did we just complete uploading a json file?
if (request->_tempFile) {
request->_tempFile.close(); // close the file handle as the upload is now done
emsesp::EMSESP::system_.store_nvs_values();
request->onDisconnect(RestartService::restartNow);
AsyncWebServerResponse * response = request->beginResponse(200);
request->send(response);
request->onDisconnect(RestartService::restartNow);
return;
}
// check if it was a firmware upgrade
// if no error, send the success response as a JSON
if (_is_firmware && !request->_tempObject) {
emsesp::EMSESP::system_.store_nvs_values();
request->onDisconnect(RestartService::restartNow);
AsyncWebServerResponse * response = request->beginResponse(200);
request->send(response);
request->onDisconnect(RestartService::restartNow);
return;
}