Hi all,
I started to use ESP8266 with SPIFFS File System B4R library following Erel tutorial
https://www.b4x.com/android/forum/threads/resp8266filesystem-spiffs.76487/#post-512263
Initially I had problems and ESP8266 crashed any time when listing files, after Erel's suggest me to increase a buffer size and it magically started to work.
I just increased the StackBufferSize to 2000 bytes.
Now I've a new problem, I count files with this code, it count 118 files and this is ok, but the log show a strange result as count of files...
See on the log a number inside a first square bracket, as you can see, very strange results. I use a local UInt variable to count all files, if I declare it (fileCount) as Global do not work at all.
This sometime works, sometime do not works....
This is the code:
And this is the log:
Any suggestion?
Many thanks.
I started to use ESP8266 with SPIFFS File System B4R library following Erel tutorial
https://www.b4x.com/android/forum/threads/resp8266filesystem-spiffs.76487/#post-512263
Initially I had problems and ESP8266 crashed any time when listing files, after Erel's suggest me to increase a buffer size and it magically started to work.
I just increased the StackBufferSize to 2000 bytes.
Now I've a new problem, I count files with this code, it count 118 files and this is ok, but the log show a strange result as count of files...
See on the log a number inside a first square bracket, as you can see, very strange results. I use a local UInt variable to count all files, if I declare it (fileCount) as Global do not work at all.
This sometime works, sometime do not works....
This is the code:
B4X:
Sub ListFiles
Dim fileCount As UInt = 0
For Each f As File In fs.ListFiles("/")
fileCount = fileCount + 1
Log("[", fileCount, "] [ ", f.Name, " ] ", f.Size, " bytes StackBufferUsage: ", StackBufferUsage)
astream.Write(f.Name).Write(Array As Byte(10))
Next
astream.Write(Array As Byte(0xff, 0xff, 0xff))
Log("Found ", fileCount, " files")
End Sub
And this is the log:
AppStart
Connecting to Telecom-59027407
Connected!
My IP Address: 192.168.1.4
FS Initialize result: 1
Total size: 2880 KB
Used size: 1938 KB
[1] [ /frame10.bmp ] 16438 bytes StackBufferUsage: 68
[2] [ /frame100.bmp ] 16438 bytes StackBufferUsage: 76
[3] [ /frame73.bmp ] 16438 bytes StackBufferUsage: 84
[4] [ /frame101.bmp ] 16438 bytes StackBufferUsage: 92
[5] [ /frame89.bmp ] 16438 bytes StackBufferUsage: 100
[6] [ /frame102.bmp ] 16438 bytes StackBufferUsage: 108
[7] [ /frame103.bmp ] 16438 bytes StackBufferUsage: 116
[8] [ /frame104.bmp ] 16438 bytes StackBufferUsage: 124
[9] [ /frame105.bmp ] 16438 bytes StackBufferUsage: 132
[10] [ /frame9.bmp ] 16438 bytes StackBufferUsage: 140
[11] [ /frame106.bmp ] 16438 bytes StackBufferUsage: 148
[12] [ /frame74.bmp ] 16438 bytes StackBufferUsage: 156
[13] [ /frame107.bmp ] 16438 bytes StackBufferUsage: 164
[14] [ /frame108.bmp ] 16438 bytes StackBufferUsage: 172
[15] [ /frame109.bmp ] 16438 bytes StackBufferUsage: 180
[16] [ /frame90.bmp ] 16438 bytes StackBufferUsage: 188
[17] [ /frame11.bmp ] 16438 bytes StackBufferUsage: 196
[18] [ /frame110.bmp ] 16438 bytes StackBufferUsage: 204
[19] [ /frame75.bmp ] 16438 bytes StackBufferUsage: 212
[20] [ /frame111.bmp ] 16438 bytes StackBufferUsage: 220
[21] [ /frame91.bmp ] 16438 bytes StackBufferUsage: 228
[22] [ /frame112.bmp ] 16438 bytes StackBufferUsage: 236
[23] [ /frame113.bmp ] 16438 bytes StackBufferUsage: 244
[24] [ /frame114.bmp ] 16438 bytes StackBufferUsage: 252
[25] [ /frame115.bmp ] 16438 bytes StackBufferUsage: 260
[26] [ /frame92.bmp ] 16438 bytes StackBufferUsage: 268
[27] [ /frame116.bmp ] 16438 bytes StackBufferUsage: 276
[28] [ /frame76.bmp ] 16438 bytes StackBufferUsage: 284
[29] [ /frame117.bmp ] 16438 bytes StackBufferUsage: 292
[45] [ /frame20.bmp ] 16438 bytes StackBufferUsage: 420
[46] [ /frame21.bmp ] 16438 bytes StackBufferUsage: 428
[47] [ /frame22.bmp ] 16438 bytes StackBufferUsage: 436
[48] [ /frame96.bmp ] 16438 bytes StackBufferUsage: 444
[45] [ /frame20.bmp ] 16438 bytes StackBufferUsage: 420
[46] [ /frame21.bmp ] 16438 bytes StackBufferUsage: 428
[47] [ /frame22.bmp ] 16438 bytes StackBufferUsage: 436
[48] [ /frame96.bmp ] 16438 bytes StackBufferUsage: 444
[49] [ /frame23.bmp ] 16438 bytes StackBufferUsage: 452
[50] [ /frame24.bmp ] 16438 bytes StackBufferUsage: 460
[51] [ /frame79.bmp ] 16438 bytes StackBufferUsage: 468
[52] [ /frame25.bmp ] 16438 bytes StackBufferUsage: 476
[53] [ /frame26.bmp ] 16438 bytes StackBufferUsage: 484
[54] [ /frame97.bmp ] 16438 bytes StackBufferUsage: 492
[55] [ /frame27.bmp ] 16438 bytes StackBufferUsage: 500
[56] [ /frame28.bmp ] 16438 bytes StackBufferUsage: 508
[57] [ /frame29.bmp ] 16438 bytes StackBufferUsage: 516
[58] [ /frame98.bmp ] 16438 bytes StackBufferUsage: 524
[59] [ /frame8.bmp ] 16438 bytes StackBufferUsage: 532
[68] [ /frame36.bmp ] 16438 bytes StackBufferUsage: 604
[69] [ /frame80.bmp ] 16438 bytes StackBufferUsage: 612
[70] [ /frame37.bmp ] 16438 bytes StackBufferUsage: 620
[71] [ /frame38.bmp ] 16438 bytes StackBufferUsage: 628
[72] [ /frame39.bmp ] 16438 bytes StackBufferUsage: 636
[73] [ /frame4.bmp ] 16438 bytes StackBufferUsage: 644
[74] [ /frame81.bmp ] 16438 bytes StackBufferUsage: 652
[68] [ /frame36.bmp ] 16438 bytes StackBufferUsage: 604
[69] [ /frame80.bmp ] 16438 bytes StackBufferUsage: 612
[70] [ /frame37.bmp ] 16438 bytes StackBufferUsage: 620
[71] [ /frame38.bmp ] 16438 bytes StackBufferUsage: 628
[72] [ /frame39.bmp ] 16438 bytes StackBufferUsage: 636
[73] [ /frame4.bmp ] 16438 bytes StackBufferUsage: 644
[74] [ /frame81.bmp ] 16438 bytes StackBufferUsage: 652
[83] [ /frame47.bmp ] 16438 bytes StackBufferUsage: 724
[84] [ /frame48.bmp ] 16438 bytes StackBufferUsage: 732
[85] [ /frame49.bmp ] 16438 bytes StackBufferUsage: 740
[86] [ /frame5.bmp ] 16438 bytes StackBufferUsage: 748
[87] [ /frame83.bmp ] 16438 bytes StackBufferUsage: 756
[88] [ /frame50.bmp ] 16438 bytes StackBufferUsage: 764
[89] [ /frame51.bmp ] 16438 bytes StackBufferUsage: 772
[83] [ /frame47.bmp ] 16438 bytes StackBufferUsage: 724
[84] [ /frame48.bmp ] 16438 bytes StackBufferUsage: 732
[85] [ /frame49.bmp ] 16438 bytes StackBufferUsage: 740
[86] [ /frame5.bmp ] 16438 bytes StackBufferUsage: 748
[87] [ /frame83.bmp ] 16438 bytes StackBufferUsage: 756
[88] [ /frame50.bmp ] 16438 bytes StackBufferUsage: 764
[89] [ /frame51.bmp ] 16438 bytes StackBufferUsage: 772
[99] [ /frame6.bmp ] 16438 bytes StackBufferUsage: 852
[100] [ /frame85.bmp ] 16438 bytes StackBufferUsage: 860
[101] [ /frame60.bmp ] 16438 bytes StackBufferUsage: 868
[102] [ /frame61.bmp ] 16438 bytes StackBufferUsage: 876
[103] [ /frame62.bmp ] 16438 bytes StackBufferUsage: 884
[104] [ /frame63.bmp ] 16438 bytes StackBufferUsage: 892
[99] [ /frame6.bmp ] 16438 bytes StackBufferUsage: 852
[100] [ /frame85.bmp ] 16438 bytes StackBufferUsage: 860
[101] [ /frame60.bmp ] 16438 bytes StackBufferUsage: 868
[102] [ /frame61.bmp ] 16438 bytes StackBufferUsage: 876
[103] [ /frame62.bmp ] 16438 bytes StackBufferUsage: 884
[104] [ /frame63.bmp ] 16438 bytes StackBufferUsage: 892
[114] [ /frame70.bmp ] 16438 bytes StackBufferUsage: 972
[114] [ /frame70.bmp ] 16438 bytes StackBufferUsage: 972
[115] [ /frame71.bmp ] 16438 bytes StackBufferUsage: 980
[116] [ /frame72.bmp ] 16438 bytes StackBufferUsage: 988
[117] [ /frame1.bmp ] 16438 bytes StackBufferUsage: 996
[118] [ /frame88.bmp ] 16438 bytes StackBufferUsage: 1004
Found 118 files
Closed
Any suggestion?
Many thanks.
Last edited: