I created a web interface which allows me to upload files onto a (SPI connected) SD card. Everything works ok, but the upload speed is only around 100kb/s. Is there any chance to speed this up? My upload code is pretty basic:
ESP8266WebServer server(80);
server.on("/", HTTP_POST, handleNotFound, handleFileUpload);
void handleFileUpload() {
// Upload always happens on /
if (server.uri() != "/") {
Serial.println(F("Invalid upload URI"));
return;
}
HTTPUpload& upload = server.upload();
if (upload.status == UPLOAD_FILE_START) {
String filename = upload.filename;
uploadFile.open((char *)filename.c_str(), FILE_WRITE);
uploadStart = millis();
Serial.print(F("UPLOAD_FILE_START: "));
Serial.println(filename);
} else if (upload.status == UPLOAD_FILE_WRITE) {
if (uploadFile.isOpen()) {
uploadFile.write(upload.buf, upload.currentSize);
Serial.print(F("UPLOAD_FILE_WRITE: "));
Serial.println(upload.currentSize);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (uploadFile.isOpen()) {
uploadFile.close();
Serial.print(F("UPLOAD_FILE_END: "));
Serial.println(upload.totalSize);
Serial.print(F("Took: "));
Serial.println(((millis()-uploadStart)/1000));
}
}
}
(Reducing the Serial output did not affect the upload speed).
Any ideas/tips?