From be717b3c07e15b81c3e4ba8b5d839f66fbdf42a1 Mon Sep 17 00:00:00 2001 From: GMagician Date: Sat, 13 Jan 2018 08:56:51 +0100 Subject: [PATCH] Save some program memory This will save some program memory with no speed lose --- Marlin/src/sd/Sd2Card.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index adecc8e61c..ba26243c95 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -339,21 +339,22 @@ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) { else if (readData(dst, 512)) return true; + chipDeselect(); if (!--retryCnt) break; - chipDeselect(); cardCommand(CMD12, 0); // Try sending a stop command, ignore the result. errorCode_ = 0; } + return false; #else - if (cardCommand(CMD17, blockNumber)) + if (cardCommand(CMD17, blockNumber)) { error(SD_CARD_ERROR_CMD17); + chipDeselect(); + return false; + } else return readData(dst, 512); #endif - - chipDeselect(); - return false; } /**