Browse Source

Save some program memory

This will save some program memory with no speed lose
GMagician 6 years ago
parent
commit
be717b3c07
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      Marlin/src/sd/Sd2Card.cpp

+ 6
- 5
Marlin/src/sd/Sd2Card.cpp View File

@@ -339,21 +339,22 @@ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
339 339
       else if (readData(dst, 512))
340 340
         return true;
341 341
 
342
+      chipDeselect();
342 343
       if (!--retryCnt) break;
343 344
 
344
-      chipDeselect();
345 345
       cardCommand(CMD12, 0); // Try sending a stop command, ignore the result.
346 346
       errorCode_ = 0;
347 347
     }
348
+  return false;
348 349
   #else
349
-    if (cardCommand(CMD17, blockNumber))
350
+    if (cardCommand(CMD17, blockNumber)) {
350 351
       error(SD_CARD_ERROR_CMD17);
352
+      chipDeselect();
353
+      return false;
354
+    }
351 355
     else
352 356
       return readData(dst, 512);
353 357
   #endif
354
-
355
-  chipDeselect();
356
-  return false;
357 358
 }
358 359
 
359 360
 /**

Loading…
Cancel
Save