espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.69k stars 7.42k forks source link

Problem downloading files from SD_MMC. Stops all the time after 5.6Kb #8465

Open champ8242 opened 1 year ago

champ8242 commented 1 year ago

Board

Olimex ESP32-GATEWAY

Device Description

Nothing, just SD card in slot. Running on USB

Hardware Configuration

Nothing special, just the Olimex settings

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

Windows 10

Flash frequency

Crystal is 40MHz

PSRAM enabled

yes

Upload speed

115200

Description

Using khoih-prog/AsyncWebServer_WT32_ETH01@^1.6.2

At the moment Downloading a file from the SD CARD File Transfer starts all the time but stops at 5.6 Kb Regardless of type or size of file

Sketch

if (request->url().startsWith("/downloadhandler"))
    {
      Serial.println("Download handler started...");
      MessageLine = "";
      File file = FS.open(filename, "r");
      String contentType = getContentType("download");
      AsyncWebServerResponse *response = request->beginResponse(contentType, file.size(), [file](uint8_t *buffer, size_t maxLen, size_t total) mutable ->  size_t
                                                                { return file.read(buffer, maxLen); });
      response->addHeader("Server", "ESP Async Web Server");
      request->send(response);
      downloadtime = millis() - start;
      downloadsize = GetFileSize(filename);
      request->redirect("/dir");
    }

Debug Message

No message

Other Steps to Reproduce

All other functions seems to work also using SPIFFS

I have checked existing issues, online documentation and the Troubleshooting Guide

SuGlider commented 1 year ago

@P-R-O-C-H-Y PTAL, Thanks!