espressif / arduino-esp32

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

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

Open champ8242 opened 11 months ago

champ8242 commented 11 months 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 11 months ago

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