mirror of
https://github.com/esphome/esphome.git
synced 2025-08-09 11:57:46 +00:00
tweak
This commit is contained in:
parent
4082634e6d
commit
8563a5785f
@ -177,10 +177,7 @@ void OTARequestHandler::handleRequest(AsyncWebServerRequest *request) {
|
|||||||
}
|
}
|
||||||
#endif // USE_ARDUINO
|
#endif // USE_ARDUINO
|
||||||
#ifdef USE_ESP_IDF
|
#ifdef USE_ESP_IDF
|
||||||
// For ESP-IDF, we use direct send() instead of beginResponse()
|
// Send response based on the OTA result
|
||||||
// to ensure the response is sent immediately before the reboot.
|
|
||||||
// If ota_backend_ is nullptr and we got here, the update completed (either success or failure)
|
|
||||||
// We'll use ota_success_ flag set by handleUpload to determine the result
|
|
||||||
request->send(200, "text/plain", this->ota_success_ ? "Update Successful!" : "Update Failed!");
|
request->send(200, "text/plain", this->ota_success_ ? "Update Successful!" : "Update Failed!");
|
||||||
return;
|
return;
|
||||||
#endif // USE_ESP_IDF
|
#endif // USE_ESP_IDF
|
||||||
|
@ -576,9 +576,6 @@ esp_err_t AsyncWebServer::handle_multipart_upload_(httpd_req_t *r, const char *c
|
|||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create reader on heap to reduce stack usage
|
|
||||||
auto reader = std::make_unique<MultipartReader>("--" + std::string(boundary_start, boundary_len));
|
|
||||||
|
|
||||||
AsyncWebServerRequest req(r);
|
AsyncWebServerRequest req(r);
|
||||||
AsyncWebHandler *handler = nullptr;
|
AsyncWebHandler *handler = nullptr;
|
||||||
for (auto *h : this->handlers_) {
|
for (auto *h : this->handlers_) {
|
||||||
@ -597,6 +594,8 @@ esp_err_t AsyncWebServer::handle_multipart_upload_(httpd_req_t *r, const char *c
|
|||||||
// Upload state
|
// Upload state
|
||||||
std::string filename;
|
std::string filename;
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
|
// Create reader on heap to reduce stack usage
|
||||||
|
auto reader = std::make_unique<MultipartReader>("--" + std::string(boundary_start, boundary_len));
|
||||||
|
|
||||||
// Configure callbacks
|
// Configure callbacks
|
||||||
reader->set_data_callback([&](const uint8_t *data, size_t len) {
|
reader->set_data_callback([&](const uint8_t *data, size_t len) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user