mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-26 07:02:15 +03:00
SD: Implement readBytes (#4931)
This speeds up the ESP8266WebServer::streamFile more than 3 times. Tested on streaming the 800+ Kb file from SD (FAT32), average time without a fix was 9000 ms, with the fix is 2600 ms (maximal possible SPI speed used), which is as fast as streaming the same file from internal SPIFFS. Hardware: WeMos D1 mini.
This commit is contained in:
committed by
Earle F. Philhower, III
parent
9c46a81fb6
commit
9bc8ea1b58
@ -95,6 +95,11 @@ int File::read(void *buf, uint16_t nbyte) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t File::readBytes(char *buffer, size_t length) {
|
||||
int result = read(buffer, (uint16_t)length);
|
||||
return result < 0 ? 0 : (size_t)result;
|
||||
}
|
||||
|
||||
int File::available() {
|
||||
if (! _file) return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user