Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Re-initialise SD card after removal
airzone
Beginner
Posts: 33
Permalink
Post Re-initialise SD card after removal
on: February 10, 2013, 23:01
Quote

Hi,

If I take the SD card out of the mega setup, the software won't accept it again. I suspect this is due to the SD library invalidating it's initialisation after card removal.

Is there a way to re-initialise the SD card without rebooting the polargraph?

Michael

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Re-initialise SD card after removal
on: February 11, 2013, 00:12
Quote

Hi Michael, not currently no, the only place the card gets init'd is in the setup() bits and pieces. I keep on meaning to do something that will trigger a reinit when going to the 'exec from sd' screen, but I've never got around to it. Or to add a reinit button somewhere. It is a pain, I agree. Lots of fixes and features for the new version!

sn

airzone
Beginner
Posts: 33
Permalink
Post Re: Re-initialise SD card after removal
on: February 12, 2013, 04:20
Quote

Hi Sandy,

I have tried to add sd_initsd() tied to a new button... It seems that sd.begin(xxx) fails to execute a second time... I don't really know where to go from here, but apparently the Adafruit SD wrapper won't let you hot-swap SD cards at all..

airzone
Beginner
Posts: 33
Permalink
Post Re: Re-initialise SD card after removal
on: February 12, 2013, 05:42
Quote

Oh, I did something dirty and got it to work:

1) Change SH.h to declare card, volume, and root as public, not private
2) Change sd_initsd() to remove the SD.begin(xxxx) and made all your other checks perform their initialisation against the newly public members in SD...

Dirty, dirty, dirty... But it works. Given that SD.begin does nothing than run the same initialisation code (on one line), I cannot see how it was failing before..

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.015 seconds.