Strange behaviour writing & reading sdcard on esp32 feather


#1

Hi David

I was trying to implement the image on my sdcard , but I always had an error :
‘error reading from sdcard’
So I started looking wat was wrong and came to this conclusion :
I used the 2 small testprograms on your website :

For example, the following command writes the string “Hello” to the SD card file “Greeting.txt”:

(with-sd-card (str "Greeting.txt" 2)
  (print "Hello" str))

and the following command reads it back:

(with-sd-card (str "Greeting.txt")
  (read str))

If I run them , no errors are reported , but if I put the sdcard into my computer I see a file ‘reeting.txt’.
So it looks like the first character is gone. Tried with other names and still same problem.
I assume my connections are correct since I’m able to read and write.

Is this something that you or others can confirm ?
I’m using ulisp 2.5

Thanks
Kind regards Ronny Suy


#2

Hi Ronny,

I’ve confirmed what you describe. The fix is to change this line in MakeFilename():

char c = nthchar(arg, i);

to:

char c = nthchar(arg, i-1);

I’ll fix it in the next release, and thanks for finding it!


#3

No problem !

Thank you for your quick solution.
I can confirm it’s ok now!

Now I can continue on getting an image from sdcard for my webserver .
I will keep you informed about this.

Thanks again !
Ronny Suy


#4