From 82dc89bfd20717f044ec425de5c8c7c361b35a3c Mon Sep 17 00:00:00 2001 From: GMagician Date: Sat, 13 Jan 2018 09:46:54 +0100 Subject: [PATCH] Save some program memory This will save some program memory with no speed lose --- Marlin/Sd2Card.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Marlin/Sd2Card.cpp b/Marlin/Sd2Card.cpp index 6683e4b4fd..86c5cd9b7c 100644 --- a/Marlin/Sd2Card.cpp +++ b/Marlin/Sd2Card.cpp @@ -405,21 +405,22 @@ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) { else if (readData(dst, 512)) return true; + chipSelectHigh(); if (!--retryCnt) break; - chipSelectHigh(); 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); + chipSelectHigh(); + return false; + } else return readData(dst, 512); #endif - - chipSelectHigh(); - return false; } /**