Desuuuu / Marlin

Optimized firmware for RepRap 3D printers based on the Arduino platform. Modified with a new DWIN T5UID1 touchscreen implementation.
GNU General Public License v3.0
31 stars 10 forks source link

Support for board without SD_DETECT_PIN #14

Closed mrv96 closed 3 years ago

mrv96 commented 3 years ago

This PR allows your fw to works with board without SD_DETECT_PIN. This is also helpful in case of SD external cable. With theese kind of cables the mechanic insertion of sd cards is not detected.

mrv96 commented 3 years ago

This PR needs still a little bit of tuning. Please don't merge it yet.

mrv96 commented 3 years ago

Done. Now IMHO it is ready to be merged.

Desuuuu commented 3 years ago

Is it necessary to call release() and mount() every time the menu is opened? Can't we just call mount() if isMediaInserted() returns false?

mrv96 commented 3 years ago

No. If you see the commits history i tried. Once first card.mount() is performed, isMediaInserted() returns Always true. Hence at least mount() must be executed each time. I called also release() method due to this: https://marlinfw.org/docs/gcode/M022.html that suggests to call M22 before M21

Da: Desuuuumailto:notifications@github.com Inviato: domenica 10 gennaio 2021 18:47 A: Desuuuu/Marlinmailto:Marlin@noreply.github.com Cc: mrv96mailto:marione96@live.it; Authormailto:author@noreply.github.com Oggetto: Re: [Desuuuu/Marlin] Support for board without SD_DETECT_PIN (#14)

Is it necessary to call release() and mount() every time the menu is opened? Can't we just call mount() if isMediaInserted() returns false?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Desuuuu/Marlin/pull/14#issuecomment-757515134, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADD27VSNHSY3WI6EIMX24CDSZHR2DANCNFSM4VZE6LTQ.

Desuuuu commented 3 years ago

I realize isMediaInserted() will always return true until the card is manually released, but does this cause any issue? Does the SD card not work after being re-plugged in this case?

mrv96 commented 3 years ago

IMHO mount() is sufficient, but i followed https://marlinfw.org/docs/gcode/M022.html because it is the recommended procedure if the sd is in an unknow status. If SD_DETECT_PIN is not valid I consider that sd is always in an unknow status

Da: Desuuuumailto:notifications@github.com Inviato: domenica 10 gennaio 2021 19:00 A: Desuuuu/Marlinmailto:Marlin@noreply.github.com Cc: mrv96mailto:marione96@live.it; Authormailto:author@noreply.github.com Oggetto: Re: [Desuuuu/Marlin] Support for board without SD_DETECT_PIN (#14)

I realize isMediaInserted() will always return true until the card is manually released, but does this cause any issue? Does the SD card not work after being re-plugged in this case?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Desuuuu/Marlin/pull/14#issuecomment-757517024, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADD27VXKBDYPJJBH65UYDT3SZHTMJANCNFSM4VZE6LTQ.

mrv96 commented 3 years ago

I understood your comment only right now (https://github.com/Desuuuu/Marlin/pull/14#issuecomment-757517024). During my tests, if you mount a SD, then you remove and re-insert it, you must mount it again. Otherwise the SD is not correctly read.

Desuuuu commented 3 years ago

Thanks for the details! I made a few changes (the release() call wasn't really doing anything, as you thought).

This should be ready to merge.

mrv96 commented 3 years ago

It seems ok. What does card.cdroot() do?

Desuuuu commented 3 years ago

It navigates to the root directory of the SD card. That way the user should always be at the root of the SD card when the menu is opened.

mrv96 commented 3 years ago

Ok. Perfect. For me merging is fine