I use esp8266 to create ,read and write files to sd card when end user scan the rfid. (store user data)
when start all go smooth and great, but when files increase in sd card, I facing sd card read and write files speed slow down.
100++ using 0.9s
500++ using 2.2s
1000++ using 4.5s
my sd card files wills going increase, sd card speed slow down.
I just like to ask how I can improve the speed of read and write.
here is my read and write code:
when start all go smooth and great, but when files increase in sd card, I facing sd card read and write files speed slow down.
100++ using 0.9s
500++ using 2.2s
1000++ using 4.5s
my sd card files wills going increase, sd card speed slow down.
I just like to ask how I can improve the speed of read and write.
here is my read and write code:
B4X:
Sub ReadSDData(filename As String) As String
Dim result As String = ""
If SD.OpenRead(filename) = True Then
Dim NByte As Int=SD.Stream.BytesAvailable
Dim Buffer(NByte) As Byte
SD.Stream.ReadBytes(Buffer, 0, NByte)
SD.Stream.Flush
result = bc.StringFromBytes(Buffer)
SD.Close
End If
Return result
End Sub
private Sub WriteSDData(filename As String,data As String)
Dim Buffer() As Byte
If SD.OpenReadWrite(filename) = True Then
SD.Position = SD.CurrentFile.Size
Buffer = bc.StringToBytes(data)
SD.Stream.WriteBytes(Buffer,0,Buffer.Length)
SD.Stream.Flush
SD.Close
End If
End Sub