johnbaumann / OpenMC

Emulates a PS1 memory card(plus controllers and more) using an ESP32
Other
15 stars 3 forks source link

SD Card Auto mount/unmount #6

Open johnbaumann opened 3 years ago

johnbaumann commented 3 years ago

An attempt is made to mount the SD card at startup, but the status is not polled beyond then. If the card is unexpectedly removed or re-inserted after this time, it should be detected and handled accordingly.

johnbaumann commented 2 years ago

Latest PCB revision has chip-detect pin, assigned to GPIO 2 - LOW = Present, HIGH = Not present

During boot: Test card communication, test read etc. If CD is HIGH but card read succeeds, do not enable interrupt(bypass CD). Add a global override option for this(maybe add to config too)

During runtime: Interrupt on any edge. LOW = Mount card, HIGH = Dismount card.

Mount behavior: Treat as reboot to reload config, wifi settings, default card image, etc? Results in loss of unsaved data held in RAM -OR- Maintain card filename and resume write attempts to previous path. May result in unintentionally overwriting existing data.(Maybe don't do silly things like swap SD cards during use!)

The latter seems preferable. Reboot to reload config seems more appropriate(and easier to deal with)