Fix SDSUPPORT (and indentation)

Based on https://github.com/MarlinFirmware/Marlin/issues/8746#issuecomment-368471901 by @benlye
This commit is contained in:
Scott Lahteine 2018-02-26 14:40:40 -06:00
parent cfdcf91df5
commit 02474a321a

View file

@ -250,7 +250,7 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
#endif #endif
// set pin modes // set pin modes
//todo: should use chipSelectPin ? pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye
spiBegin(); spiBegin();
// set SCK rate for initialization commands // set SCK rate for initialization commands
@ -273,13 +273,13 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
#endif #endif
// check SD version // check SD version
while (1) { for (;;) {
if (cardCommand(CMD8, 0x1AA) == (R1_ILLEGAL_COMMAND | R1_IDLE_STATE)) { if (cardCommand(CMD8, 0x1AA) == (R1_ILLEGAL_COMMAND | R1_IDLE_STATE)) {
type(SD_CARD_TYPE_SD1); type(SD_CARD_TYPE_SD1);
break; break;
} }
// only need last byte of r7 response // Get the last byte of r7 response
for (uint8_t i = 0; i < 4; i++) status_ = spiRec(); for (uint8_t i = 0; i < 4; i++) status_ = spiRec();
if (status_ == 0xAA) { if (status_ == 0xAA) {
type(SD_CARD_TYPE_SD2); type(SD_CARD_TYPE_SD2);