Scott Lahteine 7 years ago
parent
commit
02474a321a
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      Marlin/src/sd/Sd2Card.cpp

+ 8
- 8
Marlin/src/sd/Sd2Card.cpp View File

250
   #endif
250
   #endif
251
 
251
 
252
   // set pin modes
252
   // set pin modes
253
-//todo: should use chipSelectPin ?
253
+  pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye
254
   spiBegin();
254
   spiBegin();
255
 
255
 
256
   // set SCK rate for initialization commands
256
   // set SCK rate for initialization commands
268
     }
268
     }
269
   }
269
   }
270
 
270
 
271
-#if ENABLED(SD_CHECK_AND_RETRY)
272
-  crcSupported = (cardCommand(CMD59, 1) == R1_IDLE_STATE);
273
-#endif
271
+  #if ENABLED(SD_CHECK_AND_RETRY)
272
+    crcSupported = (cardCommand(CMD59, 1) == R1_IDLE_STATE);
273
+  #endif
274
 
274
 
275
   // check SD version
275
   // check SD version
276
-  while (1) {
276
+  for (;;) {
277
     if (cardCommand(CMD8, 0x1AA) == (R1_ILLEGAL_COMMAND | R1_IDLE_STATE)) {
277
     if (cardCommand(CMD8, 0x1AA) == (R1_ILLEGAL_COMMAND | R1_IDLE_STATE)) {
278
-    type(SD_CARD_TYPE_SD1);
278
+      type(SD_CARD_TYPE_SD1);
279
       break;
279
       break;
280
-  }
280
+    }
281
 
281
 
282
-    // only need last byte of r7 response
282
+    // Get the last byte of r7 response
283
     for (uint8_t i = 0; i < 4; i++) status_ = spiRec();
283
     for (uint8_t i = 0; i < 4; i++) status_ = spiRec();
284
     if (status_ == 0xAA) {
284
     if (status_ == 0xAA) {
285
       type(SD_CARD_TYPE_SD2);
285
       type(SD_CARD_TYPE_SD2);

Loading…
Cancel
Save